From 48e1f444440f0bddcc7fcb2fb98cb8d6770ae046 Mon Sep 17 00:00:00 2001 From: kohnish Date: Sat, 15 Jan 2022 23:01:39 +0100 Subject: [PATCH] Option to disable switching window on show references --- autoload/handlers.vim | 4 +++- autoload/lspoptions.vim | 2 ++ doc/lsp.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) 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: -- 2.48.1