Home Explore Blog CI



neovim

29th chunk of `runtime/doc/lsp.txt`
cbd43c4a0a4a32c38e9f62b9d9efe32d41644326509fda220000000100000fce
 The list is filtered against {query}; if the argument is omitted from the
    call, the user is prompted to enter a string on the command line. An empty
    string means no filtering is done.

    Parameters: ~
      • {query}  (`string?`) optional
      • {opts}   (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.


==============================================================================
Lua module: vim.lsp.diagnostic                                *lsp-diagnostic*

from({diagnostics})                                *vim.lsp.diagnostic.from()*
    Converts the input `vim.Diagnostic`s to LSP diagnostics.

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

    Return: ~
        (`lsp.Diagnostic[]`)

                                          *vim.lsp.diagnostic.get_namespace()*
get_namespace({client_id}, {is_pull})
    Get the diagnostic namespace associated with an LSP client
    |vim.diagnostic| for diagnostics

    Parameters: ~
      • {client_id}  (`integer`) The id of the LSP client
      • {is_pull}    (`boolean?`) Whether the namespace is for a pull or push
                     client. Defaults to push

                                          *vim.lsp.diagnostic.on_diagnostic()*
on_diagnostic({error}, {result}, {ctx})
    |lsp-handler| for the method "textDocument/diagnostic"

    See |vim.diagnostic.config()| for configuration options.

    Parameters: ~
      • {error}   (`lsp.ResponseError?`)
      • {result}  (`lsp.DocumentDiagnosticReport`)
      • {ctx}     (`lsp.HandlerContext`)

                                 *vim.lsp.diagnostic.on_publish_diagnostics()*
on_publish_diagnostics({_}, {params}, {ctx})
    |lsp-handler| for the method "textDocument/publishDiagnostics"

    See |vim.diagnostic.config()| for configuration options.

    Parameters: ~
      • {params}  (`lsp.PublishDiagnosticsParams`)
      • {ctx}     (`lsp.HandlerContext`)


==============================================================================
Lua module: vim.lsp.codelens                                    *lsp-codelens*

clear({client_id}, {bufnr})                         *vim.lsp.codelens.clear()*
    Clear the lenses

    Parameters: ~
      • {client_id}  (`integer?`) filter by client_id. All clients if nil
      • {bufnr}      (`integer?`) filter by buffer. All buffers if nil, 0 for
                     current buffer

display({lenses}, {bufnr}, {client_id})           *vim.lsp.codelens.display()*
    Display the lenses using virtual text

    Parameters: ~
      • {lenses}     (`lsp.CodeLens[]?`) lenses to display
      • {bufnr}      (`integer`)
      • {client_id}  (`integer`)

get({bufnr})                                          *vim.lsp.codelens.get()*
    Return all lenses for the given buffer

    Parameters: ~
      • {bufnr}  (`integer`) Buffer number. 0 can be used for the current
                 buffer.

    Return: ~
        (`lsp.CodeLens[]`)

on_codelens({err}, {result}, {ctx})           *vim.lsp.codelens.on_codelens()*
    |lsp-handler| for the method `textDocument/codeLens`

    Parameters: ~
      • {err}     (`lsp.ResponseError?`)
      • {result}  (`lsp.CodeLens[]`)
      • {ctx}     (`lsp.HandlerContext`)

refresh({opts})                                   *vim.lsp.codelens.refresh()*
    Refresh the lenses.

    It is recommended to trigger this using an autocmd or via keymap.

    Example: >vim
        autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh({ bufnr = 0 })
<

    Parameters: ~
      • {opts}  (`table?`) Optional fields
                • {bufnr} (`integer?`) filter by buffer. All buffers if nil, 0
                  for current buffer

run()                                                 *vim.lsp.codelens.run()*
    Run the code lens in the current line

save({lenses}, {bufnr}, {client_id})                 *vim.lsp.codelens.save()*
    Store lenses for a specific buffer and client

    Parameters: ~
      • {lenses}     (`lsp.CodeLens[]?`) lenses to store
      •

Title: vim.lsp.diagnostic and vim.lsp.codelens Modules: Diagnostics and CodeLens Management
Summary
This section covers the `vim.lsp.diagnostic` module, including functions to convert diagnostics, get diagnostic namespaces for LSP clients, and handle diagnostic events. It also covers the `vim.lsp.codelens` module, which includes functions to clear, display, get, refresh, run, and save code lenses.