README.md | 4 ++-- autoload/handlers.vim | 4 ++-- autoload/lsp.vim | 8 +++++--- doc/lsp.txt | 16 ++++++++-------- diff --git a/README.md b/README.md index 38a9b2d8493e427c855ab371a6d1d09df38388d9..5620e139577ff8733de62809f814d13925d378fb 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,12 @@ :LspGotoDeclaration|Go to the declaration of the keyword under cursor :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 ec266c760ba8bcc6966bc0a886063586a6fd906b..7d3e210d872543a571d26fe076fb50b051260f09 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -266,9 +266,9 @@ lnum: loc.range.start.line + 1, col: GetLineByteFromPos(bnr, loc.range.start) + 1, text: text}) endfor - setqflist([], ' ', {title: 'Language Server', items: qflist}) + setloclist(0, [], ' ', {title: 'Symbol Reference', items: qflist}) var save_winid = win_getid() - copen + :lopen save_winid->win_gotoid() enddef diff --git a/autoload/lsp.vim b/autoload/lsp.vim index 2b6d621f66e35190dfb3dac1d07173a52b3bc6ed..4094178de364444cf959aaea7157e6905facbe73 100644 --- a/autoload/lsp.vim +++ b/autoload/lsp.vim @@ -215,7 +215,8 @@ if lspserver->empty() || !lspserver.running 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 @@ 'col': GetLineByteFromPos(bnr, diag.range.start) + 1, '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 24acb68e08bbf19751765eb3ec7b9f53bed2d97a..0dd85b643ea63f20ca82026568abf6ef14deae5a 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -2,7 +2,7 @@ *lsp.txt* Language Server Protocol (LSP) Plugin for Vim9 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 @@ :LspGotoTypeDef Go to the type definition of the symbol under cursor :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 @@ :LspDiagPrev Jump to the previous diagnostic message for the current 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 @@ entering a symbol name followed by a separator (e.g. a 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 @@ :LspDiagCurrent Displays the diagnostic message (if any) for the 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