Skip to content

Commit

Permalink
Merge pull request #358 from vimpostor/diagsbufreload
Browse files Browse the repository at this point in the history
Respect autoHighlightDiags when reloading a buffer
  • Loading branch information
yegappan authored Jul 12, 2023
2 parents 58a93a2 + ecff647 commit 4a65e14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions autoload/lsp/diag.vim
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export def InitOnce()

# ALE plugin support
if opt.lspOptions.aleSupport
opt.lspOptions.autoHighlightDiags = false
autocmd_add([
{
group: 'LspAleCmds',
Expand Down Expand Up @@ -215,6 +216,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
return
endif

:silent! bnr->bufload()

RemoveDiagVisualsForBuffer(bnr, all)
Expand All @@ -228,7 +234,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'
Expand Down Expand Up @@ -331,9 +336,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)
Expand Down
2 changes: 1 addition & 1 deletion test/clangd_tests.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ def g:Test_LspTagFunc()
:exe "normal \<C-]>"
assert_equal([11, 6], [line('.'), col('.')])
cursor(1, 1)
assert_fails('exe "normal \<C-]>"', 'E433: No tags file')
assert_fails('exe "normal \<C-]>"', 'E433:')

:set tagfunc&
:%bw!
Expand Down

0 comments on commit 4a65e14

Please sign in to comment.