From 6f93e751059f59009b5608539272380dcdbb16db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Magnus=20Gro=C3=9F?= Date: Tue, 11 Jul 2023 18:56:19 +0200 Subject: [PATCH] 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. --- autoload/lsp/diag.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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) -- 2.44.0