Home Explore Blog CI



neovim

9th chunk of `runtime/doc/diagnostic.txt`
644645a3533297d79d27f8bf444ec6c31fc64734b67abdc60000000100000fc3
 the
                          current cursor position (`cursor`). Shorthand
                          versions are also accepted (`c` for `cursor`, `l`
                          for `line`, `b` for `buffer`).
      • {pos}?            (`integer|[integer,integer]`) 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.
      • {severity_sort}?  (`boolean|{reverse?:boolean}`, default: `false`)
                          Sort diagnostics by severity. Overrides the setting
                          from |vim.diagnostic.config()|.
      • {severity}?       (`vim.diagnostic.SeverityFilter`) See
                          |diagnostic-severity|. Overrides the setting from
                          |vim.diagnostic.config()|.
      • {header}?         (`string|[string,any]`) 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()|.
      • {source}?         (`boolean|'if_many'`) 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()|.
      • {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.
                          Overrides the setting from
                          |vim.diagnostic.config()|.
      • {prefix}?         (`string|table|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string, string)`)
                          Prefix each diagnostic in the floating window:
                          • If a `function`, {i} is the index of the
                            diagnostic being evaluated and {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.
                          • If a `table`, it is interpreted as a
                            `[text, hl_group]` tuple as in |nvim_echo()|
                          • If a `string`, it is prepended to each diagnostic
                            in the window with no highlight. Overrides the
                            setting from |vim.diagnostic.config()|.
      • {suffix}?         (`string|table|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string, string)`)
                          Same as {prefix}, but appends the text to the
                          diagnostic instead of prepending it. Overrides the
                          setting from |vim.diagnostic.config()|.
      • {focus_id}?       (`string`)
      • {border}?         (`string`) see |nvim_open_win()|.

*vim.diagnostic.Opts.Jump*

    Fields: ~
      • {on_jump}?   (`fun(diagnostic:vim.Diagnostic?, bufnr:integer)`)
                     Default value of the {on_jump} parameter of
                     |vim.diagnostic.jump()|.
      • {wrap}?      (`boolean`, default: true) Default value of the {wrap}
                     parameter of |vim.diagnostic.jump()|.
      • {severity}?

Title: Advanced Floating Window and Jump Options for Diagnostics
Summary
This section details advanced options for configuring floating windows and jump behavior within the Neovim diagnostics system. It covers options for customizing the floating window, including setting the header, including the diagnostic source, formatting the diagnostic message with a custom function, and adding prefixes or suffixes to each diagnostic entry. It also defines the `vim.diagnostic.Opts.Jump` structure, which allows setting a callback function to be executed when jumping to a diagnostic, and options for wrapping around when jumping between them.