vim.diagnostic.Opts.Float
Fields11
Float.bufnr : nil | integer
Buffer number to show diagnostics from. (default: current buffer)
Float.namespace : integer | integer[] | nil
Limit diagnostics to the given namespace(s).
Float.scope : "line" | "buffer" | "cursor" | "c" | "l" | "b" | nil
Show diagnostics from the whole buffer (buffer), the current cursor line (line), or the current cursor position (cursor). Shorthand versions are also accepted (c for cursor, l for line, b for buffer). (default: line)
Float.pos : integer | (integer, integer) | nil
If {scope} is "line" or "cursor", use this position rather than the cursor position. If a number, interpreted as a line number; otherwise, a (row, col) tuple.
Float.severity_sort : boolean | { reverse: boolean? } | nil
Sort diagnostics by severity. Overrides the setting from |vim.diagnostic.config()|. (default: false)
Float.severity : vim.diagnostic.SeverityFilter | nil
See |diagnostic-severity|. Overrides the setting from |vim.diagnostic.config()|.
Float.header : string | (string, any) | nil
String to use as the header for the floating window. If a table, it is interpreted as a [text, hl_group] tuple. Overrides the setting from |vim.diagnostic.config()|.
Float.source : boolean | "if_many" | nil
Include the diagnostic source in the message. Use "if_many" to only show sources if there is more than one source of diagnostics in the buffer. Otherwise, any truthy value means to always show the diagnostic source. Overrides the setting from |vim.diagnostic.config()|.
Float.format : fun(diagnostic: vim.Diagnostic) -> nil | string | nil
Float.prefix : table | string | fun(diagnostic: vim.Diagnostic, i: integer, total: integer) -> ...string | nil
Prefix each diagnostic in the floating window:
- If a
function, {i} is the index of the diagnostic being evaluated and - If a
table, it is interpreted as a[text, hl_group]tuple as - If a
string, it is prepended to each diagnostic in the window with no
{total} is the total number of diagnostics displayed in the window. The function should return a string which is prepended to each diagnostic in the window as well as an (optional) highlight group which will be used to highlight the prefix.
in |nvim_echo()|
highlight. Overrides the setting from |vim.diagnostic.config()|.
Float.suffix : table | string | fun(diagnostic: vim.Diagnostic, i: integer, total: integer) -> ...string | nil
Same as {prefix}, but appends the text to the diagnostic instead of prepending it. Overrides the setting from |vim.diagnostic.config()|.