autoload/handlers.vim | 4 +++- autoload/lspoptions.vim | 2 ++ doc/lsp.txt | 1 + diff --git a/autoload/handlers.vim b/autoload/handlers.vim index 45c073823e89d9ae8b4079bac2c450608818b43f..168743e0c4f8576813374b20735d2ef20e5e7e24 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -460,7 +460,9 @@ # source window width mods = 'belowright vert :' .. (winwidth(0) * 30) / 100 endif exe mods .. 'lopen' - save_winid->win_gotoid() + if !opt.lspOptions.keepFocusInReferences + save_winid->win_gotoid() + endif lspserver.peekSymbol = false enddef diff --git a/autoload/lspoptions.vim b/autoload/lspoptions.vim index 33e73bd7a6ea307c731c14cd2ad0692ee7eeb5ed..9b93bae49c2db091240ad806bdd514c6224c9b7d 100644 --- a/autoload/lspoptions.vim +++ b/autoload/lspoptions.vim @@ -17,6 +17,8 @@ # Automatically highlight diagnostics messages from LSP server autoHighlightDiags: true, # Show the symbol documentation in the preview window instead of in a popup hoverInPreview: false, + # Focus on the location list window after LspShowReferences + keepFocusInReferences: false, } # set LSP options from user provided options diff --git a/doc/lsp.txt b/doc/lsp.txt index 96bd8c8411a48e7d2172c9524d6d77f6d993c6d8..e147d591110b752cea7857c731d51e1b3e30a8eb 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -202,6 +202,7 @@ set to false. autoHighlightDiags Automatically place signs on the lines with a diagnostic message from the LSP server. By default this is set to true. + keepFocusInReferences Focus on the location list window after LspShowReferences For example, to disable the automatic placement of signs for the LSP diagnostic messages, you can add the following line to your .vimrc file: