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,109 +828,117 @@ 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
coerced to string. Example: > 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"; } { "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
`{[vim.type_idx]=vim.types.dictionary}` use
, else it will be encoded as an `{[vim.type_idx]=vim.types.dictionary}`
array. , else it will be encoded as an
{handlers} Map of language server method names to array.
|lsp-handler| {handlers} Map of language server method names
{settings} Map with language server specific to |lsp-handler|
settings. These are returned to the {settings} Map with language server specific
language server if requested via settings. These are returned to the
`workspace/configuration` . Keys are language server if requested via
case-sensitive. `workspace/configuration` . Keys are
{init_options} Values to pass in the initialization case-sensitive.
request as `initializationOptions` . {init_options} Values to pass in the initialization
See `initialize` in the LSP spec. request as `initializationOptions` .
{name} (string, default=client-id) Name in log See `initialize` in the LSP spec.
messages. {name} (string, default=client-id) Name in
{get_language_id} function(bufnr, filetype) -> language log messages.
ID as string. Defaults to the filetype. {workspace_folders} (table) List of workspace folders
{offset_encoding} (default="utf-16") One of "utf-8", passed to the language server.
"utf-16", or "utf-32" which is the Defaults to root_dir if not set. See
encoding that the LSP server expects. `workspaceFolders` in the LSP spec
Client does not verify this is correct. {get_language_id} function(bufnr, filetype) -> language
{on_error} Callback with parameters (code, ...), ID as string. Defaults to the
invoked when the client operation filetype.
throws an error. `code` is a number {offset_encoding} (default="utf-16") One of "utf-8",
describing the error. Other arguments "utf-16", or "utf-32" which is the
may be passed depending on the error encoding that the LSP server expects.
kind. See |vim.lsp.client_errors| for Client does not verify this is
possible errors. Use correct.
`vim.lsp.client_errors[code]` to get {on_error} Callback with parameters (code, ...),
human-friendly name. invoked when the client operation
{before_init} Callback with parameters throws an error. `code` is a number
(initialize_params, config) invoked describing the error. Other arguments
before the LSP "initialize" phase, may be passed depending on the error
where `params` contains the parameters kind. See |vim.lsp.client_errors| for
being sent to the server and `config` possible errors. Use
is the config that was passed to `vim.lsp.client_errors[code]` to get
|vim.lsp.start_client()|. You can use human-friendly name.
this to modify parameters before they {before_init} Callback with parameters
are sent. (initialize_params, config) invoked
{on_init} Callback (client, initialize_result) before the LSP "initialize" phase,
invoked after LSP "initialize", where where `params` contains the
`result` is a table of `capabilities` parameters being sent to the server
and anything else the server may send. and `config` is the config that was
For example, clangd sends passed to |vim.lsp.start_client()|.
`initialize_result.offsetEncoding` if You can use this to modify parameters
`capabilities.offsetEncoding` was sent before they are sent.
to it. You can only modify the {on_init} Callback (client, initialize_result)
`client.offset_encoding` here before invoked after LSP "initialize", where
any notifications are sent. Most `result` is a table of `capabilities`
language servers expect to be sent and anything else the server may
client specified settings after send. For example, clangd sends
initialization. Neovim does not make `initialize_result.offsetEncoding` if
this assumption. A `capabilities.offsetEncoding` was
`workspace/didChangeConfiguration` sent to it. You can only modify the
notification should be sent to the `client.offset_encoding` here before
server during on_init. any notifications are sent. Most
{on_exit} Callback (code, signal, client_id) language servers expect to be sent
invoked on client exit. client specified settings after
• code: exit code of the process initialization. Neovim does not make
• signal: number describing the signal this assumption. A
used to terminate (if any) `workspace/didChangeConfiguration`
• client_id: client handle notification should be sent to the
{on_attach} Callback (client, bufnr) invoked when server during on_init.
client attaches to a buffer. {on_exit} Callback (code, signal, client_id)
{trace} "off" | "messages" | "verbose" | nil invoked on client exit.
passed directly to the language server • code: exit code of the process
in the initialize request. • signal: number describing the
Invalid/empty values will default to signal used to terminate (if any)
"off" • client_id: client handle
{flags} A table with flags for the client. The {on_attach} Callback (client, bufnr) invoked when
current (experimental) flags are: client attaches to a buffer.
• allow_incremental_sync (bool, default {trace} "off" | "messages" | "verbose" | nil
true): Allow using incremental sync passed directly to the language
for buffer edits server in the initialize request.
• debounce_text_changes (number, Invalid/empty values will default to
default nil): Debounce didChange "off"
notifications to the server by the {flags} A table with flags for the client.
given number in milliseconds. No The current (experimental) flags are:
debounce occurs if nil • 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: ~ Return: ~
Client id. |vim.lsp.get_client_by_id()| Note: client may 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* 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