From 5122cf52532f9c1ddccfb806317850c82659c050 Mon Sep 17 00:00:00 2001 From: Andreas Louv Date: Sun, 16 Apr 2023 14:02:15 +0200 Subject: [PATCH] Add error message to "LspHighlight" --- autoload/lsp/lspserver.vim | 1 + test/clangd_tests.vim | 7 +++++++ 2 files changed, 8 insertions(+) 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 -- 2.50.0