From: kohnish Date: Sat, 15 Jan 2022 22:01:39 +0000 (+0100) Subject: Option to disable switching window on show references X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=48e1f444440f0bddcc7fcb2fb98cb8d6770ae046;p=vim-lsp.git Option to disable switching window on show references --- diff --git a/autoload/handlers.vim b/autoload/handlers.vim index 45c0738..168743e 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -460,7 +460,9 @@ def s:processReferencesReply(lspserver: dict, req: dict, reply: dictwin_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 33e73bd..9b93bae 100644 --- a/autoload/lspoptions.vim +++ b/autoload/lspoptions.vim @@ -17,6 +17,8 @@ export var lspOptions: dict = { 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 96bd8c8..e147d59 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -202,6 +202,7 @@ following optional items: 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: