]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add error message to "LspHighlight"
authorAndreas Louv <andreas@louv.dk>
Sun, 16 Apr 2023 12:02:15 +0000 (14:02 +0200)
committerAndreas Louv <andreas@louv.dk>
Sun, 16 Apr 2023 16:28:50 +0000 (18:28 +0200)
autoload/lsp/lspserver.vim
test/clangd_tests.vim

index bda340d7241f7aa9e42cdb6ddac73c3abf6791db..911383ea83f23d7ac78712ea857966d2d6b8c455 100644 (file)
@@ -870,6 +870,7 @@ enddef
 # Result: DocumentHighlight[] | null
 def DocHighlightReply(bnr: number, lspserver: dict<any>, docHighlightReply: any): void
   if docHighlightReply->empty()
+    util.WarnMsg($'No highlight for the current position')
     return
   endif
 
index 7ede12b797db35663757701162d5992f83f0f14b..28c2ea8491ff37e94734ea09e8faeeff90dd3923 100644 (file)
@@ -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