autoload/lsp/lspserver.vim | 1 + test/clangd_tests.vim | 7 +++++++ diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index bda340d7241f7aa9e42cdb6ddac73c3abf6791db..911383ea83f23d7ac78712ea857966d2d6b8c455 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -870,6 +870,7 @@ # process the 'textDocument/documentHighlight' reply from the LSP server # 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 7ede12b797db35663757701162d5992f83f0f14b..28c2ea8491ff37e94734ea09e8faeeff90dd3923 100644 --- a/test/clangd_tests.vim +++ b/test/clangd_tests.vim @@ -936,6 +936,9 @@ void f1(int arg) { int i = arg; arg = 2; + if (arg == 2) { + arg = 3; + } } END setline(1, lines) @@ -956,6 +959,10 @@ :LspHighlightClear 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