From: Magnus Groß Date: Tue, 11 Jul 2023 16:56:19 +0000 (+0200) Subject: Never show diagnostics when they are disabled X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6f93e751059f59009b5608539272380dcdbb16db;p=vim-lsp.git Never show diagnostics when they are disabled 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. --- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index a17598a..e6d74d8 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -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)