Merge pull request #15142 from neovim/marvim/api-doc-update/master

docs: regenerate
This commit is contained in:
Thomas Vigouroux
2021-07-27 11:28:04 +02:00
committed by GitHub
3 changed files with 167 additions and 130 deletions

View File

@@ -2334,9 +2334,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
inserted (true for right, false for left). inserted (true for right, false for left).
Defaults to false. Defaults to false.
• priority: a priority value for the highlight • priority: a priority value for the highlight
group. Default: 4096. For example, treesitter group. For example treesitter highlighting
highlighting uses a default value of 100 (see uses a value of 100.
|lua-treesitter-highlight-priority|).
Return: ~ Return: ~
Id of the created/updated extmark Id of the created/updated extmark

View File

@@ -828,35 +828,37 @@ start_client({config}) *vim.lsp.start_client()*
table. table.
Parameters: ~ Parameters: ~
{root_dir} (required, string) Directory where the {root_dir} (required, string) Directory where
LSP server will base its rootUri on the LSP server will base its rootUri
initialization. on initialization.
{cmd} (required, string or list treated like {cmd} (required, string or list treated
|jobstart()|) Base command that like |jobstart()|) Base command that
initiates the LSP client. initiates the LSP client.
{cmd_cwd} (string, default=|getcwd()|) Directory {cmd_cwd} (string, default=|getcwd()|)
to launch the `cmd` process. Not Directory to launch the `cmd`
related to `root_dir` . process. Not related to `root_dir` .
{cmd_env} (table) Environment flags to pass to {cmd_env} (table) Environment flags to pass to
the LSP on spawn. Can be specified 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 using keys like a map or as a list
with `k=v` pairs or both. Non-string values are
coerced to string. Example: > coerced to string. Example: >
{ "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; }
< <
{capabilities} Map overriding the default capabilities {capabilities} Map overriding the default
defined by capabilities defined by
|vim.lsp.protocol.make_client_capabilities()|, |vim.lsp.protocol.make_client_capabilities()|,
passed to the language server on passed to the language server on
initialization. Hint: use initialization. Hint: use
make_client_capabilities() and modify make_client_capabilities() and modify
its result. its result.
• Note: To send an empty dictionary use • Note: To send an empty dictionary
use
`{[vim.type_idx]=vim.types.dictionary}` `{[vim.type_idx]=vim.types.dictionary}`
, else it will be encoded as an , else it will be encoded as an
array. array.
{handlers} Map of language server method names to {handlers} Map of language server method names
|lsp-handler| to |lsp-handler|
{settings} Map with language server specific {settings} Map with language server specific
settings. These are returned to the settings. These are returned to the
language server if requested via language server if requested via
@@ -865,14 +867,20 @@ start_client({config}) *vim.lsp.start_client()*
{init_options} Values to pass in the initialization {init_options} Values to pass in the initialization
request as `initializationOptions` . request as `initializationOptions` .
See `initialize` in the LSP spec. See `initialize` in the LSP spec.
{name} (string, default=client-id) Name in log {name} (string, default=client-id) Name in
messages. 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 {get_language_id} function(bufnr, filetype) -> language
ID as string. Defaults to the filetype. ID as string. Defaults to the
filetype.
{offset_encoding} (default="utf-16") One of "utf-8", {offset_encoding} (default="utf-16") One of "utf-8",
"utf-16", or "utf-32" which is the "utf-16", or "utf-32" which is the
encoding that the LSP server expects. encoding that the LSP server expects.
Client does not verify this is correct. Client does not verify this is
correct.
{on_error} Callback with parameters (code, ...), {on_error} Callback with parameters (code, ...),
invoked when the client operation invoked when the client operation
throws an error. `code` is a number throws an error. `code` is a number
@@ -885,20 +893,20 @@ start_client({config}) *vim.lsp.start_client()*
{before_init} Callback with parameters {before_init} Callback with parameters
(initialize_params, config) invoked (initialize_params, config) invoked
before the LSP "initialize" phase, before the LSP "initialize" phase,
where `params` contains the parameters where `params` contains the
being sent to the server and `config` parameters being sent to the server
is the config that was passed to and `config` is the config that was
|vim.lsp.start_client()|. You can use passed to |vim.lsp.start_client()|.
this to modify parameters before they You can use this to modify parameters
are sent. before they are sent.
{on_init} Callback (client, initialize_result) {on_init} Callback (client, initialize_result)
invoked after LSP "initialize", where invoked after LSP "initialize", where
`result` is a table of `capabilities` `result` is a table of `capabilities`
and anything else the server may send. and anything else the server may
For example, clangd sends send. For example, clangd sends
`initialize_result.offsetEncoding` if `initialize_result.offsetEncoding` if
`capabilities.offsetEncoding` was sent `capabilities.offsetEncoding` was
to it. You can only modify the sent to it. You can only modify the
`client.offset_encoding` here before `client.offset_encoding` here before
any notifications are sent. Most any notifications are sent. Most
language servers expect to be sent language servers expect to be sent
@@ -911,21 +919,21 @@ start_client({config}) *vim.lsp.start_client()*
{on_exit} Callback (code, signal, client_id) {on_exit} Callback (code, signal, client_id)
invoked on client exit. invoked on client exit.
• code: exit code of the process • code: exit code of the process
• signal: number describing the signal • signal: number describing the
used to terminate (if any) signal used to terminate (if any)
• client_id: client handle • client_id: client handle
{on_attach} Callback (client, bufnr) invoked when {on_attach} Callback (client, bufnr) invoked when
client attaches to a buffer. client attaches to a buffer.
{trace} "off" | "messages" | "verbose" | nil {trace} "off" | "messages" | "verbose" | nil
passed directly to the language server passed directly to the language
in the initialize request. server in the initialize request.
Invalid/empty values will default to Invalid/empty values will default to
"off" "off"
{flags} A table with flags for the client. The {flags} A table with flags for the client.
current (experimental) flags are: The current (experimental) flags are:
• allow_incremental_sync (bool, default • allow_incremental_sync (bool,
true): Allow using incremental sync default true): Allow using
for buffer edits incremental sync for buffer edits
• debounce_text_changes (number, • debounce_text_changes (number,
default nil): Debounce didChange default nil): Debounce didChange
notifications to the server by the notifications to the server by the
@@ -1200,6 +1208,34 @@ workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()*
============================================================================== ==============================================================================
Lua module: vim.lsp.diagnostic *lsp-diagnostic* 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()* *vim.lsp.diagnostic.clear()*
clear({bufnr}, {client_id}, {diagnostic_ns}, {sign_ns}) clear({bufnr}, {client_id}, {diagnostic_ns}, {sign_ns})
Clears the currently displayed diagnostics Clears the currently displayed diagnostics
@@ -1482,30 +1518,6 @@ save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()*
save_extmarks({bufnr}, {client_id}) save_extmarks({bufnr}, {client_id})
TODO: Documentation TODO: Documentation
set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()*
Sets the quickfix list
Parameters: ~
{opts} table|nil Configuration table. Keys:
• {open}: (boolean, default true)
• Open quickfix list after set
• {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 true)
• Set the list with workspace diagnostics
set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()*
Sets the location list Sets the location list
@@ -1530,6 +1542,30 @@ set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()*
• {workspace}: (boolean, default false) • {workspace}: (boolean, default false)
• Set the list with workspace diagnostics • Set the list with workspace diagnostics
set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()*
Sets the quickfix list
Parameters: ~
{opts} table|nil Configuration table. Keys:
• {open}: (boolean, default true)
• Open quickfix list after set
• {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 true)
• Set the list with workspace diagnostics
*vim.lsp.diagnostic.set_signs()* *vim.lsp.diagnostic.set_signs()*
set_signs({diagnostics}, {bufnr}, {client_id}, {sign_ns}, {opts}) set_signs({diagnostics}, {bufnr}, {client_id}, {sign_ns}, {opts})
Set signs for given diagnostics Set signs for given diagnostics

View File

@@ -519,9 +519,11 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
for id, node in pairs(match) do for id, node in pairs(match) do
local name = query.captures[id] local name = query.captures[id]
-- `node` was captured by the `name` capture in the match -- `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 ... ... use the info here ...
end end
end end