diff options
-rw-r--r-- | runtime/doc/api.txt | 5 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 252 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 8 |
3 files changed, 151 insertions, 114 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 9b8259c2fb..4dcf5b7bbc 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2334,9 +2334,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) inserted (true for right, false for left). Defaults to false. • priority: a priority value for the highlight - group. Default: 4096. For example, treesitter - highlighting uses a default value of 100 (see - |lua-treesitter-highlight-priority|). + group. For example treesitter highlighting + uses a value of 100. Return: ~ Id of the created/updated extmark diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 5a27e195bc..c750a65c10 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -828,109 +828,117 @@ start_client({config}) *vim.lsp.start_client()* table. Parameters: ~ - {root_dir} (required, string) Directory where the - LSP server will base its rootUri on - initialization. - {cmd} (required, string or list treated like - |jobstart()|) Base command that - initiates the LSP client. - {cmd_cwd} (string, default=|getcwd()|) Directory - to launch the `cmd` process. Not - related to `root_dir` . - {cmd_env} (table) Environment flags to pass to - the LSP on spawn. Can be specified - using keys like a map or as a list with `k=v` pairs or both. Non-string values are - coerced to string. Example: > + {root_dir} (required, string) Directory where + the LSP server will base its rootUri + on initialization. + {cmd} (required, string or list treated + like |jobstart()|) Base command that + initiates the LSP client. + {cmd_cwd} (string, default=|getcwd()|) + Directory to launch the `cmd` + process. Not related to `root_dir` . + {cmd_env} (table) Environment flags to pass to + the LSP on spawn. Can be specified + using keys like a map or as a list + with `k=v` pairs or both. Non-string values are + coerced to string. Example: > { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } < - {capabilities} 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.type_idx]=vim.types.dictionary}` - , else it will be encoded as an - array. - {handlers} Map of language server method names to - |lsp-handler| - {settings} Map with language server specific - settings. These are returned to the - language server if requested via - `workspace/configuration` . Keys are - case-sensitive. - {init_options} Values to pass in the initialization - request as `initializationOptions` . - See `initialize` in the LSP spec. - {name} (string, default=client-id) Name in log - messages. - {get_language_id} function(bufnr, filetype) -> language - ID as string. Defaults to the filetype. - {offset_encoding} (default="utf-16") One of "utf-8", - "utf-16", or "utf-32" which is the - encoding that the LSP server expects. - Client does not verify this is correct. - {on_error} Callback with parameters (code, ...), - 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.client_errors| for - possible errors. Use - `vim.lsp.client_errors[code]` to get - human-friendly name. - {before_init} Callback with parameters - (initialize_params, config) 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_client()|. You can use - this to modify parameters before they - are sent. - {on_init} Callback (client, initialize_result) - invoked after LSP "initialize", where - `result` is a table of `capabilities` - and anything else the server may send. - For example, clangd sends - `initialize_result.offsetEncoding` if - `capabilities.offsetEncoding` was sent - to it. You can only modify the - `client.offset_encoding` here before - any notifications are sent. Most - language servers expect to be sent - client specified settings after - initialization. Neovim does not make - this assumption. A - `workspace/didChangeConfiguration` - notification should be sent to the - server during on_init. - {on_exit} Callback (code, signal, client_id) - 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_attach} Callback (client, bufnr) invoked when - client attaches to a buffer. - {trace} "off" | "messages" | "verbose" | nil - passed directly to the language server - in the initialize request. - Invalid/empty values will default to - "off" - {flags} A table with flags for the client. The - current (experimental) flags are: - • allow_incremental_sync (bool, default - true): Allow using incremental sync - for buffer edits - • debounce_text_changes (number, - default nil): Debounce didChange - notifications to the server by the - given number in milliseconds. No - debounce occurs if nil + {capabilities} 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.type_idx]=vim.types.dictionary}` + , else it will be encoded as an + array. + {handlers} Map of language server method names + to |lsp-handler| + {settings} Map with language server specific + settings. These are returned to the + language server if requested via + `workspace/configuration` . Keys are + case-sensitive. + {init_options} Values to pass in the initialization + request as `initializationOptions` . + See `initialize` in the LSP spec. + {name} (string, default=client-id) Name in + log messages. + {workspace_folders} (table) List of workspace folders + passed to the language server. + Defaults to root_dir if not set. See + `workspaceFolders` in the LSP spec + {get_language_id} function(bufnr, filetype) -> language + ID as string. Defaults to the + filetype. + {offset_encoding} (default="utf-16") One of "utf-8", + "utf-16", or "utf-32" which is the + encoding that the LSP server expects. + Client does not verify this is + correct. + {on_error} Callback with parameters (code, ...), + 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.client_errors| for + possible errors. Use + `vim.lsp.client_errors[code]` to get + human-friendly name. + {before_init} Callback with parameters + (initialize_params, config) 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_client()|. + You can use this to modify parameters + before they are sent. + {on_init} Callback (client, initialize_result) + invoked after LSP "initialize", where + `result` is a table of `capabilities` + and anything else the server may + send. For example, clangd sends + `initialize_result.offsetEncoding` if + `capabilities.offsetEncoding` was + sent to it. You can only modify the + `client.offset_encoding` here before + any notifications are sent. Most + language servers expect to be sent + client specified settings after + initialization. Neovim does not make + this assumption. A + `workspace/didChangeConfiguration` + notification should be sent to the + server during on_init. + {on_exit} Callback (code, signal, client_id) + 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_attach} Callback (client, bufnr) invoked when + client attaches to a buffer. + {trace} "off" | "messages" | "verbose" | nil + passed directly to the language + server in the initialize request. + Invalid/empty values will default to + "off" + {flags} A table with flags for the client. + The current (experimental) flags are: + • allow_incremental_sync (bool, + default true): Allow using + incremental sync for buffer edits + • debounce_text_changes (number, + default nil): Debounce didChange + notifications to the server by the + given number in milliseconds. No + debounce occurs if nil Return: ~ Client id. |vim.lsp.get_client_by_id()| Note: client may @@ -1200,6 +1208,34 @@ workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()* ============================================================================== Lua module: vim.lsp.diagnostic *lsp-diagnostic* + *vim.lsp.diagnostic.apply_to_diagnostic_items()* +apply_to_diagnostic_items({item_handler}, {command}, {opts}) + Gets diagnostics, converts them to quickfix/location list + items, and applies the item_handler callback to the items. + + Parameters: ~ + {item_handler} function Callback to apply to the + diagnostic items + {command} string|nil Command to execute after + applying the item_handler + {opts} table|nil Configuration table. Keys: + • {client_id}: (number) + • If nil, will consider all clients + attached to buffer. + + • {severity}: (DiagnosticSeverity) + • Exclusive severity to consider. + Overrides {severity_limit} + + • {severity_limit}: (DiagnosticSeverity) + • Limit severity of diagnostics found. + E.g. "Warning" means { "Error", + "Warning" } will be valid. + + • {workspace}: (boolean, default false) + • Set the list with workspace + diagnostics + *vim.lsp.diagnostic.clear()* clear({bufnr}, {client_id}, {diagnostic_ns}, {sign_ns}) Clears the currently displayed diagnostics @@ -1482,13 +1518,13 @@ save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()* save_extmarks({bufnr}, {client_id}) TODO: Documentation -set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()* - Sets the quickfix list +set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* + Sets the location list Parameters: ~ {opts} table|nil Configuration table. Keys: • {open}: (boolean, default true) - • Open quickfix list after set + • Open loclist after set • {client_id}: (number) • If nil, will consider all clients attached to @@ -1503,16 +1539,16 @@ set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()* "Warning" means { "Error", "Warning" } will be valid. - • {workspace}: (boolean, default true) + • {workspace}: (boolean, default false) • Set the list with workspace diagnostics -set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* - Sets the location list +set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()* + Sets the quickfix list Parameters: ~ {opts} table|nil Configuration table. Keys: • {open}: (boolean, default true) - • Open loclist after set + • Open quickfix list after set • {client_id}: (number) • If nil, will consider all clients attached to @@ -1527,7 +1563,7 @@ set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* "Warning" means { "Error", "Warning" } will be valid. - • {workspace}: (boolean, default false) + • {workspace}: (boolean, default true) • Set the list with workspace diagnostics *vim.lsp.diagnostic.set_signs()* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 69aacedaa4..80500e3c15 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -519,9 +519,11 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) for id, node in pairs(match) do local name = query.captures[id] -- `node` was captured by the `name` capture in the match - - local node_data = metadata[id] -- Node level metadata - +< +> + local node_data = metadata[id] -- Node level metadata +< +> ... use the info here ... end end |