autoload/lsp/diag.vim | 5 +++++ autoload/lsp/options.vim | 2 ++ doc/lsp.txt | 4 ++++ diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index f812c401aaf0e89cd44b82c37bb6df22b10479b3..a0dede44ec965a3f1ee197ad4e044d139d77ecae 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -410,12 +410,17 @@ # Display the diagnostic messages from the LSP server for the current buffer # in a location list export def ShowAllDiags(): void + var save_winid = win_getid() + if !DiagsUpdateLocList(bufnr()) util.WarnMsg($'No diagnostic messages found for {@%}') return endif :lopen + if !opt.lspOptions.keepFocusInDiags + save_winid->win_gotoid() + endif enddef # Display the message of 'diag' in a popup window right below the position in diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 8e29c79e2ae39a0832b7ea49cac7359f601d8242..2253dfdc668d59edfe57f052bfd7d7ef71ed115f 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -31,6 +31,8 @@ # Show the symbol documentation in the preview window instead of in a popup hoverInPreview: false, # Don't print message when a configured language server is missing. ignoreMissingServer: false, + # Focus on the location list window after LspDiagShow + keepFocusInDiags: true, # Focus on the location list window after LspShowReferences keepFocusInReferences: false, # If true, apply the LSP server supplied text edits after a completion. diff --git a/doc/lsp.txt b/doc/lsp.txt index 7ce342a0a60210b4d96c845355ef86b8681d0a7a..8e819bdadd216ee3d7b6c0b55a7d4072dd64db18 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -438,6 +438,10 @@ By default this is set to false. *lsp-opt-ignoreMissingServer* ignoreMissingServer |Boolean| option. Do not print a missing language server executable. By default this is set to false. + *lsp-opt-keepFocusInDiags* +keepFocusInDiags |Boolean| option. Focus on the location list window + after LspDiagShow. + By default this is set to true. *lsp-opt-keepFocusInReferences* keepFocusInReferences |Boolean| option. Focus on the location list window after LspShowReferences.