From: Andreas Louv Date: Sun, 16 Apr 2023 12:02:15 +0000 (+0200) Subject: Add error message to "LspHighlight" X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5122cf52532f9c1ddccfb806317850c82659c050;p=vim-lsp.git Add error message to "LspHighlight" --- diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index bda340d..911383e 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -870,6 +870,7 @@ enddef # Result: DocumentHighlight[] | null def DocHighlightReply(bnr: number, lspserver: dict, docHighlightReply: any): void if docHighlightReply->empty() + util.WarnMsg($'No highlight for the current position') return endif diff --git a/test/clangd_tests.vim b/test/clangd_tests.vim index 7ede12b..28c2ea8 100644 --- a/test/clangd_tests.vim +++ b/test/clangd_tests.vim @@ -936,6 +936,9 @@ def g:Test_LspHighlight() { int i = arg; arg = 2; + if (arg == 2) { + arg = 3; + } } END setline(1, lines) @@ -956,6 +959,10 @@ def g:Test_LspHighlight() assert_equal([], prop_list(1)) assert_equal([], prop_list(3)) assert_equal([], prop_list(4)) + + cursor(5, 3) # if (arg == 2) { + var output = execute('LspHighlight')->split("\n") + assert_match('No highlight for the current position', output[0]) :%bw! enddef