severity
|diagnostic-severity|
• {current_line}? (`boolean`, default: `false`) Only show diagnostics
for the current line.
• {format}? (`fun(diagnostic:vim.Diagnostic): string?`) A
function that takes a diagnostic as input and returns
a string or nil. If the return value is nil, the
diagnostic is not displayed by the handler. Else the
output text is used to display the diagnostic.
*vim.diagnostic.Opts.VirtualText*
Fields: ~
• {severity}? (`vim.diagnostic.SeverityFilter`) Only show
virtual text for diagnostics matching the given
severity |diagnostic-severity|
• {current_line}? (`boolean`) Show or hide diagnostics based on
the current cursor line. If `true`, only
diagnostics on the current cursor line are
shown. If `false`, all diagnostics are shown
except on the current cursor line. If `nil`, all
diagnostics are shown. (default `nil`)
• {source}? (`boolean|"if_many"`) Include the diagnostic
source in virtual text. Use `'if_many'` to only
show sources if there is more than one
diagnostic source in the buffer. Otherwise, any
truthy value means to always show the diagnostic
source.
• {spacing}? (`integer`) Amount of empty spaces inserted at
the beginning of the virtual text.
• {prefix}? (`string|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string)`)
Prepend diagnostic message with prefix. If a
`function`, {i} is the index of the diagnostic
being evaluated, and {total} is the total number
of diagnostics for the line. This can be used to
render diagnostic symbols or error codes.
• {suffix}? (`string|(fun(diagnostic:vim.Diagnostic): string)`)
Append diagnostic message with suffix. This can
be used to render an LSP diagnostic error code.
• {format}? (`fun(diagnostic:vim.Diagnostic): string?`) If
not nil, the return value is the text used to
display the diagnostic. Example: >lua
function(diagnostic)
if diagnostic.severity == vim.diagnostic.severity.ERROR then
return string.format("E: %s", diagnostic.message)
end
return diagnostic.message
end
<
If the return value is nil, the diagnostic is
not displayed by the handler.
• {hl_mode}? (`'replace'|'combine'|'blend'`) See
|nvim_buf_set_extmark()|.
• {virt_text}? (`[string,any][]`) See |nvim_buf_set_extmark()|.
• {virt_text_pos}? (`'eol'|'eol_right_align'|'inline'|'overlay'|'right_align'`)
See |nvim_buf_set_extmark()|.
• {virt_text_win_col}? (`integer`) See |nvim_buf_set_extmark()|.
• {virt_text_hide}? (`boolean`) See |nvim_buf_set_extmark()|.
config({opts}, {namespace}) *vim.diagnostic.config()*
Configure diagnostic options globally or for a specific diagnostic
namespace.
Configuration can be specified globally, per-namespace,