From f441aee44faeecf254651e022d737b1583561d5f Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Wed, 20 Jan 2021 11:45:15 -0800 Subject: [PATCH] Use location list instead of quickfix list --- README.md | 4 ++-- autoload/handlers.vim | 4 ++-- autoload/lsp.vim | 8 +++++--- doc/lsp.txt | 16 ++++++++-------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 38a9b2d..5620e13 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,12 @@ Command|Description :LspGotoTypeDef|Go to the type definition of the keyword under cursor :LspGotoImpl|Go to the implementation of the keyword under cursor :LspShowSignature|Display the signature of the keyword under cursor -:LspDiagShow|Display the diagnostics messages from the LSP server for the current buffer +:LspDiagShow|Display the diagnostics messages from the LSP server for the current buffer in a new location list. :LspDiagFirst|Display the first diagnostic message for the current buffer :LspDiagNext|Display the next diagnostic message after the current line :LspDiagPrev|Display the previous diagnostic message before the current line :LspDiagCurrent|Display the diagnostic message for the current line -:LspShowReferences|Display the list of references to the keyword under cursor in a new quickfix list. +:LspShowReferences|Display the list of references to the keyword under cursor in a new location list. :LspHighlight|Highlight all the matches for the keyword under cursor :LspHighlightClear|Clear all the matches highlighted by :LspHighlight :LspOutline|Show the list of symbols defined in the current file in a separate window. diff --git a/autoload/handlers.vim b/autoload/handlers.vim index ec266c7..7d3e210 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -266,9 +266,9 @@ def s:processReferencesReply(lspserver: dict, req: dict, reply: dictwin_gotoid() enddef diff --git a/autoload/lsp.vim b/autoload/lsp.vim index 2b6d621..4094178 100644 --- a/autoload/lsp.vim +++ b/autoload/lsp.vim @@ -215,7 +215,8 @@ def g:LspDiagExpr(): string return '' endif - var diagInfo: dict = lspserver.getDiagByLine(v:beval_bufnr, v:beval_lnum) + var diagInfo: dict = lspserver.getDiagByLine(v:beval_bufnr, + v:beval_lnum) if diagInfo->empty() # No diagnostic for the current cursor location return '' @@ -421,8 +422,9 @@ def lsp#showDiagnostics(): void 'text': text, 'type': s:lspDiagSevToQfType(diag.severity)}) endfor - setqflist([], ' ', {'title': 'Language Server Diagnostics', 'items': qflist}) - :copen + setloclist(0, [], ' ', {'title': 'Language Server Diagnostics', + 'items': qflist}) + :lopen enddef # Show the diagnostic message for the current line diff --git a/doc/lsp.txt b/doc/lsp.txt index 24acb68..0dd85b6 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -2,7 +2,7 @@ Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) For Vim version 8.2.2342 and above -Last change: Jan 17, 2021 +Last change: Jan 20, 2021 ============================================================================== *lsp-license* @@ -75,7 +75,7 @@ The following commands are provided: :LspGotoImpl Go to the implementation of the symbol under cursor :LspShowSignature Display the signature of the symbol under cursor. :LspDiagShow Display the diagnostics messages from the LSP server - for the current buffer in a quickfix list. + for the current buffer in a location list. :LspDiagFirst Jump to the first diagnostic message for the current buffer. :LspDiagNext Jump to the next diagnostic message for the current @@ -84,7 +84,7 @@ The following commands are provided: buffer before the current line. :LspDiagCurrent Display the diagnostic message for the current line. :LspShowReferences Display the list of references to the keyword under - cursor in a new quickfix list. + cursor in a new location list. :LspHighlight Highlight all the matches for the keyword under cursor :LspHighlightClear Clear all the matches highlighted by :LspHighlight :LspOutline Show the list of symbols defined in the current file @@ -214,10 +214,10 @@ accepts a list of LSP servers with the above information. opening parenthesis). |:LspDiagShow| -:LspDiagShow Creates a new quickfix list with the diagnostics +:LspDiagShow Creates a new location list with the diagnostics messages (if any) from the LSP server for the current - file and opens the quickfix window. You can use the - Vim quickfix commands to browse the list. + file and opens the location list window. You can use + the Vim location list commands to browse the list. |:LspDiagFirst| :LspDiagFirst Jumps to the location of the first diagnostic message @@ -236,9 +236,9 @@ accepts a list of LSP servers with the above information. current line. |:LspShowReferences| -:LspShowReferences Creates a new quickfix list with the list of locations +:LspShowReferences Creates a new location list with the list of locations where the symbol under the cursor is referenced and - opens the quickfix window. + opens the location window. |:LspHighlight| :LspHighlight Highlights all the matches for the symbol under -- 2.48.1