]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Never show diagnostics when they are disabled
authorMagnus Groß <magnus@mggross.com>
Tue, 11 Jul 2023 16:56:19 +0000 (18:56 +0200)
committerMagnus Groß <magnus@mggross.com>
Tue, 11 Jul 2023 16:56:19 +0000 (18:56 +0200)
A regression was introduced in 6e4ba228eaa0770470060d8d47a360bd05a04ee5
that causes diagnostics to be displayed on buffer reload, even when the
user disabled them.

Fix this by moving the option check directly to DiagsRefresh.

autoload/lsp/diag.vim

index a17598abe6cd03d5ad1b5d3e5d6ef2b753eb666f..e6d74d838a523bd07d1b73dde8f9179a3f9cb7a6 100644 (file)
@@ -215,6 +215,11 @@ enddef
 # Refresh the placed diagnostics in buffer "bnr"
 # This inline signs, inline props, and virtual text diagnostics
 export def DiagsRefresh(bnr: number, all: bool = false)
+  var lspOpts = opt.lspOptions
+  if !lspOpts.autoHighlightDiags || lspOpts.aleSupport
+    return
+  endif
+
   :silent! bnr->bufload()
 
   RemoveDiagVisualsForBuffer(bnr, all)
@@ -228,7 +233,6 @@ export def DiagsRefresh(bnr: number, all: bool = false)
   var diag_align: string = 'above'
   var diag_wrap: string = 'truncate'
   var diag_symbol: string = '┌─'
-  var lspOpts = opt.lspOptions
 
   if lspOpts.diagVirtualTextAlign == 'below'
     diag_align = 'below'
@@ -331,9 +335,6 @@ export def ProcessNewDiags(bnr: number)
   var lspOpts = opt.lspOptions
   if lspOpts.aleSupport
     SendAleDiags(bnr, -1)
-    return
-  elseif !lspOpts.autoHighlightDiags
-    return
   endif
 
   if bnr == -1 || !diagsMap->has_key(bnr)