Home Explore Blog CI



neovim

22th chunk of `runtime/doc/lsp.txt`
83807d6b3d802184bf7f951a8f5e41dcc8632226fb1c66ee0000000100000fbc
                     `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. `code` is a number describing the error.
                               Other arguments may be passed depending on the
                               error kind. See `vim.lsp.rpc.client_errors` for
                               possible errors. Use
                               `vim.lsp.rpc.client_errors[code]` to get
                               human-friendly name.
      • {on_exit}?             (`elem_or_list<fun(code: integer, signal: integer, client_id: integer)>`)
                               Callback invoked on client exit.
                               • code: exit code of the process
                               • signal: number describing the signal used to
                                 terminate (if any)
                               • client_id: client handle
      • {on_init}?             (`elem_or_list<fun(client: vim.lsp.Client, init_result: lsp.InitializeResult)>`)
                               Callback invoked after LSP "initialize", where
                               `result` is a table of `capabilities` and
                               anything else the server may send. For example,
                               clangd sends `init_result.offsetEncoding` if
                               `capabilities.offsetEncoding` was sent to it.
                               You can only modify the
                               `client.offset_encoding` here before any
                               notifications are sent.
      • {root_dir}?            (`string`) Directory where the LSP server will
                               base its workspaceFolders, rootUri, and
                               rootPath on initialization.
      • {settings}?            (`lsp.LSPObject`) Map of language
                               server-specific settings, decided by the
                               client. Sent to the LS if requested via
                               `workspace/configuration`. Keys are
                               case-sensitive.
      • {trace}?               (`'off'|'messages'|'verbose'`, default: "off")
                               Passed directly to the language server in the
                               initialize request. Invalid/empty values will
      • {workspace_folders}?   (`lsp.WorkspaceFolder[]`) List of workspace
                               folders passed to the language server. For
                               backwards compatibility rootUri and rootPath
                               are derived from the first workspace folder in
                               this list. Can be `null` if the client supports
                               workspace folders but none are configured. See
                               `workspaceFolders` in LSP spec.
      • {workspace_required}?  (`boolean`, default: `false`) Server requires a
                               workspace (no "single file" support). Note:
                               Without a workspace, cross-file features
                

Title: vim.lsp.ClientConfig Continued: Callbacks, Directories, Settings, and Workspaces
Summary
This section details further `vim.lsp.ClientConfig` options. It covers: `on_error` (extended explanation of error callback arguments), `on_exit` (callback invoked on client exit with exit code and signal), `on_init` (callback after LSP initialization to modify client settings), `root_dir` (directory used for workspace folders), `settings` (language server-specific settings), `trace` (trace level passed to the language server), `workspace_folders` (list of workspace folders), and `workspace_required` (flag indicating if a workspace is required).