endfor
enddef
+# Toggle the LSP diagnostics highlighting in all the buffers
+export def DiagsHighlightToggle()
+ if opt.lspOptions.autoHighlightDiags
+ DiagsHighlightDisable()
+ else
+ DiagsHighlightEnable()
+ endif
+enddef
+
# Some options are changed. If 'autoHighlightDiags' option is changed, then
# either enable or disable diags auto highlight.
export def LspDiagsOptionsChanged()
# Command-line completion for the ":LspDiag highlight" command
def LspDiagHighlightComplete(arglead: string, cmdline: string, cursorPos: number): list<string>
- return LspSubCmdComplete(['enable', 'disable'], arglead, cmdline, cursorPos)
+ return LspSubCmdComplete(['enable', 'disable', 'toggle'], arglead, cmdline, cursorPos)
enddef
# Command-line completion for the ":LspDiag" command
diag.DiagsHighlightEnable()
elseif subcmd == 'disable'
diag.DiagsHighlightDisable()
+ elseif subcmd == 'toggle'
+ diag.DiagsHighlightToggle()
else
util.ErrMsg($':LspDiag highlight - Unsupported argument "{subcmd}"')
endif
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
For Vim version 9.0 and above
-Last change: Feb 13, 2024
+Last change: Sep 30, 2024
==============================================================================
CONTENTS *lsp-contents*
:LspDiag highlight enable
Enable highlighting lines with a diagnostic message
for the current Vim session.
+:LspDiag highlight toggle
+ Toggle highlighting lines with a diagnostic message
+ for the current Vim session.
:LspDiag last Jump to the last diagnostic message for the current
buffer.
:LspDiag next Jump to the next diagnostic message for the current
for the current Vim session. Note that highlighting
lines with a diagnostic message is enabled by default.
+:LspDiag highlight toggle *:LspDiag-highlight-toggle*
+ Toggle (enable or disable) highlighting lines with a
+ diagnostic message for the current Vim session in all
+ the buffers.
+
*:LspDiag-last*
:LspDiag last Jumps to the location of the first diagnostic message
for the current file.
If you wish to temporarily disable the automatic diagnostic highlighting for
the current Vim session, you can achieve this using the ":LspDiag highlight
disable" command. When you want to re-enable the highlighting, you can use
-the ":LspDiag highlight enable" command.
+the ":LspDiag highlight enable" command. To toggle the highlighting, you can
+use the ":LspDiag highlight toggle" command.
To permanently disable the automatic highlighting of diagnostics, you can set
the "autoHighlightDiags" option to |v:false| in your .vimrc file. This
feedkeys(":LspDiag \<C-A>\<CR>", 'xt')
assert_equal('LspDiag first current here highlight last next nextWrap prev prevWrap show', @:)
feedkeys(":LspDiag highlight \<C-A>\<CR>", 'xt')
- assert_equal('LspDiag highlight enable disable', @:)
+ assert_equal('LspDiag highlight enable disable toggle', @:)
assert_equal(['Error: :LspDiag - Unsupported argument "xyz"'],
execute('LspDiag xyz')->split("\n"))
assert_equal(['Error: :LspDiag - Unsupported argument "first xyz"'],