]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Option to disable switching window on show references
authorkohnish <kohnish@gmx.com>
Sat, 15 Jan 2022 22:01:39 +0000 (23:01 +0100)
committerkohnish <kohnish@gmx.com>
Sun, 16 Jan 2022 18:13:47 +0000 (19:13 +0100)
autoload/handlers.vim
autoload/lspoptions.vim
doc/lsp.txt

index 45c073823e89d9ae8b4079bac2c450608818b43f..168743e0c4f8576813374b20735d2ef20e5e7e24 100644 (file)
@@ -460,7 +460,9 @@ def s:processReferencesReply(lspserver: dict<any>, req: dict<any>, reply: dict<a
     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
 
index 33e73bd7a6ea307c731c14cd2ad0692ee7eeb5ed..9b93bae49c2db091240ad806bdd514c6224c9b7d 100644 (file)
@@ -17,6 +17,8 @@ export var lspOptions: dict<any> = {
   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
index 96bd8c8411a48e7d2172c9524d6d77f6d993c6d8..e147d591110b752cea7857c731d51e1b3e30a8eb 100644 (file)
@@ -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: