Home Explore Blog CI



neovim

12th chunk of `runtime/doc/diagnostic.txt`
335354c170a1e0815afd53be4e62a62363f30f0e64be099c0000000100000fc1
                                  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, or ephemerally
    (i.e. only for a single call to |vim.diagnostic.set()| or
    |vim.diagnostic.show()|). Ephemeral configuration has highest priority,
    followed by namespace configuration, and finally global configuration.

    For example, if a user enables virtual text globally with >lua
        vim.diagnostic.config({ virtual_text = true })
<

    and a diagnostic producer sets diagnostics with >lua
        vim.diagnostic.set(ns, 0, diagnostics, { virtual_text = false })
<

    then virtual text will not be enabled for those diagnostics.

    Parameters: ~
      • {opts}       (`vim.diagnostic.Opts?`) When omitted or `nil`, retrieve
                     the current configuration. Otherwise, a configuration
                     table (see |vim.diagnostic.Opts|).
      • {namespace}  (`integer?`) Update the options for the given namespace.
                     When omitted, update the global diagnostic options.

    Return: ~
        (`vim.diagnostic.Opts?`) Current diagnostic config if {opts} is
        omitted. See |vim.diagnostic.Opts|.

count({bufnr}, {opts})                                *vim.diagnostic.count()*
    Get current diagnostics count.

    Parameters: ~
      • {bufnr}  (`integer?`) Buffer number to get diagnostics from. Use 0 for
                 current buffer or nil for all buffers.
      • {opts}   (`vim.diagnostic.GetOpts?`) See |vim.diagnostic.GetOpts|.

    Return: ~
        (`table`) Table with actually present severity values as keys (see
        |diagnostic-severity|) and integer counts as values.

enable({enable}, {filter})                           *vim.diagnostic.enable()*
    Enables or disables diagnostics.

    To "toggle", pass the inverse of `is_enabled()`: >lua
        vim.diagnostic.enable(not vim.diagnostic.is_enabled())
<

    Parameters: ~
      • {enable}  (`boolean?`) true/nil to enable, false to disable
      • {filter}  (`table?`) Optional filters |kwargs|, or `nil` for all.
                  • {ns_id}? (`integer`) Diagnostic namespace, or `nil` for
                    all.
                  • {bufnr}? (`integer`) Buffer number, or 0 for current
                    buffer, or `nil` for all buffers.

fromqflist({list})                               *vim.diagnostic.fromqflist()*
    Convert a list of quickfix items to a list of diagnostics.

    Parameters: ~
      • {list}  (`table[]`) List of quickfix items from |getqflist()| or
                |getloclist()|.

    Return: ~
        (`vim.Diagnostic[]`) See |vim.Diagnostic|.

get({bufnr}, {opts})                                    *vim.diagnostic.get()*
    Get current diagnostics.

    Modifying diagnostics in the returned table has no effect. To set
    diagnostics in a buffer, use |vim.diagnostic.set()|.

    Parameters: ~
      • {bufnr}  (`integer?`) Buffer number to get diagnostics from. Use 0 for
                 current buffer or nil for all buffers.
      • {opts}   (`vim.diagnostic.GetOpts?`) See |vim.diagnostic.GetOpts|.

    Return: ~

Title: More Diagnostic Functions: Configuration, Counting, Enabling, and Getting Diagnostics
Summary
This section describes several functions related to diagnostics in Neovim. It covers `vim.diagnostic.config()` for setting global or namespace-specific options, `vim.diagnostic.count()` for getting the number of diagnostics, `vim.diagnostic.enable()` for enabling or disabling diagnostics, `vim.diagnostic.fromqflist()` for converting quickfix items to diagnostics, and `vim.diagnostic.get()` for retrieving the current diagnostics in a buffer.