]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add option to automatically populate location list with diagnostics
authorGregory Anders <greande@sandia.gov>
Wed, 30 Mar 2022 16:04:21 +0000 (10:04 -0600)
committerGregory Anders <greande@sandia.gov>
Wed, 30 Mar 2022 16:07:17 +0000 (10:07 -0600)
autoload/lsp/diag.vim
autoload/lsp/lspoptions.vim
doc/lsp.txt

index 72801a5534ba5d4020a2312c682879270eabd5b1..c9423ef272e261cf7426e6b5346136b658ff61f1 100644 (file)
@@ -44,6 +44,10 @@ enddef
 # 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<any>, 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<any>): void
+export def ShowAllDiags(lspserver: dict<any>, open = true): void
   var fname: string = expand('%:p')
   if fname == ''
     return
@@ -177,7 +181,9 @@ export def ShowAllDiags(lspserver: dict<any>): void
   endfor
   setloclist(0, [], ' ', {'title': 'Language Server Diagnostics',
                                                        'items': qflist})
-  :lopen
+  if open
+    :lopen
+  endif
 enddef
 
 # Show the diagnostic message for the current line
index b5bc6ce16b55913f6cc0cce29f623eef350dc145..c1895469a242e58e02bee63c4ffad403cec4109b 100644 (file)
@@ -15,6 +15,8 @@ export var lspOptions: dict<any> = {
   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
index 0ad70a077aed7a2057c2c24ea7dd535294684471..c05402e8dfca5631ed5f2e067222a3413b670821 100644 (file)
@@ -212,6 +212,9 @@ echoSignature               In insert mode, echo the current symbol signature
 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