autoload/lsp/options.vim | 2 ++ autoload/lsp/symbol.vim | 14 +++++++++++--- doc/lsp.txt | 11 ++++++++++- diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 2a779d0927b8469ea8b4ad631286d8fe4c3601e7..b80b03dd9afe0e64a7d96033ff049d6238a2e3cd 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -72,6 +72,8 @@ diagSignInfoText: 'I>', diagSignInfoTexthl: 'Pmenu', diagSignHintText: 'H>', diagSignHintTexthl: 'Question', + # ShowReferences in a quickfix list instead of a location list` + useQuickfixForLocations: false } # set the LSP plugin options from the user provided option values diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index db0b590ebf7591c0d3a8e0b7503a6641b396825c..4c99a2aa1996d9554efe1a273cc4409b8484b3c0 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -376,9 +376,17 @@ text: text}) endfor var save_winid = win_getid() - setloclist(0, [], ' ', {title: title, items: qflist}) - var mods: string = '' - exe $'{mods} lopen' + + if opt.lspOptions.useQuickfixForLocations + setqflist([], ' ', {title: title, items: qflist}) + var mods: string = '' + exe $'{mods} copen' + else + setloclist(0, [], ' ', {title: title, items: qflist}) + var mods: string = '' + exe $'{mods} lopen' + endif + if !opt.lspOptions.keepFocusInReferences save_winid->win_gotoid() endif diff --git a/doc/lsp.txt b/doc/lsp.txt index ed38318338ea5b2e59f18d8443c06e141711c2dc..394a72f52d0211347f887a3b2273886bb79b95f4 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -344,6 +344,9 @@ outlineOnRight |Boolean| option. Open the outline window on the right side, by default this is false. outlineWinSize |Number| option. The size of the symbol Outline window. By default this is set to 20. +useQuickfixForLocations |Boolean| option. Show |:LspShowReferences| in a + quickfix list instead of a location list. + By default this is set to false. showDiagInPopup |Boolean| option. When using the |:LspDiagCurrent| command to display the diagnostic message for the current line, use a popup window to display the @@ -671,7 +674,13 @@ *:LspShowReferences* :LspShowReferences Creates a new location list with the list of locations where the symbol under the cursor is referenced and - opens the location window. + opens the location window. If you want to show the + references in a quickfix list instead of in a location + list set > + + call LspOptionsSet({'useQuickfixForLocations': v:true}) +< + Set ' :LspShowServerCapabilities *:LspShowServerCapabilities* Display the list of language server capabilities for