Home Explore Blog CI



neovim

20th chunk of `runtime/doc/lsp.txt`
7ac9c70c608264e7bde5b81c7d3c2a7e6ff5fa3b040fe73b0000000100000fbb
 force: boolean?)`)
                                See |Client:stop()|.
      • {is_stopped}            (`fun(self: vim.lsp.Client): boolean`) See
                                |Client:is_stopped()|.
      • {exec_cmd}              (`fun(self: vim.lsp.Client, command: lsp.Command, context: {bufnr?: integer}?, handler: lsp.Handler?)`)
                                See |Client:exec_cmd()|.
      • {on_attach}             (`fun(self: vim.lsp.Client, bufnr: integer)`)
                                See |Client:on_attach()|.
      • {supports_method}       (`fun(self: vim.lsp.Client, method: string, bufnr: integer?)`)
                                See |Client:supports_method()|.

*vim.lsp.Client.Progress*
    Extends: |vim.Ringbuf|


    Fields: ~
      • {pending}  (`table<lsp.ProgressToken,lsp.LSPAny>`)

*vim.lsp.ClientConfig*

    Fields: ~
      • {before_init}?         (`fun(params: lsp.InitializeParams, config: vim.lsp.ClientConfig)`)
                               Callback invoked before the LSP "initialize"
                               phase, where `params` contains the parameters
                               being sent to the server and `config` is the
                               config that was passed to |vim.lsp.start()|.
                               You can use this to modify parameters before
                               they are sent.
      • {capabilities}?        (`lsp.ClientCapabilities`) Map overriding the
                               default capabilities defined by
                               |vim.lsp.protocol.make_client_capabilities()|,
                               passed to the language server on
                               initialization. Hint: use
                               make_client_capabilities() and modify its
                               result.
                               • Note: To send an empty dictionary use
                                 |vim.empty_dict()|, else it will be encoded
                                 as an array.
      • {cmd}                  (`string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`)
                               command string[] that launches the language
                               server (treated as in |jobstart()|, must be
                               absolute or on `$PATH`, shell constructs like
                               "~" are not expanded), or function that creates
                               an RPC client. Function receives a
                               `dispatchers` table and returns a table with
                               member functions `request`, `notify`,
                               `is_closing` and `terminate`. See
                               |vim.lsp.rpc.request()|,
                               |vim.lsp.rpc.notify()|. For TCP there is a
                               builtin RPC client factory:
                               |vim.lsp.rpc.connect()|
      • {cmd_cwd}?             (`string`, default: cwd) Directory to launch
                               the `cmd` process. Not related to `root_dir`.
      • {cmd_env}?             (`table`) Environment variables passed to the
                               LSP process on spawn. Non-string values are
                               coerced to string. Example: >lua
                                   { PORT = 8080; HOST = '0.0.0.0'; }
<
      • {commands}?            (`table<string,fun(command: lsp.Command, ctx: table)>`)
                               Client commands. Map of command names to
                               user-defined functions. Commands passed to
                               `start()` take precedence over the global
                               command registry. Each key must be a unique
                               command name, and the value is a function which
                               is called if any LSP action (code action, code
                               lenses, …) triggers the

Title: vim.lsp.Client Methods and Configurations Details
Summary
This section details various methods of the `vim.lsp.Client` object, including `stop`, `is_stopped`, `exec_cmd`, `on_attach`, and `supports_method`. It further defines the structure and fields of `vim.lsp.Client.Progress`, extending `vim.Ringbuf` and containing a `pending` table. The section elaborates on the `vim.lsp.ClientConfig`, describing fields like `before_init` (a callback before LSP initialization), `capabilities` (overriding default client capabilities), `cmd` (command to launch the language server), `cmd_cwd` (working directory for the command), `cmd_env` (environment variables for the LSP process), and `commands` (client-defined commands).