Home Explore Blog CI



neovim

21th chunk of `runtime/doc/lsp.txt`
9c133c1f55d047f412e196eb20d8f4cc60cbfc6d63decb1e0000000100000fbf
 (`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 command.
      • {detached}?            (`boolean`, default: `true`) Daemonize the
                               server process so that it runs in a separate
                               process group from Nvim. Nvim will shutdown the
                               process on exit, but if Nvim fails to exit
                               cleanly this could leave behind orphaned server
                               processes.
      • {flags}?               (`table`) A table with flags for the client.
                               The current (experimental) flags are:
                               • {allow_incremental_sync}? (`boolean`,
                                 default: `true`) Allow using incremental sync
                                 for buffer edits
                               • {debounce_text_changes} (`integer`, default:
                                 `150`) Debounce `didChange` notifications to
                                 the server by the given number in
                                 milliseconds. No debounce occurs if `nil`.
                               • {exit_timeout} (`integer|false`, default:
                                 `false`) Milliseconds to wait for server to
                                 exit cleanly after sending the "shutdown"
                                 request before sending kill -15. If set to
                                 false, nvim exits immediately after sending
                                 the "shutdown" request to the server.
      • {get_language_id}?     (`fun(bufnr: integer, filetype: string): string`)
                               Language ID as string. Defaults to the buffer
                               filetype.
      • {handlers}?            (`table<string,function>`) Map of LSP method
                               names to |lsp-handler|s.
      • {init_options}?        (`lsp.LSPObject`) Values to pass in the
                               initialization request as
                               `initializationOptions`. See `initialize` in
                               the LSP spec.
      • {name}?                (`string`, default: client-id) Name in logs and
                               user messages.
      • {offset_encoding}?     (`'utf-8'|'utf-16'|'utf-32'`) Called "position
                               encoding" in LSP spec. The encoding that the
                               LSP server expects, used for communication. Not
                               validated. Can be modified in `on_init` before
                               text is sent to the server.
      • {on_attach}?           (`elem_or_list<fun(client: vim.lsp.Client, bufnr: integer)>`)
                               Callback invoked when client attaches to a
                               buffer.
      • {on_error}?            (`fun(code: integer, err: string)`) Callback
                               invoked when the client operation throws an
                               error.

Title: vim.lsp.ClientConfig Continued: Server Management, Flags, and Callbacks
Summary
This section continues detailing the `vim.lsp.ClientConfig` options. It covers `cmd_cwd` (directory to launch the server), `cmd_env` (environment variables for the server process), `commands` (client-specific command mappings), `detached` (daemonizing the server process), `flags` (experimental flags like incremental sync and debounce settings), `get_language_id` (function to determine language ID), `handlers` (LSP method handlers), `init_options` (initialization request values), `name` (client name for logs), `offset_encoding` (text encoding for LSP communication), `on_attach` (callback when client attaches to a buffer), and `on_error` (callback for client errors).