# Remove all the existing diagnostic signs
sign_unplace('LSPDiag', {buffer: bnr})
- if has('patch-9.0.1157') && opt.lspOptions.showDiagWithVirtualText
+ if has('patch-9.0.1157') && opt.lspOptions.showDiagWithVirtualText && opt.lspOptions.autoHighlightDiags
# Remove all virtual text
prop_remove({type: 'LspDiagVirtualText', bufnr: bnr, all: true})
endif
+ # remove add virtual text in all bufs if auto highlight digs off
+ if !opt.lspOptions.autoHighlightDiags
+ for binfo in getbufinfo({bufloaded: true})
+ prop_remove({type: 'LspDiagVirtualText', bufnr: binfo.bufnr, all: true})
+ endfor
+ endif
+
if !lspserver.diagsMap->has_key(bnr) ||
lspserver.diagsMap[bnr].sortedDiagnostics->empty()
return
lnum: lnum,
name: DiagSevToSignName(diag.severity)})
- if has('patch-9.0.1157') && opt.lspOptions.showDiagWithVirtualText
+ if has('patch-9.0.1157') && opt.lspOptions.showDiagWithVirtualText && opt.lspOptions.autoHighlightDiags
prop_add( lnum, 0, {
bufnr: bnr,
type: 'LspDiagVirtualText',
# Disable the LSP diagnostics highlighting in all the buffers
export def DiagsHighlightDisable()
+ # turn off all diags highlight
+ opt.lspOptions.autoHighlightDiags = false
+ # refresh for removing diagnostic virtual text
+ for binfo in getbufinfo({bufloaded: true})
+ var lspserver: dict<any> = buf.BufLspServerGet(binfo.bufnr)
+ if !lspserver->empty() && lspserver.running
+ DiagsRefreshSigns(lspserver, binfo.bufnr)
+ endif
+ endfor
# Remove all the existing diagnostic signs in all the buffers
sign_unplace('LSPDiag')
- opt.lspOptions.autoHighlightDiags = false
enddef
# Enable the LSP diagnostics highlighting
version 9.0.0178 or later.
showDiagWithVirtualText |Boolean| option. Show diagnostic messages text from the language
server with virtual text. By default this is set to false.
+ Needs autoHighlightDiags == true
Needs Vim version 9.0.1157 or later.
diagVirtualTextHL |String| option.
The highlight group used for a diagnostics virtual text.