Home Explore Blog CI



neovim

16th chunk of `runtime/doc/diagnostic.txt`
7d9ff453084afd9f3f4ea2b12342ebc2b74a3f27916df2d30000000100000d51
 {winnr}? (`integer`, default: `0`) Window number to set
                  location list for.
                • {open}? (`boolean`, default: `true`) Open the location list
                  after setting.
                • {title}? (`string`) Title of the location list. Defaults to
                  "Diagnostics".
                • {severity}? (`vim.diagnostic.SeverityFilter`) See
                  |diagnostic-severity|.
                • {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 in the location list. Else the output text is
                  used to display the diagnostic.

setqflist({opts})                                 *vim.diagnostic.setqflist()*
    Add all diagnostics to the quickfix list.

    Parameters: ~
      • {opts}  (`table?`) Configuration table with the following keys:
                • {namespace}? (`integer[]|integer`) Only add diagnostics from
                  the given namespace(s).
                • {open}? (`boolean`, default: `true`) Open quickfix list
                  after setting.
                • {title}? (`string`) Title of quickfix list. Defaults to
                  "Diagnostics". If there's already a quickfix list with this
                  title, it's updated. If not, a new quickfix list is created.
                • {severity}? (`vim.diagnostic.SeverityFilter`) See
                  |diagnostic-severity|.
                • {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 in the quickfix list. Else the output text is
                  used to display the diagnostic.

                                                       *vim.diagnostic.show()*
show({namespace}, {bufnr}, {diagnostics}, {opts})
    Display diagnostics for the given namespace and buffer.

    Parameters: ~
      • {namespace}    (`integer?`) Diagnostic namespace. When omitted, show
                       diagnostics from all namespaces.
      • {bufnr}        (`integer?`) Buffer number, or 0 for current buffer.
                       When omitted, show diagnostics in all buffers.
      • {diagnostics}  (`vim.Diagnostic[]?`) The diagnostics to display. When
                       omitted, use the saved diagnostics for the given
                       namespace and buffer. This can be used to display a
                       list of diagnostics without saving them or to display
                       only a subset of diagnostics. May not be used when
                       {namespace} or {bufnr} is nil. See |vim.Diagnostic|.
      • {opts}         (`vim.diagnostic.Opts?`) Display options. See
                       |vim.diagnostic.Opts|.

toqflist({diagnostics})                            *vim.diagnostic.toqflist()*
    Convert a list of diagnostics to a list of quickfix items that can be
    passed to |setqflist()| or |setloclist()|.

    Parameters: ~
      • {diagnostics}  (`vim.Diagnostic[]`) See |vim.Diagnostic|.

    Return: ~
        (`table[]`) Quickfix list items |setqflist-what|


 vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:

Title: Diagnostic Functions: Quickfix List Configuration, Displaying Diagnostics, and Conversion to Quickfix Items
Summary
This section covers the `vim.diagnostic.setqflist()` function, which adds all diagnostics to the quickfix list, and explains its configuration options. It also details `vim.diagnostic.show()`, which displays diagnostics for a specified namespace and buffer, and `vim.diagnostic.toqflist()`, which converts a list of diagnostics into a format suitable for use with `setqflist()` or `setloclist()`.