|
1 | 1 | ---@class LspSetupConfig |
2 | | ----@field root_dir fun(filename: string, bufnr: number): string | nil Returns either a filepath (string) or nil. The language server will only start if the function returns a filepath. |
| 2 | +---@field root_dir fun(filename: string, bufnr: number): string | nil Returns either a filepath (string) or nil. |
| 3 | +---The language server will only start if the function returns a filepath. |
3 | 4 | ---@field name? string Defaults to the server's name (`clangd`, `pyright`, etc.). |
4 | 5 | ---@field filetypes string[] | nil Set of filetypes for which to attempt to resolve {root_dir} |
5 | | ----@field autostart? boolean Controls if the `FileType` autocommand that launches a language server is created. If `false`, allows for deferring language servers until manually launched with `:LspStart` (|lspconfig-commands|). |
6 | | ----@field single_file_support? boolean Determines if a server is started without a matching root directory. See |lspconfig-single-file-support|. |
7 | | ----@field on_new_config fun(new_config: LspSetupConfig, new_root_dir: string) Function executed after a root directory is detected. This is used to modify the server configuration (including `cmd` itself). Most commonly, this is used to inject additional arguments into `cmd`. |
8 | | ----@field capabilities table<string, string|table|boolean|function> a table which represents the neovim client capabilities. Useful for broadcasting to the server additional functionality (snippets, off-protocol features) provided by plugins. |
9 | | ----@field cmd string[] a list where each entry corresponds to the blankspace delimited part of the command that launches the server. The first entry is the binary used to run the language server. Additional entries are passed as arguments. |
10 | | ----@field handlers table<string, function> a list of handlers which override the function used to process a response from a given language server. Applied only to the server referenced by setup. See |lsp-handler|. |
11 | | ----@field init_options table<string, string|table|boolean> a table passed during the initialization notification after launching a language server. Equivalent to the `initializationOptions` field found in `InitializeParams` in the LSP specification. |
12 | | ----@field on_attach fun(client: object, bufnr: number) Callback invoked by Nvim's built-in client when attaching a buffer to a language server. Often used to set Nvim (buffer or global) options or to override the Nvim client properties (`server_capabilities`) after a language server attaches. Most commonly used for settings buffer local keybindings. See |lspconfig-keybindings| for a usage example. |
13 | | ----@field settings table <string, string|table|boolean> The `settings` table is sent in `on_init` via a `workspace/didChangeConfiguration` notification from the Nvim client to the language server. These settings allow a user to change optional runtime settings of the language server. |
| 6 | +---@field autostart? boolean Controls if the `FileType` autocommand that launches a language server is created. |
| 7 | +---If `false`, allows for deferring language servers until manually launched with `:LspStart` (|lspconfig-commands|). |
| 8 | +---@field single_file_support? boolean Determines if a server is started without a matching root directory. |
| 9 | +---See |lspconfig-single-file-support|. |
| 10 | +---@field on_new_config fun(new_config: LspSetupConfig, new_root_dir: string) Function executed after a root directory |
| 11 | +---is detected. This is used to modify the server configuration (including `cmd` itself). |
| 12 | +---Most commonly, this is used to inject additional arguments into `cmd`. |
| 13 | +---@field capabilities table<string, string|table|boolean|function> a table which represents the neovim client |
| 14 | +---capabilities. Useful for broadcasting to the server additional functionality (snippets, off-protocol features) |
| 15 | +---provided by plugins. |
| 16 | +---@field cmd string[] a list where each entry corresponds to the blankspace delimited part of the command that |
| 17 | +---launches the server. The first entry is the binary used to run the language server. |
| 18 | +---Additional entries are passed as arguments. |
| 19 | +---@field handlers table<string, function> a list of handlers which override the function used to process a response |
| 20 | +---from a given language server. Applied only to the server referenced by setup. See |lsp-handler|. |
| 21 | +---@field init_options table<string, string|table|boolean> a table passed during the initialization notification after |
| 22 | +---launching a language server. Equivalent to the `initializationOptions` field found in `InitializeParams` |
| 23 | +---in the LSP specification. |
| 24 | +---@field on_attach fun(client: object, bufnr: number) Callback invoked by Nvim's built-in client when attaching a |
| 25 | +---buffer to a language server. Often used to set Nvim (buffer or global) options or to override the Nvim client |
| 26 | +---properties (`server_capabilities`) after a language server attaches. Most commonly used for settings buffer local |
| 27 | +---keybindings. See |lspconfig-keybindings| for a usage example. |
| 28 | +---@field settings table <string, string|table|boolean> The `settings` table is sent in `on_init` via a |
| 29 | +---`workspace/didChangeConfiguration` notification from the Nvim client to the language server. |
| 30 | +---These settings allow a user to change optional runtime settings of the language server. |
14 | 31 |
|
15 | 32 | ---@class LspClientRequestParameters |
16 | 33 | ---@field command string |
|
23 | 40 | ---@field code number |
24 | 41 | ---@field message string |
25 | 42 |
|
| 43 | +---@alias LspClientRequest fun(err: any, result: any) |
| 44 | + |
26 | 45 | ---@class LspClient |
27 | 46 | ---@field attached_buffers table<number, boolean> |
28 | 47 | ---@field cancel_request function |
|
36 | 55 | ---@field name string |
37 | 56 | ---@field notify fun(method: string, params: object): boolean |
38 | 57 | ---@field offset_encoding string |
39 | | ----@field request fun(method: string, params: LspClientRequestParameters, callback: fun(err: any, result: any), bufnr?: number): any |
| 58 | +---@field request fun(method:string,params:LspClientRequestParameters,callback:LspClientRequest, bufnr?:number): any |
40 | 59 | ---@field request_sync function |
41 | 60 | ---@field requests object |
42 | 61 | ---@field rpc object |
|
0 commit comments