autoload/lsp/diag.vim | 10 ++++++++-- autoload/lsp/lspoptions.vim | 2 ++ doc/lsp.txt | 3 +++ diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index 72801a5534ba5d4020a2312c682879270eabd5b1..c9423ef272e261cf7426e6b5346136b658ff61f1 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -44,6 +44,10 @@ # New LSP diagnostic messages received from the server for a file. # Update the signs placed in the buffer for this file def ProcessNewDiags(lspserver: dict, bnr: number) + if opt.lspOptions.autoPopulateDiags + ShowAllDiags(lspserver, false) + endif + if !opt.lspOptions.autoHighlightDiags return endif @@ -152,7 +156,7 @@ enddef # Display the diagnostic messages from the LSP server for the current buffer # in a location list -export def ShowAllDiags(lspserver: dict): void +export def ShowAllDiags(lspserver: dict, open = true): void var fname: string = expand('%:p') if fname == '' return @@ -177,7 +181,9 @@ 'type': DiagSevToQfType(diag.severity)}) endfor setloclist(0, [], ' ', {'title': 'Language Server Diagnostics', 'items': qflist}) - :lopen + if open + :lopen + endif enddef # Show the diagnostic message for the current line diff --git a/autoload/lsp/lspoptions.vim b/autoload/lsp/lspoptions.vim index b5bc6ce16b55913f6cc0cce29f623eef350dc145..c1895469a242e58e02bee63c4ffad403cec4109b 100644 --- a/autoload/lsp/lspoptions.vim +++ b/autoload/lsp/lspoptions.vim @@ -15,6 +15,8 @@ # instead of showing it in a popup echoSignature: false, # Automatically highlight diagnostics messages from LSP server autoHighlightDiags: true, + # Automatically populate the location list with new diagnostics + autoPopulateDiags: false, # Show the symbol documentation in the preview window instead of in a popup hoverInPreview: false, # Focus on the location list window after LspShowReferences diff --git a/doc/lsp.txt b/doc/lsp.txt index 0ad70a077aed7a2057c2c24ea7dd535294684471..c05402e8dfca5631ed5f2e067222a3413b670821 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -212,6 +212,9 @@ 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. +autoPopulateDiags Automatically populate the location list with + diagnostics from the LSP server. By default this is + set to false. keepFocusInReferences Focus on the location list window after LspShowReferences. By default this is set to false. noNewlineInCompletion Suppress adding a new line on completion selection