feat(docs): format parameter list as a list

Problem:
The {foo} parameters listed in `:help api` and similar generated docs,
are intended to be a "list" but they aren't prefixed with a list symbol.
This prevents parsers from understanding the list, which forces
generators like `gen_help_html.lua` to use hard-wrapped/preformatted
layout instead of a soft-wrapped "flow" layout.

Solution:
Modify gen_vimdoc.py to prefix {foo} parameters with a "•" symbol.
This commit is contained in:
Justin M. Keyes
2022-10-04 17:41:58 +02:00
parent 179d2d67d8
commit 24e5b5c8c7
6 changed files with 682 additions and 682 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -342,7 +342,7 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
any of the above. any of the above.
Parameters: ~ Parameters: ~
{opts} (table|nil) When omitted or "nil", retrieve the current {opts} (table|nil) When omitted or "nil", retrieve the current
configuration. Otherwise, a configuration table with the configuration. Otherwise, a configuration table with the
following keys: following keys:
• underline: (default true) Use underline for • underline: (default true) Use underline for
@@ -397,32 +397,32 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
severities are displayed before lower severities (e.g. severities are displayed before lower severities (e.g.
ERROR is displayed before WARN). Options: ERROR is displayed before WARN). Options:
• reverse: (boolean) Reverse sort order • reverse: (boolean) Reverse sort order
{namespace} (number|nil) Update the options for the given namespace. {namespace} (number|nil) Update the options for the given namespace.
When omitted, update the global diagnostic options. When omitted, update the global diagnostic options.
disable({bufnr}, {namespace}) *vim.diagnostic.disable()* disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer. Disable diagnostics in the given buffer.
Parameters: ~ Parameters: ~
{bufnr} (number|nil) Buffer number, or 0 for current buffer. When {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, disable diagnostics in all buffers. omitted, disable diagnostics in all buffers.
{namespace} (number|nil) Only disable diagnostics for the given {namespace} (number|nil) Only disable diagnostics for the given
namespace. namespace.
enable({bufnr}, {namespace}) *vim.diagnostic.enable()* enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer. Enable diagnostics in the given buffer.
Parameters: ~ Parameters: ~
{bufnr} (number|nil) Buffer number, or 0 for current buffer. When {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, enable diagnostics in all buffers. omitted, enable diagnostics in all buffers.
{namespace} (number|nil) Only enable diagnostics for the given {namespace} (number|nil) Only enable diagnostics for the given
namespace. namespace.
fromqflist({list}) *vim.diagnostic.fromqflist()* fromqflist({list}) *vim.diagnostic.fromqflist()*
Convert a list of quickfix items to a list of diagnostics. Convert a list of quickfix items to a list of diagnostics.
Parameters: ~ Parameters: ~
{list} (table) A list of quickfix items from |getqflist()| or {list} (table) A list of quickfix items from |getqflist()| or
|getloclist()|. |getloclist()|.
Return: ~ Return: ~
@@ -432,9 +432,9 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics. Get current diagnostics.
Parameters: ~ Parameters: ~
{bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for
current buffer or nil for all buffers. current buffer or nil for all buffers.
{opts} (table|nil) A table with the following keys: {opts} (table|nil) A table with the following keys:
• namespace: (number) Limit diagnostics to the given • namespace: (number) Limit diagnostics to the given
namespace. namespace.
• lnum: (number) Limit diagnostics to the given line number. • lnum: (number) Limit diagnostics to the given line number.
@@ -447,7 +447,7 @@ get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata. Get namespace metadata.
Parameters: ~ Parameters: ~
{namespace} (number) Diagnostic namespace {namespace} (number) Diagnostic namespace
Return: ~ Return: ~
(table) Namespace metadata (table) Namespace metadata
@@ -462,7 +462,7 @@ get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position. Get the next diagnostic closest to the cursor position.
Parameters: ~ Parameters: ~
{opts} (table) See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
(table) Next diagnostic (table) Next diagnostic
@@ -471,7 +471,7 @@ get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
Return the position of the next diagnostic in the current buffer. Return the position of the next diagnostic in the current buffer.
Parameters: ~ Parameters: ~
{opts} (table) See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
(table) Next diagnostic position as a (row, col) tuple. (table) Next diagnostic position as a (row, col) tuple.
@@ -480,7 +480,7 @@ get_prev({opts}) *vim.diagnostic.get_prev()*
Get the previous diagnostic closest to the cursor position. Get the previous diagnostic closest to the cursor position.
Parameters: ~ Parameters: ~
{opts} (table) See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
(table) Previous diagnostic (table) Previous diagnostic
@@ -489,7 +489,7 @@ get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
Return the position of the previous diagnostic in the current buffer. Return the position of the previous diagnostic in the current buffer.
Parameters: ~ Parameters: ~
{opts} (table) See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
(table) Previous diagnostic position as a (row, col) tuple. (table) Previous diagnostic position as a (row, col) tuple.
@@ -498,7 +498,7 @@ goto_next({opts}) *vim.diagnostic.goto_next()*
Move to the next diagnostic. Move to the next diagnostic.
Parameters: ~ Parameters: ~
{opts} (table|nil) Configuration table with the following keys: {opts} (table|nil) Configuration table with the following keys:
• namespace: (number) Only consider diagnostics from the given • namespace: (number) Only consider diagnostics from the given
namespace. namespace.
• cursor_position: (cursor position) Cursor position as a • cursor_position: (cursor position) Cursor position as a
@@ -519,7 +519,7 @@ goto_prev({opts}) *vim.diagnostic.goto_prev()*
Move to the previous diagnostic in the current buffer. Move to the previous diagnostic in the current buffer.
Parameters: ~ Parameters: ~
{opts} (table) See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
hide({namespace}, {bufnr}) *vim.diagnostic.hide()* hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics. Hide currently displayed diagnostics.
@@ -532,9 +532,9 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|. |vim.diagnostic.disable()|.
Parameters: ~ Parameters: ~
{namespace} (number|nil) Diagnostic namespace. When omitted, hide {namespace} (number|nil) Diagnostic namespace. When omitted, hide
diagnostics from all namespaces. diagnostics from all namespaces.
{bufnr} (number|nil) Buffer number, or 0 for current buffer. When {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, hide diagnostics in all buffers. omitted, hide diagnostics in all buffers.
*vim.diagnostic.match()* *vim.diagnostic.match()*
@@ -555,13 +555,13 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
< <
Parameters: ~ Parameters: ~
{str} (string) String to parse diagnostics from. {str} (string) String to parse diagnostics from.
{pat} (string) Lua pattern with capture groups. {pat} (string) Lua pattern with capture groups.
{groups} (table) List of fields in a |diagnostic-structure| to {groups} (table) List of fields in a |diagnostic-structure| to
associate with captures from {pat}. associate with captures from {pat}.
{severity_map} (table) A table mapping the severity field from {severity_map} (table) A table mapping the severity field from
{groups} with an item from |vim.diagnostic.severity|. {groups} with an item from |vim.diagnostic.severity|.
{defaults} (table|nil) Table of default values for any fields not {defaults} (table|nil) Table of default values for any fields not
listed in {groups}. When omitted, numeric values listed in {groups}. When omitted, numeric values
default to 0 and "severity" defaults to ERROR. default to 0 and "severity" defaults to ERROR.
@@ -573,7 +573,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window. Show diagnostics in a floating window.
Parameters: ~ Parameters: ~
{opts} (table|nil) Configuration table with the same keys as {opts} (table|nil) Configuration table with the same keys as
|vim.lsp.util.open_floating_preview()| in addition to the |vim.lsp.util.open_floating_preview()| in addition to the
following: following:
• bufnr: (number) Buffer number to show diagnostics from. • bufnr: (number) Buffer number to show diagnostics from.
@@ -631,27 +631,27 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
re-displayed, use |vim.diagnostic.hide()|. re-displayed, use |vim.diagnostic.hide()|.
Parameters: ~ Parameters: ~
{namespace} (number|nil) Diagnostic namespace. When omitted, remove {namespace} (number|nil) Diagnostic namespace. When omitted, remove
diagnostics from all namespaces. diagnostics from all namespaces.
{bufnr} (number|nil) Remove diagnostics for the given buffer. {bufnr} (number|nil) Remove diagnostics for the given buffer.
When omitted, diagnostics are removed for all buffers. When omitted, diagnostics are removed for all buffers.
set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()* set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer. Set diagnostics for the given namespace and buffer.
Parameters: ~ Parameters: ~
{namespace} (number) The diagnostic namespace {namespace} (number) The diagnostic namespace
{bufnr} (number) Buffer number {bufnr} (number) Buffer number
{diagnostics} (table) A list of diagnostic items {diagnostics} (table) A list of diagnostic items
|diagnostic-structure| |diagnostic-structure|
{opts} (table|nil) Display options to pass to {opts} (table|nil) Display options to pass to
|vim.diagnostic.show()| |vim.diagnostic.show()|
setloclist({opts}) *vim.diagnostic.setloclist()* setloclist({opts}) *vim.diagnostic.setloclist()*
Add buffer diagnostics to the location list. Add buffer diagnostics to the location list.
Parameters: ~ Parameters: ~
{opts} (table|nil) Configuration table with the following keys: {opts} (table|nil) Configuration table with the following keys:
• namespace: (number) Only add diagnostics from the given • namespace: (number) Only add diagnostics from the given
namespace. namespace.
• winnr: (number, default 0) Window number to set location • winnr: (number, default 0) Window number to set location
@@ -666,7 +666,7 @@ setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list. Add all diagnostics to the quickfix list.
Parameters: ~ Parameters: ~
{opts} (table|nil) Configuration table with the following keys: {opts} (table|nil) Configuration table with the following keys:
• namespace: (number) Only add diagnostics from the given • namespace: (number) Only add diagnostics from the given
namespace. namespace.
• open: (boolean, default true) Open quickfix list after • open: (boolean, default true) Open quickfix list after
@@ -680,17 +680,17 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer. Display diagnostics for the given namespace and buffer.
Parameters: ~ Parameters: ~
{namespace} (number|nil) Diagnostic namespace. When omitted, show {namespace} (number|nil) Diagnostic namespace. When omitted, show
diagnostics from all namespaces. diagnostics from all namespaces.
{bufnr} (number|nil) Buffer number, or 0 for current buffer. {bufnr} (number|nil) Buffer number, or 0 for current buffer.
When omitted, show diagnostics in all buffers. When omitted, show diagnostics in all buffers.
{diagnostics} (table|nil) The diagnostics to display. When omitted, {diagnostics} (table|nil) The diagnostics to display. When omitted,
use the saved diagnostics for the given namespace and use the saved diagnostics for the given namespace and
buffer. This can be used to display a list of buffer. This can be used to display a list of
diagnostics without saving them or to display only a diagnostics without saving them or to display only a
subset of diagnostics. May not be used when {namespace} subset of diagnostics. May not be used when {namespace}
or {bufnr} is nil. or {bufnr} is nil.
{opts} (table|nil) Display options. See {opts} (table|nil) Display options. See
|vim.diagnostic.config()|. |vim.diagnostic.config()|.
toqflist({diagnostics}) *vim.diagnostic.toqflist()* toqflist({diagnostics}) *vim.diagnostic.toqflist()*
@@ -698,7 +698,7 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()*
passed to |setqflist()| or |setloclist()|. passed to |setqflist()| or |setloclist()|.
Parameters: ~ Parameters: ~
{diagnostics} (table) List of diagnostics |diagnostic-structure|. {diagnostics} (table) List of diagnostics |diagnostic-structure|.
Return: ~ Return: ~
array of quickfix list items |setqflist-what| array of quickfix list items |setqflist-what|

View File

@@ -539,8 +539,8 @@ buf_attach_client({bufnr}, {client_id}) *vim.lsp.buf_attach_client()*
Without calling this, the server won't be notified of changes to a buffer. Without calling this, the server won't be notified of changes to a buffer.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer handle, or 0 for current {bufnr} (number) Buffer handle, or 0 for current
{client_id} (number) Client id {client_id} (number) Client id
buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()* buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
Detaches client from the specified buffer. Note: While the server is Detaches client from the specified buffer. Note: While the server is
@@ -548,23 +548,23 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
send notifications should it ignore this notification. send notifications should it ignore this notification.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer handle, or 0 for current {bufnr} (number) Buffer handle, or 0 for current
{client_id} (number) Client id {client_id} (number) Client id
buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()* buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()*
Checks if a buffer is attached for a particular client. Checks if a buffer is attached for a particular client.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer handle, or 0 for current {bufnr} (number) Buffer handle, or 0 for current
{client_id} (number) the client id {client_id} (number) the client id
buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()* buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()*
Send a notification to a server Send a notification to a server
Parameters: ~ Parameters: ~
{bufnr} [number] (optional): The number of the buffer {bufnr} [number] (optional): The number of the buffer
{method} [string]: Name of the request method {method} [string]: Name of the request method
{params} [string]: Arguments to send to the server {params} [string]: Arguments to send to the server
Return: ~ Return: ~
true if any client returns true; false otherwise true if any client returns true; false otherwise
@@ -576,10 +576,10 @@ buf_request_all({bufnr}, {method}, {params}, {callback})
|vim.lsp.buf_request()| but the return result and callback are different. |vim.lsp.buf_request()| but the return result and callback are different.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer handle, or 0 for current. {bufnr} (number) Buffer handle, or 0 for current.
{method} (string) LSP method name {method} (string) LSP method name
{params} (optional, table) Parameters to send to the server {params} (optional, table) Parameters to send to the server
{callback} (function) The callback to call when all requests are {callback} (function) The callback to call when all requests are
finished. finished.
Return: ~ Return: ~
@@ -595,10 +595,10 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
result is different. Wait maximum of {timeout_ms} (default 1000) ms. result is different. Wait maximum of {timeout_ms} (default 1000) ms.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer handle, or 0 for current. {bufnr} (number) Buffer handle, or 0 for current.
{method} (string) LSP method name {method} (string) LSP method name
{params} (optional, table) Parameters to send to the server {params} (optional, table) Parameters to send to the server
{timeout_ms} (optional, number, default=1000) Maximum time in {timeout_ms} (optional, number, default=1000) Maximum time in
milliseconds to wait for a result. milliseconds to wait for a result.
Return: ~ Return: ~
@@ -666,7 +666,7 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Checks whether a client is stopped. Checks whether a client is stopped.
Parameters: ~ Parameters: ~
{client_id} (Number) {client_id} (Number)
Return: ~ Return: ~
true if client is stopped, false otherwise. true if client is stopped, false otherwise.
@@ -676,8 +676,8 @@ for_each_buffer_client({bufnr}, {fn})
Invokes a function for each LSP client attached to a buffer. Invokes a function for each LSP client attached to a buffer.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer number {bufnr} (number) Buffer number
{fn} (function) Function to run on each client attached to buffer {fn} (function) Function to run on each client attached to buffer
{bufnr}. The function takes the client, client ID, and buffer {bufnr}. The function takes the client, client ID, and buffer
number as arguments. Example: > number as arguments. Example: >
@@ -696,7 +696,7 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`. 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
Parameters: ~ Parameters: ~
{opts} (table) options for customizing the formatting expression {opts} (table) options for customizing the formatting expression
which takes the following optional keys: which takes the following optional keys:
• timeout_ms (default 500ms). The timeout period for the • timeout_ms (default 500ms). The timeout period for the
formatting request. formatting request.
@@ -705,7 +705,7 @@ get_active_clients({filter}) *vim.lsp.get_active_clients()*
Get active clients. Get active clients.
Parameters: ~ Parameters: ~
{filter} (table|nil) A table with key-value pairs used to filter the {filter} (table|nil) A table with key-value pairs used to filter the
returned clients. The available keys are: returned clients. The available keys are:
• id (number): Only return clients with the given id • id (number): Only return clients with the given id
• bufnr (number): Only return clients attached to this • bufnr (number): Only return clients attached to this
@@ -720,7 +720,7 @@ get_buffers_by_client_id({client_id})
Returns list of buffers attached to client_id. Returns list of buffers attached to client_id.
Parameters: ~ Parameters: ~
{client_id} (number) client id {client_id} (number) client id
Return: ~ Return: ~
list of buffer ids list of buffer ids
@@ -730,7 +730,7 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
not yet be fully initialized. not yet be fully initialized.
Parameters: ~ Parameters: ~
{client_id} (number) client id {client_id} (number) client id
Return: ~ Return: ~
|vim.lsp.client| object, or nil |vim.lsp.client| object, or nil
@@ -745,8 +745,8 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
Implements 'omnifunc' compatible LSP completion. Implements 'omnifunc' compatible LSP completion.
Parameters: ~ Parameters: ~
{findstart} 0 or 1, decides behavior {findstart} 0 or 1, decides behavior
{base} If findstart=0, text to match against {base} If findstart=0, text to match against
Return: ~ Return: ~
(number) Decided by {findstart}: (number) Decided by {findstart}:
@@ -768,7 +768,7 @@ set_log_level({level}) *vim.lsp.set_log_level()*
Use `lsp.log_levels` for reverse lookup. Use `lsp.log_levels` for reverse lookup.
Parameters: ~ Parameters: ~
{level} [number|string] the case insensitive level name or number {level} [number|string] the case insensitive level name or number
See also: ~ See also: ~
|vim.lsp.log_levels| |vim.lsp.log_levels|
@@ -818,9 +818,9 @@ start({config}, {opts}) *vim.lsp.start()*
`ftplugin/<filetype_name>.lua` (See |ftplugin-name|) `ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
Parameters: ~ Parameters: ~
{config} (table) Same configuration as documented in {config} (table) Same configuration as documented in
|vim.lsp.start_client()| |vim.lsp.start_client()|
{opts} nil|table Optional keyword arguments: {opts} nil|table Optional keyword arguments:
• reuse_client (fun(client: client, config: table): boolean) • reuse_client (fun(client: client, config: table): boolean)
Predicate used to decide if a client should be re-used. Predicate used to decide if a client should be re-used.
Used on all running clients. The default implementation Used on all running clients. The default implementation
@@ -837,7 +837,7 @@ start_client({config}) *vim.lsp.start_client()*
The following parameters describe fields in the {config} table. The following parameters describe fields in the {config} table.
Parameters: ~ Parameters: ~
{cmd} (table|string|fun(dispatchers: table):table) {cmd} (table|string|fun(dispatchers: table):table)
command string or list treated like |jobstart()|. command string or list treated like |jobstart()|.
The command must launch the language server The command must launch the language server
process. `cmd` can also be a function that process. `cmd` can also be a function that
@@ -848,26 +848,26 @@ start_client({config}) *vim.lsp.start_client()*
|vim.lsp.rpc.notify()| For TCP there is a |vim.lsp.rpc.notify()| For TCP there is a
built-in rpc client factory: built-in rpc client factory:
|vim.lsp.rpc.connect()| |vim.lsp.rpc.connect()|
{cmd_cwd} (string, default=|getcwd()|) Directory to launch {cmd_cwd} (string, default=|getcwd()|) Directory to launch
the `cmd` process. Not related to `root_dir`. the `cmd` process. Not related to `root_dir`.
{cmd_env} (table) Environment flags to pass to the LSP on {cmd_env} (table) Environment flags to pass to the LSP on
spawn. Can be specified using keys like a map or 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 as a list with `k=v` pairs or both. Non-string values are coerced to
string. Example: > string. Example: >
{ "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; }
< <
{detached} (boolean, default true) Daemonize the server {detached} (boolean, default true) Daemonize the server
process so that it runs in a separate process process so that it runs in a separate process
group from Nvim. Nvim will shutdown the process group from Nvim. Nvim will shutdown the process
on exit, but if Nvim fails to exit cleanly this on exit, but if Nvim fails to exit cleanly this
could leave behind orphaned server processes. could leave behind orphaned server processes.
{workspace_folders} (table) List of workspace folders passed to the {workspace_folders} (table) List of workspace folders passed to the
language server. For backwards compatibility language server. For backwards compatibility
rootUri and rootPath will be derived from the rootUri and rootPath will be derived from the
first workspace folder in this list. See first workspace folder in this list. See
`workspaceFolders` in the LSP spec. `workspaceFolders` in the LSP spec.
{capabilities} Map overriding the default capabilities defined {capabilities} Map overriding the default capabilities defined
by |vim.lsp.protocol.make_client_capabilities()|, by |vim.lsp.protocol.make_client_capabilities()|,
passed to the language server on initialization. passed to the language server on initialization.
Hint: use make_client_capabilities() and modify Hint: use make_client_capabilities() and modify
@@ -875,44 +875,44 @@ start_client({config}) *vim.lsp.start_client()*
• Note: To send an empty dictionary use • Note: To send an empty dictionary use
`{[vim.type_idx]=vim.types.dictionary}`, else `{[vim.type_idx]=vim.types.dictionary}`, else
it will be encoded as an array. it will be encoded as an array.
{handlers} Map of language server method names to {handlers} Map of language server method names to
|lsp-handler| |lsp-handler|
{settings} Map with language server specific settings. These {settings} Map with language server specific settings. These
are returned to the language server if requested are returned to the language server if requested
via `workspace/configuration`. Keys are via `workspace/configuration`. Keys are
case-sensitive. case-sensitive.
{commands} (table) Table that maps string of clientside {commands} (table) Table that maps string of clientside
commands to user-defined functions. Commands commands to user-defined functions. Commands
passed to start_client take precedence over the passed to start_client take precedence over the
global command registry. Each key must be a global command registry. Each key must be a
unique command name, and the value is a function unique command name, and the value is a function
which is called if any LSP action (code action, which is called if any LSP action (code action,
code lenses, ...) triggers the command. code lenses, ...) triggers the command.
{init_options} Values to pass in the initialization request as {init_options} Values to pass in the initialization request as
`initializationOptions`. See `initialize` in the `initializationOptions`. See `initialize` in the
LSP spec. LSP spec.
{name} (string, default=client-id) Name in log messages. {name} (string, default=client-id) Name in log messages.
{get_language_id} function(bufnr, filetype) -> language ID as {get_language_id} function(bufnr, filetype) -> language ID as
string. Defaults to the filetype. string. Defaults to the filetype.
{offset_encoding} (default="utf-16") One of "utf-8", "utf-16", or {offset_encoding} (default="utf-16") One of "utf-8", "utf-16", or
"utf-32" which is the encoding that the LSP "utf-32" which is the encoding that the LSP
server expects. Client does not verify this is server expects. Client does not verify this is
correct. correct.
{on_error} Callback with parameters (code, ...), invoked {on_error} Callback with parameters (code, ...), invoked
when the client operation throws an error. `code` when the client operation throws an error. `code`
is a number describing the error. Other arguments is a number describing the error. Other arguments
may be passed depending on the error kind. See may be passed depending on the error kind. See
`vim.lsp.rpc.client_errors` for possible errors. `vim.lsp.rpc.client_errors` for possible errors.
Use `vim.lsp.rpc.client_errors[code]` to get Use `vim.lsp.rpc.client_errors[code]` to get
human-friendly name. human-friendly name.
{before_init} Callback with parameters (initialize_params, {before_init} Callback with parameters (initialize_params,
config) invoked before the LSP "initialize" config) invoked before the LSP "initialize"
phase, where `params` contains the parameters phase, where `params` contains the parameters
being sent to the server and `config` is the being sent to the server and `config` is the
config that was passed to config that was passed to
|vim.lsp.start_client()|. You can use this to |vim.lsp.start_client()|. You can use this to
modify parameters before they are sent. modify parameters before they are sent.
{on_init} Callback (client, initialize_result) invoked {on_init} Callback (client, initialize_result) invoked
after LSP "initialize", where `result` is a table after LSP "initialize", where `result` is a table
of `capabilities` and anything else the server of `capabilities` and anything else the server
may send. For example, clangd sends may send. For example, clangd sends
@@ -925,19 +925,19 @@ start_client({config}) *vim.lsp.start_client()*
make this assumption. A make this assumption. A
`workspace/didChangeConfiguration` notification `workspace/didChangeConfiguration` notification
should be sent to the server during on_init. should be sent to the server during on_init.
{on_exit} Callback (code, signal, client_id) invoked on {on_exit} Callback (code, signal, client_id) invoked on
client exit. client exit.
• code: exit code of the process • code: exit code of the process
• signal: number describing the signal used to • signal: number describing the signal used to
terminate (if any) terminate (if any)
• client_id: client handle • client_id: client handle
{on_attach} Callback (client, bufnr) invoked when client {on_attach} Callback (client, bufnr) invoked when client
attaches to a buffer. attaches to a buffer.
{trace} "off" | "messages" | "verbose" | nil passed {trace} "off" | "messages" | "verbose" | nil passed
directly to the language server in the initialize directly to the language server in the initialize
request. Invalid/empty values will default to request. Invalid/empty values will default to
"off" "off"
{flags} A table with flags for the client. The current {flags} A table with flags for the client. The current
(experimental) flags are: (experimental) flags are:
• allow_incremental_sync (bool, default true): • allow_incremental_sync (bool, default true):
Allow using incremental sync for buffer edits Allow using incremental sync for buffer edits
@@ -951,7 +951,7 @@ start_client({config}) *vim.lsp.start_client()*
sending kill -15. If set to false, nvim exits sending kill -15. If set to false, nvim exits
immediately after sending the "shutdown" immediately after sending the "shutdown"
request to the server. request to the server.
{root_dir} (string) Directory where the LSP server will base {root_dir} (string) Directory where the LSP server will base
its workspaceFolders, rootUri, and rootPath on its workspaceFolders, rootUri, and rootPath on
initialization. initialization.
@@ -974,8 +974,8 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
for this client, then force-shutdown is attempted. for this client, then force-shutdown is attempted.
Parameters: ~ Parameters: ~
{client_id} client id or |vim.lsp.client| object, or list thereof {client_id} client id or |vim.lsp.client| object, or list thereof
{force} (boolean) (optional) shutdown forcefully {force} (boolean) (optional) shutdown forcefully
tagfunc({...}) *vim.lsp.tagfunc()* tagfunc({...}) *vim.lsp.tagfunc()*
Provides an interface between the built-in client and 'tagfunc'. Provides an interface between the built-in client and 'tagfunc'.
@@ -986,8 +986,8 @@ tagfunc({...}) *vim.lsp.tagfunc()*
LSP servers, falls back to using built-in tags. LSP servers, falls back to using built-in tags.
Parameters: ~ Parameters: ~
{pattern} Pattern used to find a workspace symbol {pattern} Pattern used to find a workspace symbol
{flags} See |tag-function| {flags} See |tag-function|
Return: ~ Return: ~
A list of matching tags A list of matching tags
@@ -996,8 +996,8 @@ with({handler}, {override_config}) *vim.lsp.with()*
Function to manage overriding defaults for LSP handlers. Function to manage overriding defaults for LSP handlers.
Parameters: ~ Parameters: ~
{handler} (function) See |lsp-handler| {handler} (function) See |lsp-handler|
{override_config} (table) Table containing the keys to override {override_config} (table) Table containing the keys to override
behavior of the {handler} behavior of the {handler}
@@ -1016,7 +1016,7 @@ code_action({options}) *vim.lsp.buf.code_action()*
Selects a code action available at the current cursor position. Selects a code action available at the current cursor position.
Parameters: ~ Parameters: ~
{options} (table|nil) Optional table which holds the following {options} (table|nil) Optional table which holds the following
optional fields: optional fields:
• context: (table|nil) Corresponds to `CodeActionContext` of the LSP specification: • context: (table|nil) Corresponds to `CodeActionContext` of the LSP specification:
• diagnostics (table|nil): LSP`Diagnostic[]` . Inferred from the current position if not provided. • diagnostics (table|nil): LSP`Diagnostic[]` . Inferred from the current position if not provided.
@@ -1043,7 +1043,7 @@ completion({context}) *vim.lsp.buf.completion()*
called in Insert mode. called in Insert mode.
Parameters: ~ Parameters: ~
{context} (context support not yet implemented) Additional {context} (context support not yet implemented) Additional
information about the context in which a completion was information about the context in which a completion was
triggered (how it was triggered, and by which trigger triggered (how it was triggered, and by which trigger
character, if applicable) character, if applicable)
@@ -1058,7 +1058,7 @@ declaration({options}) *vim.lsp.buf.declaration()*
|vim.lsp.buf.definition()| instead. |vim.lsp.buf.definition()| instead.
Parameters: ~ Parameters: ~
{options} (table|nil) additional options {options} (table|nil) additional options
• reuse_win: (boolean) Jump to existing window if buffer is • reuse_win: (boolean) Jump to existing window if buffer is
already open. already open.
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
@@ -1068,7 +1068,7 @@ definition({options}) *vim.lsp.buf.definition()*
Jumps to the definition of the symbol under the cursor. Jumps to the definition of the symbol under the cursor.
Parameters: ~ Parameters: ~
{options} (table|nil) additional options {options} (table|nil) additional options
• reuse_win: (boolean) Jump to existing window if buffer is • reuse_win: (boolean) Jump to existing window if buffer is
already open. already open.
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
@@ -1093,7 +1093,7 @@ document_symbol({options}) *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix window. Lists all symbols in the current buffer in the quickfix window.
Parameters: ~ Parameters: ~
{options} (table|nil) additional options {options} (table|nil) additional options
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
|lsp-on-list-handler| |lsp-on-list-handler|
@@ -1101,7 +1101,7 @@ execute_command({command_params}) *vim.lsp.buf.execute_command()*
Executes an LSP server command. Executes an LSP server command.
Parameters: ~ Parameters: ~
{command_params} (table) A valid `ExecuteCommandParams` object {command_params} (table) A valid `ExecuteCommandParams` object
See also: ~ See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
@@ -1111,7 +1111,7 @@ format({options}) *vim.lsp.buf.format()*
server clients. server clients.
Parameters: ~ Parameters: ~
{options} table|nil Optional table which holds the following optional {options} table|nil Optional table which holds the following optional
fields: fields:
• formatting_options (table|nil): Can be used to specify • formatting_options (table|nil): Can be used to specify
FormattingOptions. Some unspecified options will be FormattingOptions. Some unspecified options will be
@@ -1154,7 +1154,7 @@ implementation({options}) *vim.lsp.buf.implementation()*
quickfix window. quickfix window.
Parameters: ~ Parameters: ~
{options} (table|nil) additional options {options} (table|nil) additional options
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
|lsp-on-list-handler| |lsp-on-list-handler|
@@ -1176,8 +1176,8 @@ references({context}, {options}) *vim.lsp.buf.references()*
window. window.
Parameters: ~ Parameters: ~
{context} (table) Context for the request {context} (table) Context for the request
{options} (table|nil) additional options {options} (table|nil) additional options
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
|lsp-on-list-handler| |lsp-on-list-handler|
@@ -1193,9 +1193,9 @@ rename({new_name}, {options}) *vim.lsp.buf.rename()*
Renames all references to the symbol under the cursor. Renames all references to the symbol under the cursor.
Parameters: ~ Parameters: ~
{new_name} (string|nil) If not provided, the user will be prompted {new_name} (string|nil) If not provided, the user will be prompted
for a new name using |vim.ui.input()|. for a new name using |vim.ui.input()|.
{options} (table|nil) additional options {options} (table|nil) additional options
• filter (function|nil): Predicate used to filter clients. • filter (function|nil): Predicate used to filter clients.
Receives a client as argument and must return a boolean. Receives a client as argument and must return a boolean.
Clients matching the predicate are included. Clients matching the predicate are included.
@@ -1217,7 +1217,7 @@ type_definition({options}) *vim.lsp.buf.type_definition()*
Jumps to the definition of the type of the symbol under the cursor. Jumps to the definition of the type of the symbol under the cursor.
Parameters: ~ Parameters: ~
{options} (table|nil) additional options {options} (table|nil) additional options
• reuse_win: (boolean) Jump to existing window if buffer is • reuse_win: (boolean) Jump to existing window if buffer is
already open. already open.
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
@@ -1231,8 +1231,8 @@ workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()*
string means no filtering is done. string means no filtering is done.
Parameters: ~ Parameters: ~
{query} (string, optional) {query} (string, optional)
{options} (table|nil) additional options {options} (table|nil) additional options
• on_list: (function) handler for list results. See • on_list: (function) handler for list results. See
|lsp-on-list-handler| |lsp-on-list-handler|
@@ -1245,7 +1245,7 @@ get_namespace({client_id}) *vim.lsp.diagnostic.get_namespace()*
|vim.diagnostic|. |vim.diagnostic|.
Parameters: ~ Parameters: ~
{client_id} (number) The id of the LSP client {client_id} (number) The id of the LSP client
*vim.lsp.diagnostic.on_publish_diagnostics()* *vim.lsp.diagnostic.on_publish_diagnostics()*
on_publish_diagnostics({_}, {result}, {ctx}, {config}) on_publish_diagnostics({_}, {result}, {ctx}, {config})
@@ -1274,7 +1274,7 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config})
< <
Parameters: ~ Parameters: ~
{config} (table) Configuration table (see |vim.diagnostic.config()|). {config} (table) Configuration table (see |vim.diagnostic.config()|).
============================================================================== ==============================================================================
@@ -1284,15 +1284,15 @@ display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()*
Display the lenses using virtual text Display the lenses using virtual text
Parameters: ~ Parameters: ~
{lenses} (table) of lenses to display (`CodeLens[] | null`) {lenses} (table) of lenses to display (`CodeLens[] | null`)
{bufnr} (number) {bufnr} (number)
{client_id} (number) {client_id} (number)
get({bufnr}) *vim.lsp.codelens.get()* get({bufnr}) *vim.lsp.codelens.get()*
Return all lenses for the given buffer Return all lenses for the given buffer
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer number. 0 can be used for the current buffer. {bufnr} (number) Buffer number. 0 can be used for the current buffer.
Return: ~ Return: ~
(table) (`CodeLens[]`) (table) (`CodeLens[]`)
@@ -1316,9 +1316,9 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
Store lenses for a specific buffer and client Store lenses for a specific buffer and client
Parameters: ~ Parameters: ~
{lenses} (table) of lenses to store (`CodeLens[] | null`) {lenses} (table) of lenses to store (`CodeLens[] | null`)
{bufnr} (number) {bufnr} (number)
{client_id} (number) {client_id} (number)
============================================================================== ==============================================================================
@@ -1336,7 +1336,7 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
< <
Parameters: ~ Parameters: ~
{config} (table) Configuration table. {config} (table) Configuration table.
• border: (default=nil) • border: (default=nil)
• Add borders to the floating window • Add borders to the floating window
• See |nvim_open_win()| • See |nvim_open_win()|
@@ -1355,7 +1355,7 @@ signature_help({_}, {result}, {ctx}, {config})
< <
Parameters: ~ Parameters: ~
{config} (table) Configuration table. {config} (table) Configuration table.
• border: (default=nil) • border: (default=nil)
• Add borders to the floating window • Add borders to the floating window
• See |nvim_open_win()| • See |nvim_open_win()|
@@ -1370,8 +1370,8 @@ apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
document. document.
Parameters: ~ Parameters: ~
{text_document_edit} table: a `TextDocumentEdit` object {text_document_edit} table: a `TextDocumentEdit` object
{index} number: Optional index of the edit, if from a {index} number: Optional index of the edit, if from a
list of edits (or nil, if not from a list) list of edits (or nil, if not from a list)
See also: ~ See also: ~
@@ -1382,9 +1382,9 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Applies a list of text edits to a buffer. Applies a list of text edits to a buffer.
Parameters: ~ Parameters: ~
{text_edits} (table) list of `TextEdit` objects {text_edits} (table) list of `TextEdit` objects
{bufnr} (number) Buffer id {bufnr} (number) Buffer id
{offset_encoding} (string) utf-8|utf-16|utf-32 {offset_encoding} (string) utf-8|utf-16|utf-32
See also: ~ See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
@@ -1394,24 +1394,24 @@ apply_workspace_edit({workspace_edit}, {offset_encoding})
Applies a `WorkspaceEdit`. Applies a `WorkspaceEdit`.
Parameters: ~ Parameters: ~
{workspace_edit} (table) `WorkspaceEdit` {workspace_edit} (table) `WorkspaceEdit`
{offset_encoding} (string) utf-8|utf-16|utf-32 (required) {offset_encoding} (string) utf-8|utf-16|utf-32 (required)
buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()* buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer. Removes document highlights from a buffer.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer id {bufnr} (number) Buffer id
*vim.lsp.util.buf_highlight_references()* *vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {offset_encoding}) buf_highlight_references({bufnr}, {references}, {offset_encoding})
Shows a list of document highlights for a certain buffer. Shows a list of document highlights for a certain buffer.
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer id {bufnr} (number) Buffer id
{references} (table) List of `DocumentHighlight` objects to {references} (table) List of `DocumentHighlight` objects to
highlight highlight
{offset_encoding} (string) One of "utf-8", "utf-16", "utf-32". {offset_encoding} (string) One of "utf-8", "utf-16", "utf-32".
See also: ~ See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight
@@ -1421,10 +1421,10 @@ character_offset({buf}, {row}, {col}, {offset_encoding})
Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer. Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.
Parameters: ~ Parameters: ~
{buf} (number) buffer number (0 for current) {buf} (number) buffer number (0 for current)
{row} 0-indexed line {row} 0-indexed line
{col} 0-indexed byte offset in line {col} 0-indexed byte offset in line
{offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to {offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to
`offset_encoding` of first client of `buf` `offset_encoding` of first client of `buf`
Return: ~ Return: ~
@@ -1439,8 +1439,8 @@ convert_input_to_markdown_lines({input}, {contents})
`textDocument/signatureHelp`, and potentially others. `textDocument/signatureHelp`, and potentially others.
Parameters: ~ Parameters: ~
{input} (`MarkedString` | `MarkedString[]` | `MarkupContent`) {input} (`MarkedString` | `MarkedString[]` | `MarkupContent`)
{contents} (table, optional, default `{}`) List of strings to extend {contents} (table, optional, default `{}`) List of strings to extend
with converted lines with converted lines
Return: ~ Return: ~
@@ -1454,10 +1454,10 @@ convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers})
Converts `textDocument/SignatureHelp` response to markdown lines. Converts `textDocument/SignatureHelp` response to markdown lines.
Parameters: ~ Parameters: ~
{signature_help} Response of `textDocument/SignatureHelp` {signature_help} Response of `textDocument/SignatureHelp`
{ft} optional filetype that will be use as the `lang` for {ft} optional filetype that will be use as the `lang` for
the label markdown code block the label markdown code block
{triggers} optional list of trigger characters from the lsp {triggers} optional list of trigger characters from the lsp
server. used to better determine parameter offsets server. used to better determine parameter offsets
Return: ~ Return: ~
@@ -1471,7 +1471,7 @@ extract_completion_items({result})
Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null. Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null.
Parameters: ~ Parameters: ~
{result} (table) The result of a `textDocument/completion` request {result} (table) The result of a `textDocument/completion` request
Return: ~ Return: ~
(table) List of completion items (table) List of completion items
@@ -1483,7 +1483,7 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
Returns indentation size. Returns indentation size.
Parameters: ~ Parameters: ~
{bufnr} (number|nil): Buffer handle, defaults to current {bufnr} (number|nil): Buffer handle, defaults to current
Return: ~ Return: ~
(number) indentation size (number) indentation size
@@ -1496,9 +1496,9 @@ jump_to_location({location}, {offset_encoding}, {reuse_win})
Jumps to a location. Jumps to a location.
Parameters: ~ Parameters: ~
{location} (table) (`Location`|`LocationLink`) {location} (table) (`Location`|`LocationLink`)
{offset_encoding} (string) utf-8|utf-16|utf-32 (required) {offset_encoding} (string) utf-8|utf-16|utf-32 (required)
{reuse_win} (boolean) Jump to existing window if buffer is {reuse_win} (boolean) Jump to existing window if buffer is
already opened. already opened.
Return: ~ Return: ~
@@ -1513,8 +1513,8 @@ locations_to_items({locations}, {offset_encoding})
|setloclist()|. |setloclist()|.
Parameters: ~ Parameters: ~
{locations} (table) list of `Location`s or `LocationLink`s {locations} (table) list of `Location`s or `LocationLink`s
{offset_encoding} (string) offset_encoding for locations {offset_encoding} (string) offset_encoding for locations
utf-8|utf-16|utf-32 utf-8|utf-16|utf-32
Return: ~ Return: ~
@@ -1524,8 +1524,8 @@ lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()*
Helper function to return nested values in language server settings Helper function to return nested values in language server settings
Parameters: ~ Parameters: ~
{settings} a table of language server settings {settings} a table of language server settings
{section} a string indicating the field of the settings table {section} a string indicating the field of the settings table
Return: ~ Return: ~
(table or string) The value of settings accessed via section (table or string) The value of settings accessed via section
@@ -1536,9 +1536,9 @@ make_floating_popup_options({width}, {height}, {opts})
table can be passed to |nvim_open_win()|. table can be passed to |nvim_open_win()|.
Parameters: ~ Parameters: ~
{width} (number) window width (in character cells) {width} (number) window width (in character cells)
{height} (number) window height (in character cells) {height} (number) window height (in character cells)
{opts} (table, optional) {opts} (table, optional)
• offset_x (number) offset to add to `col` • offset_x (number) offset to add to `col`
• offset_y (number) offset to add to `row` • offset_y (number) offset to add to `row`
• border (string or table) override `border` • border (string or table) override `border`
@@ -1554,7 +1554,7 @@ make_formatting_params({options})
cursor position. cursor position.
Parameters: ~ Parameters: ~
{options} (table|nil) with valid `FormattingOptions` entries {options} (table|nil) with valid `FormattingOptions` entries
Return: ~ Return: ~
`DocumentFormattingParams` object `DocumentFormattingParams` object
@@ -1568,13 +1568,13 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
similar to |vim.lsp.util.make_range_params()|. similar to |vim.lsp.util.make_range_params()|.
Parameters: ~ Parameters: ~
{start_pos} number[]|nil {row, col} mark-indexed position. {start_pos} number[]|nil {row, col} mark-indexed position.
Defaults to the start of the last visual selection. Defaults to the start of the last visual selection.
{end_pos} number[]|nil {row, col} mark-indexed position. {end_pos} number[]|nil {row, col} mark-indexed position.
Defaults to the end of the last visual selection. Defaults to the end of the last visual selection.
{bufnr} (number|nil) buffer handle or 0 for current, {bufnr} (number|nil) buffer handle or 0 for current,
defaults to current defaults to current
{offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to
`offset_encoding` of first client of `bufnr` `offset_encoding` of first client of `bufnr`
Return: ~ Return: ~
@@ -1587,9 +1587,9 @@ make_position_params({window}, {offset_encoding})
cursor position. cursor position.
Parameters: ~ Parameters: ~
{window} number|nil: window handle or 0 for current, {window} number|nil: window handle or 0 for current,
defaults to current defaults to current
{offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to {offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to
`offset_encoding` of first client of buffer of `offset_encoding` of first client of buffer of
`window` `window`
@@ -1607,9 +1607,9 @@ make_range_params({window}, {offset_encoding})
`textDocument/rangeFormatting`. `textDocument/rangeFormatting`.
Parameters: ~ Parameters: ~
{window} number|nil: window handle or 0 for current, {window} number|nil: window handle or 0 for current,
defaults to current defaults to current
{offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to
`offset_encoding` of first client of buffer of `offset_encoding` of first client of buffer of
`window` `window`
@@ -1622,7 +1622,7 @@ make_text_document_params({bufnr})
Creates a `TextDocumentIdentifier` object for the current buffer. Creates a `TextDocumentIdentifier` object for the current buffer.
Parameters: ~ Parameters: ~
{bufnr} number|nil: Buffer handle, defaults to current {bufnr} number|nil: Buffer handle, defaults to current
Return: ~ Return: ~
`TextDocumentIdentifier` `TextDocumentIdentifier`
@@ -1635,17 +1635,17 @@ make_workspace_params({added}, {removed})
Create the workspace params Create the workspace params
Parameters: ~ Parameters: ~
{added} {added}
{removed} {removed}
*vim.lsp.util.open_floating_preview()* *vim.lsp.util.open_floating_preview()*
open_floating_preview({contents}, {syntax}, {opts}) open_floating_preview({contents}, {syntax}, {opts})
Shows contents in a floating window. Shows contents in a floating window.
Parameters: ~ Parameters: ~
{contents} (table) of lines to show in window {contents} (table) of lines to show in window
{syntax} (string) of syntax to set for opened buffer {syntax} (string) of syntax to set for opened buffer
{opts} (table) with optional fields (additional keys are passed {opts} (table) with optional fields (additional keys are passed
on to |nvim_open_win()|) on to |nvim_open_win()|)
• height: (number) height of floating window • height: (number) height of floating window
• width: (number) width of floating window • width: (number) width of floating window
@@ -1674,7 +1674,7 @@ parse_snippet({input}) *vim.lsp.util.parse_snippet()*
Parses snippets in a completion entry. Parses snippets in a completion entry.
Parameters: ~ Parameters: ~
{input} (string) unparsed snippet {input} (string) unparsed snippet
Return: ~ Return: ~
(string) parsed snippet (string) parsed snippet
@@ -1688,7 +1688,7 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
definition) definition)
Parameters: ~ Parameters: ~
{location} a single `Location` or `LocationLink` {location} a single `Location` or `LocationLink`
Return: ~ Return: ~
(bufnr,winnr) buffer and window number of floating window or nil (bufnr,winnr) buffer and window number of floating window or nil
@@ -1697,7 +1697,7 @@ rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()*
Rename old_fname to new_fname Rename old_fname to new_fname
Parameters: ~ Parameters: ~
{opts} (table) {opts} (table)
set_lines({lines}, {A}, {B}, {new_lines}) *vim.lsp.util.set_lines()* set_lines({lines}, {A}, {B}, {new_lines}) *vim.lsp.util.set_lines()*
Replaces text in a range with new text. Replaces text in a range with new text.
@@ -1705,10 +1705,10 @@ set_lines({lines}, {A}, {B}, {new_lines}) *vim.lsp.util.set_lines()*
CAUTION: Changes in-place! CAUTION: Changes in-place!
Parameters: ~ Parameters: ~
{lines} (table) Original list of strings {lines} (table) Original list of strings
{A} (table) Start position; a 2-tuple of {line, col} numbers {A} (table) Start position; a 2-tuple of {line, col} numbers
{B} (table) End position; a 2-tuple of {line, col} numbers {B} (table) End position; a 2-tuple of {line, col} numbers
{new_lines} A list of strings to replace the original {new_lines} A list of strings to replace the original
Return: ~ Return: ~
(table) The modified {lines} object (table) The modified {lines} object
@@ -1726,8 +1726,8 @@ stylize_markdown({bufnr}, {contents}, {opts})
`open_floating_preview` instead `open_floating_preview` instead
Parameters: ~ Parameters: ~
{contents} (table) of lines to show in window {contents} (table) of lines to show in window
{opts} dictionary with optional fields {opts} dictionary with optional fields
• height of floating window • height of floating window
• width of floating window • width of floating window
• wrap_at character to wrap at for computing height • wrap_at character to wrap at for computing height
@@ -1744,7 +1744,7 @@ symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()*
Converts symbols to quickfix list items. Converts symbols to quickfix list items.
Parameters: ~ Parameters: ~
{symbols} DocumentSymbol[] or SymbolInformation[] {symbols} DocumentSymbol[] or SymbolInformation[]
*vim.lsp.util.text_document_completion_list_to_complete_items()* *vim.lsp.util.text_document_completion_list_to_complete_items()*
text_document_completion_list_to_complete_items({result}, {prefix}) text_document_completion_list_to_complete_items({result}, {prefix})
@@ -1752,10 +1752,10 @@ text_document_completion_list_to_complete_items({result}, {prefix})
vim-compatible |complete-items|. vim-compatible |complete-items|.
Parameters: ~ Parameters: ~
{result} The result of a `textDocument/completion` call, e.g. from {result} The result of a `textDocument/completion` call, e.g. from
|vim.lsp.buf.completion()|, which may be one of |vim.lsp.buf.completion()|, which may be one of
`CompletionItem[]`, `CompletionList` or `null` `CompletionItem[]`, `CompletionList` or `null`
{prefix} (string) the prefix to filter the completion items {prefix} (string) the prefix to filter the completion items
Return: ~ Return: ~
{ matches = complete-items table, incomplete = bool } { matches = complete-items table, incomplete = bool }
@@ -1767,7 +1767,7 @@ trim_empty_lines({lines}) *vim.lsp.util.trim_empty_lines()*
Removes empty lines from the beginning and end. Removes empty lines from the beginning and end.
Parameters: ~ Parameters: ~
{lines} (table) list of lines to trim {lines} (table) list of lines to trim
Return: ~ Return: ~
(table) trimmed list of lines (table) trimmed list of lines
@@ -1780,7 +1780,7 @@ try_trim_markdown_code_blocks({lines})
CAUTION: Modifies the input in-place! CAUTION: Modifies the input in-place!
Parameters: ~ Parameters: ~
{lines} (table) list of lines {lines} (table) list of lines
Return: ~ Return: ~
(string) filetype or "markdown" if it was unchanged. (string) filetype or "markdown" if it was unchanged.
@@ -1805,20 +1805,20 @@ set_format_func({handle}) *vim.lsp.log.set_format_func()*
Sets formatting function used to format logs Sets formatting function used to format logs
Parameters: ~ Parameters: ~
{handle} (function) function to apply to logging arguments, pass {handle} (function) function to apply to logging arguments, pass
vim.inspect for multi-line formatting vim.inspect for multi-line formatting
set_level({level}) *vim.lsp.log.set_level()* set_level({level}) *vim.lsp.log.set_level()*
Sets the current log level. Sets the current log level.
Parameters: ~ Parameters: ~
{level} (string or number) One of `vim.lsp.log.levels` {level} (string or number) One of `vim.lsp.log.levels`
should_log({level}) *vim.lsp.log.should_log()* should_log({level}) *vim.lsp.log.should_log()*
Checks whether the level is sufficient for logging. Checks whether the level is sufficient for logging.
Parameters: ~ Parameters: ~
{level} (number) log level {level} (number) log level
Return: ~ Return: ~
(bool) true if would log, false if not (bool) true if would log, false if not
@@ -1832,8 +1832,8 @@ connect({host}, {port}) *vim.lsp.rpc.connect()*
and port and port
Parameters: ~ Parameters: ~
{host} (string) {host} (string)
{port} (number) {port} (number)
Return: ~ Return: ~
(function) (function)
@@ -1842,7 +1842,7 @@ format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()*
Constructs an error message from an LSP error object. Constructs an error message from an LSP error object.
Parameters: ~ Parameters: ~
{err} (table) The error object {err} (table) The error object
Return: ~ Return: ~
(string) The formatted error message (string) The formatted error message
@@ -1851,8 +1851,8 @@ notify({method}, {params}) *vim.lsp.rpc.notify()*
Sends a notification to the LSP server. Sends a notification to the LSP server.
Parameters: ~ Parameters: ~
{method} (string) The invoked LSP method {method} (string) The invoked LSP method
{params} (table|nil): Parameters for the invoked LSP method {params} (table|nil): Parameters for the invoked LSP method
Return: ~ Return: ~
(bool) `true` if notification could be sent, `false` if not (bool) `true` if notification could be sent, `false` if not
@@ -1862,11 +1862,11 @@ request({method}, {params}, {callback}, {notify_reply_callback})
Sends a request to the LSP server and runs {callback} upon response. Sends a request to the LSP server and runs {callback} upon response.
Parameters: ~ Parameters: ~
{method} (string) The invoked LSP method {method} (string) The invoked LSP method
{params} (table|nil) Parameters for the invoked LSP {params} (table|nil) Parameters for the invoked LSP
method method
{callback} (function) Callback to invoke {callback} (function) Callback to invoke
{notify_reply_callback} (function|nil) Callback to invoke as soon as {notify_reply_callback} (function|nil) Callback to invoke as soon as
a request is no longer pending a request is no longer pending
Return: ~ Return: ~
@@ -1878,10 +1878,10 @@ rpc_response_error({code}, {message}, {data})
Creates an RPC response object/table. Creates an RPC response object/table.
Parameters: ~ Parameters: ~
{code} (number) RPC error code defined in {code} (number) RPC error code defined in
`vim.lsp.protocol.ErrorCodes` `vim.lsp.protocol.ErrorCodes`
{message} (string|nil) arbitrary message to send to server {message} (string|nil) arbitrary message to send to server
{data} any|nil arbitrary data to send to server {data} any|nil arbitrary data to send to server
*vim.lsp.rpc.start()* *vim.lsp.rpc.start()*
start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params}) start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
@@ -1891,16 +1891,16 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
|vim.lsp.rpc.connect()| |vim.lsp.rpc.connect()|
Parameters: ~ Parameters: ~
{cmd} (string) Command to start the LSP server. {cmd} (string) Command to start the LSP server.
{cmd_args} (table) List of additional string arguments to {cmd_args} (table) List of additional string arguments to
pass to {cmd}. pass to {cmd}.
{dispatchers} (table|nil) Dispatchers for LSP message types. {dispatchers} (table|nil) Dispatchers for LSP message types.
Valid dispatcher names are: Valid dispatcher names are:
• `"notification"` • `"notification"`
• `"server_request"` • `"server_request"`
• `"on_error"` • `"on_error"`
• `"on_exit"` • `"on_exit"`
{extra_spawn_params} (table|nil) Additional context for the LSP {extra_spawn_params} (table|nil) Additional context for the LSP
server process. May contain: server process. May contain:
• {cwd} (string) Working directory for the LSP • {cwd} (string) Working directory for the LSP
server process server process
@@ -1924,14 +1924,14 @@ compute_diff({___MissingCloseParenHere___})
Returns the range table for the difference between prev and curr lines Returns the range table for the difference between prev and curr lines
Parameters: ~ Parameters: ~
{prev_lines} (table) list of lines {prev_lines} (table) list of lines
{curr_lines} (table) list of lines {curr_lines} (table) list of lines
{firstline} (number) line to begin search for first difference {firstline} (number) line to begin search for first difference
{lastline} (number) line to begin search in old_lines for last {lastline} (number) line to begin search in old_lines for last
difference difference
{new_lastline} (number) line to begin search in new_lines for last {new_lastline} (number) line to begin search in new_lines for last
difference difference
{offset_encoding} (string) encoding requested by language server {offset_encoding} (string) encoding requested by language server
Return: ~ Return: ~
(table) TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent (table) TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent
@@ -1950,7 +1950,7 @@ resolve_capabilities({server_capabilities})
Creates a normalized object describing LSP server capabilities. Creates a normalized object describing LSP server capabilities.
Parameters: ~ Parameters: ~
{server_capabilities} (table) Table of capabilities supported by the {server_capabilities} (table) Table of capabilities supported by the
server server
Return: ~ Return: ~

View File

@@ -1395,7 +1395,7 @@ cmd({command}) *vim.cmd()*
< <
Parameters: ~ Parameters: ~
{command} string|table Command(s) to execute. If a string, executes {command} string|table Command(s) to execute. If a string, executes
multiple lines of Vim script at once. In this case, it is multiple lines of Vim script at once. In this case, it is
an alias to |nvim_exec()|, where `output` is set to false. an alias to |nvim_exec()|, where `output` is set to false.
Thus it works identical to |:source|. If a table, executes Thus it works identical to |:source|. If a table, executes
@@ -1416,8 +1416,8 @@ defer_fn({fn}, {timeout}) *vim.defer_fn()*
are safe to call. are safe to call.
Parameters: ~ Parameters: ~
{fn} Callback to call once `timeout` expires {fn} Callback to call once `timeout` expires
{timeout} Number of milliseconds to wait before calling `fn` {timeout} Number of milliseconds to wait before calling `fn`
Return: ~ Return: ~
timer luv timer object timer luv timer object
@@ -1427,13 +1427,13 @@ deprecate({name}, {alternative}, {version}, {plugin}, {backtrace})
Display a deprecation notification to the user. Display a deprecation notification to the user.
Parameters: ~ Parameters: ~
{name} string Deprecated function. {name} string Deprecated function.
{alternative} (string|nil) Preferred alternative function. {alternative} (string|nil) Preferred alternative function.
{version} string Version in which the deprecated function will be {version} string Version in which the deprecated function will be
removed. removed.
{plugin} string|nil Plugin name that the function will be {plugin} string|nil Plugin name that the function will be
removed from. Defaults to "Nvim". removed from. Defaults to "Nvim".
{backtrace} boolean|nil Prints backtrace. Defaults to true. {backtrace} boolean|nil Prints backtrace. Defaults to true.
inspect({object}, {options}) *vim.inspect()* inspect({object}, {options}) *vim.inspect()*
Return a human-readable representation of the given object. Return a human-readable representation of the given object.
@@ -1450,9 +1450,9 @@ notify({msg}, {level}, {opts}) *vim.notify()*
writes to |:messages|. writes to |:messages|.
Parameters: ~ Parameters: ~
{msg} (string) Content of the notification to show to the user. {msg} (string) Content of the notification to show to the user.
{level} (number|nil) One of the values from |vim.log.levels|. {level} (number|nil) One of the values from |vim.log.levels|.
{opts} (table|nil) Optional parameters. Unused by default. {opts} (table|nil) Optional parameters. Unused by default.
notify_once({msg}, {level}, {opts}) *vim.notify_once()* notify_once({msg}, {level}, {opts}) *vim.notify_once()*
Display a notification only one time. Display a notification only one time.
@@ -1461,9 +1461,9 @@ notify_once({msg}, {level}, {opts}) *vim.notify_once()*
display a notification. display a notification.
Parameters: ~ Parameters: ~
{msg} (string) Content of the notification to show to the user. {msg} (string) Content of the notification to show to the user.
{level} (number|nil) One of the values from |vim.log.levels|. {level} (number|nil) One of the values from |vim.log.levels|.
{opts} (table|nil) Optional parameters. Unused by default. {opts} (table|nil) Optional parameters. Unused by default.
Return: ~ Return: ~
(boolean) true if message was displayed, else false (boolean) true if message was displayed, else false
@@ -1482,11 +1482,11 @@ on_key({fn}, {ns_id}) *vim.on_key()*
{fn} will receive the keys after mappings have been evaluated {fn} will receive the keys after mappings have been evaluated
Parameters: ~ Parameters: ~
{fn} function: Callback function. It should take one string {fn} function: Callback function. It should take one string
argument. On each key press, Nvim passes the key char to argument. On each key press, Nvim passes the key char to
fn(). |i_CTRL-V| If {fn} is nil, it removes the callback for fn(). |i_CTRL-V| If {fn} is nil, it removes the callback for
the associated {ns_id} the associated {ns_id}
{ns_id} number? Namespace ID. If nil or 0, generates and returns a {ns_id} number? Namespace ID. If nil or 0, generates and returns a
new |nvim_create_namespace()| id. new |nvim_create_namespace()| id.
Return: ~ Return: ~
@@ -1514,8 +1514,8 @@ paste({lines}, {phase}) *vim.paste()*
< <
Parameters: ~ Parameters: ~
{lines} |readfile()|-style list of lines to paste. |channel-lines| {lines} |readfile()|-style list of lines to paste. |channel-lines|
{phase} -1: "non-streaming" paste: the call contains all lines. If {phase} -1: "non-streaming" paste: the call contains all lines. If
paste is "streamed", `phase` indicates the stream state: paste is "streamed", `phase` indicates the stream state:
• 1: starts the paste (exactly once) • 1: starts the paste (exactly once)
• 2: continues the paste (zero or more times) • 2: continues the paste (zero or more times)
@@ -1544,11 +1544,11 @@ region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
points points
Parameters: ~ Parameters: ~
{bufnr} (number) of buffer {bufnr} (number) of buffer
{pos1} (line, column) tuple marking beginning of region {pos1} (line, column) tuple marking beginning of region
{pos2} (line, column) tuple marking end of region {pos2} (line, column) tuple marking end of region
{regtype} type of selection, see |setreg()| {regtype} type of selection, see |setreg()|
{inclusive} (boolean) indicating whether the selection is {inclusive} (boolean) indicating whether the selection is
end-inclusive end-inclusive
Return: ~ Return: ~
@@ -1571,8 +1571,8 @@ deep_equal({a}, {b}) *vim.deep_equal()*
Tables are compared recursively unless they both provide the `eq` metamethod. All other types are compared using the equality `==` operator. Tables are compared recursively unless they both provide the `eq` metamethod. All other types are compared using the equality `==` operator.
Parameters: ~ Parameters: ~
{a} any First value {a} any First value
{b} any Second value {b} any Second value
Return: ~ Return: ~
(boolean) `true` if values are equals, else `false` (boolean) `true` if values are equals, else `false`
@@ -1585,7 +1585,7 @@ deepcopy({orig}) *vim.deepcopy()*
not copied and will throw an error. not copied and will throw an error.
Parameters: ~ Parameters: ~
{orig} (table) Table to copy {orig} (table) Table to copy
Return: ~ Return: ~
(table) Table of copied keys and (nested) values. (table) Table of copied keys and (nested) values.
@@ -1606,7 +1606,7 @@ defaulttable({create}) *vim.defaulttable()*
< <
Parameters: ~ Parameters: ~
{create} (function|nil) The function called to create a missing {create} (function|nil) The function called to create a missing
value. value.
Return: ~ Return: ~
@@ -1616,8 +1616,8 @@ endswith({s}, {suffix}) *vim.endswith()*
Tests if `s` ends with `suffix`. Tests if `s` ends with `suffix`.
Parameters: ~ Parameters: ~
{s} (string) String {s} (string) String
{suffix} (string) Suffix to match {suffix} (string) Suffix to match
Return: ~ Return: ~
(boolean) `true` if `suffix` is a suffix of `s` (boolean) `true` if `suffix` is a suffix of `s`
@@ -1626,9 +1626,9 @@ gsplit({s}, {sep}, {plain}) *vim.gsplit()*
Splits a string at each instance of a separator. Splits a string at each instance of a separator.
Parameters: ~ Parameters: ~
{s} (string) String to split {s} (string) String to split
{sep} (string) Separator or pattern {sep} (string) Separator or pattern
{plain} (boolean) If `true` use `sep` literally (passed to {plain} (boolean) If `true` use `sep` literally (passed to
string.find) string.find)
Return: ~ Return: ~
@@ -1643,7 +1643,7 @@ is_callable({f}) *vim.is_callable()*
Returns true if object `f` can be called as a function. Returns true if object `f` can be called as a function.
Parameters: ~ Parameters: ~
{f} any Any object {f} any Any object
Return: ~ Return: ~
(boolean) `true` if `f` is callable, else `false` (boolean) `true` if `f` is callable, else `false`
@@ -1654,10 +1654,10 @@ list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
NOTE: This mutates dst! NOTE: This mutates dst!
Parameters: ~ Parameters: ~
{dst} (table) List which will be modified and appended to {dst} (table) List which will be modified and appended to
{src} (table) List from which values will be inserted {src} (table) List from which values will be inserted
{start} (number) Start index on src. Defaults to 1 {start} (number) Start index on src. Defaults to 1
{finish} (number) Final index on src. Defaults to `#src` {finish} (number) Final index on src. Defaults to `#src`
Return: ~ Return: ~
(table) dst (table) dst
@@ -1670,9 +1670,9 @@ list_slice({list}, {start}, {finish}) *vim.list_slice()*
(inclusive) (inclusive)
Parameters: ~ Parameters: ~
{list} (table) Table {list} (table) Table
{start} (number) Start range of slice {start} (number) Start range of slice
{finish} (number) End range of slice {finish} (number) End range of slice
Return: ~ Return: ~
(table) Copy of table sliced from start to finish (inclusive) (table) Copy of table sliced from start to finish (inclusive)
@@ -1681,7 +1681,7 @@ pesc({s}) *vim.pesc()*
Escapes magic chars in |lua-patterns|. Escapes magic chars in |lua-patterns|.
Parameters: ~ Parameters: ~
{s} (string) String to escape {s} (string) String to escape
Return: ~ Return: ~
(string) %-escaped pattern string (string) %-escaped pattern string
@@ -1701,9 +1701,9 @@ split({s}, {sep}, {kwargs}) *vim.split()*
< <
Parameters: ~ Parameters: ~
{s} (string) String to split {s} (string) String to split
{sep} (string) Separator or pattern {sep} (string) Separator or pattern
{kwargs} (table) Keyword arguments: {kwargs} (table) Keyword arguments:
• plain: (boolean) If `true` use `sep` literally (passed to • plain: (boolean) If `true` use `sep` literally (passed to
string.find) string.find)
• trimempty: (boolean) If `true` remove empty items from the • trimempty: (boolean) If `true` remove empty items from the
@@ -1719,8 +1719,8 @@ startswith({s}, {prefix}) *vim.startswith()*
Tests if `s` starts with `prefix`. Tests if `s` starts with `prefix`.
Parameters: ~ Parameters: ~
{s} (string) String {s} (string) String
{prefix} (string) Prefix to match {prefix} (string) Prefix to match
Return: ~ Return: ~
(boolean) `true` if `prefix` is a prefix of `s` (boolean) `true` if `prefix` is a prefix of `s`
@@ -1732,7 +1732,7 @@ tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
Note that this modifies the input. Note that this modifies the input.
Parameters: ~ Parameters: ~
{o} (table) Table to add the reverse to {o} (table) Table to add the reverse to
Return: ~ Return: ~
(table) o (table) o
@@ -1741,8 +1741,8 @@ tbl_contains({t}, {value}) *vim.tbl_contains()*
Checks if a list-like (vector) table contains `value`. Checks if a list-like (vector) table contains `value`.
Parameters: ~ Parameters: ~
{t} (table) Table to check {t} (table) Table to check
{value} any Value to compare {value} any Value to compare
Return: ~ Return: ~
(boolean) `true` if `t` contains `value` (boolean) `true` if `t` contains `value`
@@ -1756,7 +1756,7 @@ tbl_count({t}) *vim.tbl_count()*
< <
Parameters: ~ Parameters: ~
{t} (table) Table {t} (table) Table
Return: ~ Return: ~
(number) Number of non-nil values in table (number) Number of non-nil values in table
@@ -1768,12 +1768,12 @@ tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more map-like tables. Merges recursively two or more map-like tables.
Parameters: ~ Parameters: ~
{behavior} (string) Decides what to do if a key is found in more than {behavior} (string) Decides what to do if a key is found in more than
one map: one map:
• "error": raise an error • "error": raise an error
• "keep": use value from the leftmost map • "keep": use value from the leftmost map
• "force": use value from the rightmost map • "force": use value from the rightmost map
{...} (table) Two or more map-like tables {...} (table) Two or more map-like tables
Return: ~ Return: ~
(table) Merged table (table) Merged table
@@ -1785,12 +1785,12 @@ tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more map-like tables. Merges two or more map-like tables.
Parameters: ~ Parameters: ~
{behavior} (string) Decides what to do if a key is found in more than {behavior} (string) Decides what to do if a key is found in more than
one map: one map:
• "error": raise an error • "error": raise an error
• "keep": use value from the leftmost map • "keep": use value from the leftmost map
• "force": use value from the rightmost map • "force": use value from the rightmost map
{...} (table) Two or more map-like tables {...} (table) Two or more map-like tables
Return: ~ Return: ~
(table) Merged table (table) Merged table
@@ -1802,8 +1802,8 @@ tbl_filter({func}, {t}) *vim.tbl_filter()*
Filter a table using a predicate function Filter a table using a predicate function
Parameters: ~ Parameters: ~
{func} function|table Function or callable table {func} function|table Function or callable table
{t} (table) Table {t} (table) Table
Return: ~ Return: ~
(table) Table of filtered values (table) Table of filtered values
@@ -1813,7 +1813,7 @@ tbl_flatten({t}) *vim.tbl_flatten()*
"unrolled" and appended to the result. "unrolled" and appended to the result.
Parameters: ~ Parameters: ~
{t} (table) List-like table {t} (table) List-like table
Return: ~ Return: ~
(table) Flattened copy of the given list-like table (table) Flattened copy of the given list-like table
@@ -1832,8 +1832,8 @@ tbl_get({o}, {...}) *vim.tbl_get()*
< <
Parameters: ~ Parameters: ~
{o} (table) Table to index {o} (table) Table to index
{...} (string) Optional strings (0 or more, variadic) via which to {...} (string) Optional strings (0 or more, variadic) via which to
index the table index the table
Return: ~ Return: ~
@@ -1843,7 +1843,7 @@ tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty. Checks if a table is empty.
Parameters: ~ Parameters: ~
{t} (table) Table to check {t} (table) Table to check
Return: ~ Return: ~
(boolean) `true` if `t` is empty (boolean) `true` if `t` is empty
@@ -1859,7 +1859,7 @@ tbl_islist({t}) *vim.tbl_islist()*
for example from |rpcrequest()| or |vim.fn|. for example from |rpcrequest()| or |vim.fn|.
Parameters: ~ Parameters: ~
{t} (table) Table {t} (table) Table
Return: ~ Return: ~
(boolean) `true` if array-like table, else `false` (boolean) `true` if array-like table, else `false`
@@ -1869,7 +1869,7 @@ tbl_keys({t}) *vim.tbl_keys()*
return table of keys is not guaranteed. return table of keys is not guaranteed.
Parameters: ~ Parameters: ~
{t} (table) Table {t} (table) Table
Return: ~ Return: ~
(table) List of keys (table) List of keys
@@ -1881,8 +1881,8 @@ tbl_map({func}, {t}) *vim.tbl_map()*
Apply a function to all values of a table. Apply a function to all values of a table.
Parameters: ~ Parameters: ~
{func} function|table Function or callable table {func} function|table Function or callable table
{t} (table) Table {t} (table) Table
Return: ~ Return: ~
(table) Table of transformed values (table) Table of transformed values
@@ -1892,7 +1892,7 @@ tbl_values({t}) *vim.tbl_values()*
return table of values is not guaranteed. return table of values is not guaranteed.
Parameters: ~ Parameters: ~
{t} (table) Table {t} (table) Table
Return: ~ Return: ~
(table) List of values (table) List of values
@@ -1901,7 +1901,7 @@ trim({s}) *vim.trim()*
Trim whitespace (Lua pattern "%s") from both sides of a string. Trim whitespace (Lua pattern "%s") from both sides of a string.
Parameters: ~ Parameters: ~
{s} (string) String to trim {s} (string) String to trim
Return: ~ Return: ~
(string) String with whitespace removed from its beginning and end (string) String with whitespace removed from its beginning and end
@@ -1946,7 +1946,7 @@ validate({opt}) *vim.validate()*
< <
Parameters: ~ Parameters: ~
{opt} (table) Names of parameters to validate. Each key is a {opt} (table) Names of parameters to validate. Each key is a
parameter name; each value is a tuple in one of these forms: parameter name; each value is a tuple in one of these forms:
1. (arg_value, type_name, optional) 1. (arg_value, type_name, optional)
• arg_value: argument value • arg_value: argument value
@@ -1971,7 +1971,7 @@ uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()*
Get a URI from a bufnr Get a URI from a bufnr
Parameters: ~ Parameters: ~
{bufnr} (number) {bufnr} (number)
Return: ~ Return: ~
(string) URI (string) URI
@@ -1980,7 +1980,7 @@ uri_from_fname({path}) *vim.uri_from_fname()*
Get a URI from a file path. Get a URI from a file path.
Parameters: ~ Parameters: ~
{path} (string) Path to file {path} (string) Path to file
Return: ~ Return: ~
(string) URI (string) URI
@@ -1990,7 +1990,7 @@ uri_to_bufnr({uri}) *vim.uri_to_bufnr()*
the uri already exists. the uri already exists.
Parameters: ~ Parameters: ~
{uri} (string) {uri} (string)
Return: ~ Return: ~
(number) bufnr (number) bufnr
@@ -1999,7 +1999,7 @@ uri_to_fname({uri}) *vim.uri_to_fname()*
Get a filename from a URI Get a filename from a URI
Parameters: ~ Parameters: ~
{uri} (string) {uri} (string)
Return: ~ Return: ~
(string) filename or unchanged URI for non-file URIs (string) filename or unchanged URI for non-file URIs
@@ -2019,7 +2019,7 @@ input({opts}, {on_confirm}) *vim.ui.input()*
< <
Parameters: ~ Parameters: ~
{opts} (table) Additional options. See |input()| {opts} (table) Additional options. See |input()|
• prompt (string|nil) Text of the prompt • prompt (string|nil) Text of the prompt
• default (string|nil) Default reply to the input • default (string|nil) Default reply to the input
• completion (string|nil) Specifies type of completion • completion (string|nil) Specifies type of completion
@@ -2028,7 +2028,7 @@ input({opts}, {on_confirm}) *vim.ui.input()*
"-complete=" argument. See |:command-completion| "-complete=" argument. See |:command-completion|
• highlight (function) Function that will be used for • highlight (function) Function that will be used for
highlighting user inputs. highlighting user inputs.
{on_confirm} (function) ((input|nil) -> ()) Called once the user {on_confirm} (function) ((input|nil) -> ()) Called once the user
confirms or abort the input. `input` is what the user confirms or abort the input. `input` is what the user
typed. `nil` if the user aborted the dialog. typed. `nil` if the user aborted the dialog.
@@ -2052,8 +2052,8 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
< <
Parameters: ~ Parameters: ~
{items} (table) Arbitrary items {items} (table) Arbitrary items
{opts} (table) Additional options {opts} (table) Additional options
• prompt (string|nil) Text of the prompt. Defaults to • prompt (string|nil) Text of the prompt. Defaults to
`Select one of:` `Select one of:`
• format_item (function item -> text) Function to format • format_item (function item -> text) Function to format
@@ -2063,7 +2063,7 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
item shape. Plugins reimplementing `vim.ui.select` may item shape. Plugins reimplementing `vim.ui.select` may
wish to use this to infer the structure or semantics of wish to use this to infer the structure or semantics of
`items`, or the context in which select() was called. `items`, or the context in which select() was called.
{on_choice} (function) ((item|nil, idx|nil) -> ()) Called once the {on_choice} (function) ((item|nil, idx|nil) -> ()) Called once the
user made a choice. `idx` is the 1-based index of `item` user made a choice. `idx` is the 1-based index of `item`
within `items`. `nil` if the user aborted the dialog. within `items`. `nil` if the user aborted the dialog.
@@ -2157,7 +2157,7 @@ add({filetypes}) *vim.filetype.add()*
< <
Parameters: ~ Parameters: ~
{filetypes} (table) A table containing new filetype maps (see {filetypes} (table) A table containing new filetype maps (see
example). example).
match({args}) *vim.filetype.match()* match({args}) *vim.filetype.match()*
@@ -2192,7 +2192,7 @@ match({args}) *vim.filetype.match()*
< <
Parameters: ~ Parameters: ~
{args} (table) Table specifying which matching strategy to use. {args} (table) Table specifying which matching strategy to use.
Accepted keys are: Accepted keys are:
• buf (number): Buffer number to use for matching. Mutually • buf (number): Buffer number to use for matching. Mutually
exclusive with {contents} exclusive with {contents}
@@ -2226,7 +2226,7 @@ del({modes}, {lhs}, {opts}) *vim.keymap.del()*
< <
Parameters: ~ Parameters: ~
{opts} (table|nil) A table of optional arguments: {opts} (table|nil) A table of optional arguments:
• buffer: (number or boolean) Remove a mapping from the given • buffer: (number or boolean) Remove a mapping from the given
buffer. When "true" or 0, use the current buffer. buffer. When "true" or 0, use the current buffer.
@@ -2266,12 +2266,12 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
< <
Parameters: ~ Parameters: ~
{mode} string|table Same mode short names as |nvim_set_keymap()|. Can {mode} string|table Same mode short names as |nvim_set_keymap()|. Can
also be list of modes to create mapping on multiple modes. also be list of modes to create mapping on multiple modes.
{lhs} (string) Left-hand side |{lhs}| of the mapping. {lhs} (string) Left-hand side |{lhs}| of the mapping.
{rhs} string|function Right-hand side |{rhs}| of the mapping. Can {rhs} string|function Right-hand side |{rhs}| of the mapping. Can
also be a Lua function. also be a Lua function.
{opts} (table|nil) A table of |:map-arguments|. {opts} (table|nil) A table of |:map-arguments|.
• Accepts options accepted by the {opts} parameter in • Accepts options accepted by the {opts} parameter in
|nvim_set_keymap()|, with the following notable differences: |nvim_set_keymap()|, with the following notable differences:
• replace_keycodes: Defaults to `true` if "expr" is `true`. • replace_keycodes: Defaults to `true` if "expr" is `true`.
@@ -2297,7 +2297,7 @@ basename({file}) *vim.fs.basename()*
Return the basename of the given file or directory Return the basename of the given file or directory
Parameters: ~ Parameters: ~
{file} (string) File or directory {file} (string) File or directory
Return: ~ Return: ~
(string) Basename of {file} (string) Basename of {file}
@@ -2306,7 +2306,7 @@ dir({path}) *vim.fs.dir()*
Return an iterator over the files and directories located in {path} Return an iterator over the files and directories located in {path}
Parameters: ~ Parameters: ~
{path} (string) An absolute or relative path to the directory to {path} (string) An absolute or relative path to the directory to
iterate over. The path is first normalized iterate over. The path is first normalized
|vim.fs.normalize()|. |vim.fs.normalize()|.
@@ -2319,7 +2319,7 @@ dirname({file}) *vim.fs.dirname()*
Return the parent directory of the given file or directory Return the parent directory of the given file or directory
Parameters: ~ Parameters: ~
{file} (string) File or directory {file} (string) File or directory
Return: ~ Return: ~
(string) Parent directory of {file} (string) Parent directory of {file}
@@ -2337,11 +2337,11 @@ find({names}, {opts}) *vim.fs.find()*
specifying {type} to be "file" or "directory", respectively. specifying {type} to be "file" or "directory", respectively.
Parameters: ~ Parameters: ~
{names} (string|table|fun(name: string): boolean) Names of the files {names} (string|table|fun(name: string): boolean) Names of the files
and directories to find. Must be base names, paths and globs and directories to find. Must be base names, paths and globs
are not supported. If a function it is called per file and are not supported. If a function it is called per file and
dir within the traversed directories to test if they match. dir within the traversed directories to test if they match.
{opts} (table) Optional keyword arguments: {opts} (table) Optional keyword arguments:
• path (string): Path to begin searching from. If omitted, • path (string): Path to begin searching from. If omitted,
the current working directory is used. the current working directory is used.
• upward (boolean, default false): If true, search upward • upward (boolean, default false): If true, search upward
@@ -2378,7 +2378,7 @@ normalize({path}) *vim.fs.normalize()*
< <
Parameters: ~ Parameters: ~
{path} (string) Path to normalize {path} (string) Path to normalize
Return: ~ Return: ~
(string) Normalized path (string) Normalized path
@@ -2402,7 +2402,7 @@ parents({start}) *vim.fs.parents()*
< <
Parameters: ~ Parameters: ~
{start} (string) Initial file or directory. {start} (string) Initial file or directory.
Return: ~ Return: ~
(function) Iterator (function) Iterator

View File

@@ -429,7 +429,7 @@ get_captures_at_cursor({winnr}) *get_captures_at_cursor()*
Returns a list of highlight capture names under the cursor Returns a list of highlight capture names under the cursor
Parameters: ~ Parameters: ~
{winnr} (number|nil) Window handle or 0 for current window (default) {winnr} (number|nil) Window handle or 0 for current window (default)
Return: ~ Return: ~
string[] List of capture names string[] List of capture names
@@ -442,9 +442,9 @@ get_captures_at_pos({bufnr}, {row}, {col}) *get_captures_at_pos()*
if none are defined). if none are defined).
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer number (0 for current buffer) {bufnr} (number) Buffer number (0 for current buffer)
{row} (number) Position row {row} (number) Position row
{col} (number) Position column {col} (number) Position column
Return: ~ Return: ~
table[] List of captures `{ capture = "capture name", metadata = { ... table[] List of captures `{ capture = "capture name", metadata = { ...
@@ -454,7 +454,7 @@ get_node_at_cursor({winnr}) *get_node_at_cursor()*
Returns the smallest named node under the cursor Returns the smallest named node under the cursor
Parameters: ~ Parameters: ~
{winnr} (number|nil) Window handle or 0 for current window (default) {winnr} (number|nil) Window handle or 0 for current window (default)
Return: ~ Return: ~
(string) Name of node under the cursor (string) Name of node under the cursor
@@ -463,10 +463,10 @@ get_node_at_pos({bufnr}, {row}, {col}, {opts}) *get_node_at_pos()*
Returns the smallest named node at the given position Returns the smallest named node at the given position
Parameters: ~ Parameters: ~
{bufnr} (number) Buffer number (0 for current buffer) {bufnr} (number) Buffer number (0 for current buffer)
{row} (number) Position row {row} (number) Position row
{col} (number) Position column {col} (number) Position column
{opts} (table) Optional keyword arguments: {opts} (table) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages • ignore_injections boolean Ignore injected languages
(default true) (default true)
@@ -477,7 +477,7 @@ get_node_range({node_or_range}) *get_node_range()*
Returns the node's range or an unpacked range table Returns the node's range or an unpacked range table
Parameters: ~ Parameters: ~
{node_or_range} (userdata|table) |tsnode| or table of positions {node_or_range} (userdata|table) |tsnode| or table of positions
Return: ~ Return: ~
(table) `{ start_row, start_col, end_row, end_col }` (table) `{ start_row, start_col, end_row, end_col }`
@@ -489,11 +489,11 @@ get_parser({bufnr}, {lang}, {opts}) *get_parser()*
If needed, this will create the parser. If needed, this will create the parser.
Parameters: ~ Parameters: ~
{bufnr} (number|nil) Buffer the parser should be tied to (default: {bufnr} (number|nil) Buffer the parser should be tied to (default:
current buffer) current buffer)
{lang} (string|nil) Filetype of this parser (default: buffer {lang} (string|nil) Filetype of this parser (default: buffer
filetype) filetype)
{opts} (table|nil) Options to pass to the created language tree {opts} (table|nil) Options to pass to the created language tree
Return: ~ Return: ~
LanguageTree |LanguageTree| object to use for parsing LanguageTree |LanguageTree| object to use for parsing
@@ -502,9 +502,9 @@ get_string_parser({str}, {lang}, {opts}) *get_string_parser()*
Returns a string parser Returns a string parser
Parameters: ~ Parameters: ~
{str} (string) Text to parse {str} (string) Text to parse
{lang} (string) Language of this string {lang} (string) Language of this string
{opts} (table|nil) Options to pass to the created language tree {opts} (table|nil) Options to pass to the created language tree
Return: ~ Return: ~
LanguageTree |LanguageTree| object to use for parsing LanguageTree |LanguageTree| object to use for parsing
@@ -513,8 +513,8 @@ is_ancestor({dest}, {source}) *is_ancestor()*
Determines whether a node is the ancestor of another Determines whether a node is the ancestor of another
Parameters: ~ Parameters: ~
{dest} userdata Possible ancestor |tsnode| {dest} userdata Possible ancestor |tsnode|
{source} userdata Possible descendant |tsnode| {source} userdata Possible descendant |tsnode|
Return: ~ Return: ~
(boolean) True if {dest} is an ancestor of {source} (boolean) True if {dest} is an ancestor of {source}
@@ -523,9 +523,9 @@ is_in_node_range({node}, {line}, {col}) *is_in_node_range()*
Determines whether (line, col) position is in node range Determines whether (line, col) position is in node range
Parameters: ~ Parameters: ~
{node} userdata |tsnode| defining the range {node} userdata |tsnode| defining the range
{line} (number) Line (0-based) {line} (number) Line (0-based)
{col} (number) Column (0-based) {col} (number) Column (0-based)
Return: ~ Return: ~
(boolean) True if the position is in node range (boolean) True if the position is in node range
@@ -534,8 +534,8 @@ node_contains({node}, {range}) *node_contains()*
Determines if a node contains a range Determines if a node contains a range
Parameters: ~ Parameters: ~
{node} userdata |tsnode| {node} userdata |tsnode|
{range} (table) {range} (table)
Return: ~ Return: ~
(boolean) True if the {node} contains the {range} (boolean) True if the {node} contains the {range}
@@ -560,16 +560,16 @@ start({bufnr}, {lang}) *start()*
< <
Parameters: ~ Parameters: ~
{bufnr} (number|nil) Buffer to be highlighted (default: current {bufnr} (number|nil) Buffer to be highlighted (default: current
buffer) buffer)
{lang} (string|nil) Language of the parser (default: buffer {lang} (string|nil) Language of the parser (default: buffer
filetype) filetype)
stop({bufnr}) *stop()* stop({bufnr}) *stop()*
Stops treesitter highlighting for a buffer Stops treesitter highlighting for a buffer
Parameters: ~ Parameters: ~
{bufnr} (number|nil) Buffer to stop highlighting (default: current {bufnr} (number|nil) Buffer to stop highlighting (default: current
buffer) buffer)
@@ -583,7 +583,7 @@ inspect_language({lang}) *inspect_language()*
names, ... names, ...
Parameters: ~ Parameters: ~
{lang} (string) Language {lang} (string) Language
Return: ~ Return: ~
(table) (table)
@@ -596,11 +596,11 @@ require_language({lang}, {path}, {silent}, {symbol_name})
{path} {path}
Parameters: ~ Parameters: ~
{lang} (string) Language the parser should parse {lang} (string) Language the parser should parse
{path} (string|nil) Optional path the parser is located at {path} (string|nil) Optional path the parser is located at
{silent} (boolean|nil) Don't throw an error if language not {silent} (boolean|nil) Don't throw an error if language not
found found
{symbol_name} (string|nil) Internal symbol name for the language to {symbol_name} (string|nil) Internal symbol name for the language to
load load
Return: ~ Return: ~
@@ -619,26 +619,26 @@ add_directive({name}, {handler}, {force}) *add_directive()*
`metadata[capture_id].key = value` `metadata[capture_id].key = value`
Parameters: ~ Parameters: ~
{name} (string) Name of the directive, without leading # {name} (string) Name of the directive, without leading #
{handler} function(match:string, pattern:string, bufnr:number, {handler} function(match:string, pattern:string, bufnr:number,
predicate:function, metadata:table) predicate:function, metadata:table)
add_predicate({name}, {handler}, {force}) *add_predicate()* add_predicate({name}, {handler}, {force}) *add_predicate()*
Adds a new predicate to be used in queries Adds a new predicate to be used in queries
Parameters: ~ Parameters: ~
{name} (string) Name of the predicate, without leading # {name} (string) Name of the predicate, without leading #
{handler} function(match:string, pattern:string, bufnr:number, {handler} function(match:string, pattern:string, bufnr:number,
predicate:function) predicate:function)
get_node_text({node}, {source}, {opts}) *get_node_text()* get_node_text({node}, {source}, {opts}) *get_node_text()*
Gets the text corresponding to a given node Gets the text corresponding to a given node
Parameters: ~ Parameters: ~
{node} userdata |tsnode| {node} userdata |tsnode|
{source} (number|string) Buffer or string from which the {node} is {source} (number|string) Buffer or string from which the {node} is
extracted extracted
{opts} (table|nil) Optional parameters. {opts} (table|nil) Optional parameters.
• concat: (boolean) Concatenate result in a string (default • concat: (boolean) Concatenate result in a string (default
true) true)
@@ -649,8 +649,8 @@ get_query({lang}, {query_name}) *get_query()*
Returns the runtime query {query_name} for {lang}. Returns the runtime query {query_name} for {lang}.
Parameters: ~ Parameters: ~
{lang} (string) Language to use for the query {lang} (string) Language to use for the query
{query_name} (string) Name of the query (e.g. "highlights") {query_name} (string) Name of the query (e.g. "highlights")
Return: ~ Return: ~
Query Parsed query Query Parsed query
@@ -660,9 +660,9 @@ get_query_files({lang}, {query_name}, {is_included})
Gets the list of files used to make up a query Gets the list of files used to make up a query
Parameters: ~ Parameters: ~
{lang} (string) Language to get query for {lang} (string) Language to get query for
{query_name} (string) Name of the query to load (e.g., "highlights") {query_name} (string) Name of the query to load (e.g., "highlights")
{is_included} (boolean|nil) Internal parameter, most of the time left {is_included} (boolean|nil) Internal parameter, most of the time left
as `nil` as `nil`
Return: ~ Return: ~
@@ -694,8 +694,8 @@ parse_query({lang}, {query}) *parse_query()*
• `info.patterns` contains information about predicates. • `info.patterns` contains information about predicates.
Parameters: ~ Parameters: ~
{lang} (string) Language to use for the query {lang} (string) Language to use for the query
{query} (string) Query in s-expr syntax {query} (string) Query in s-expr syntax
Return: ~ Return: ~
Query Parsed query Query Parsed query
@@ -726,11 +726,11 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop})
< <
Parameters: ~ Parameters: ~
{node} userdata |tsnode| under which the search will occur {node} userdata |tsnode| under which the search will occur
{source} (number|string) Source buffer or string to extract text from {source} (number|string) Source buffer or string to extract text from
{start} (number) Starting line for the search {start} (number) Starting line for the search
{stop} (number) Stopping line for the search (end-exclusive) {stop} (number) Stopping line for the search (end-exclusive)
{self} {self}
Return: ~ Return: ~
(number) capture Matching capture id (number) capture Matching capture id
@@ -761,11 +761,11 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
< <
Parameters: ~ Parameters: ~
{node} userdata |tsnode| under which the search will occur {node} userdata |tsnode| under which the search will occur
{source} (number|string) Source buffer or string to search {source} (number|string) Source buffer or string to search
{start} (number) Starting line for the search {start} (number) Starting line for the search
{stop} (number) Stopping line for the search (end-exclusive) {stop} (number) Stopping line for the search (end-exclusive)
{self} {self}
Return: ~ Return: ~
(number) pattern id (number) pattern id
@@ -779,9 +779,9 @@ set_query({lang}, {query_name}, {text}) *set_query()*
by plugins. by plugins.
Parameters: ~ Parameters: ~
{lang} (string) Language to use for the query {lang} (string) Language to use for the query
{query_name} (string) Name of the query (e.g., "highlights") {query_name} (string) Name of the query (e.g., "highlights")
{text} (string) Query text (unparsed). {text} (string) Query text (unparsed).
============================================================================== ==============================================================================
@@ -791,8 +791,8 @@ new({tree}, {opts}) *highlighter.new()*
Creates a new highlighter using Creates a new highlighter using
Parameters: ~ Parameters: ~
{tree} LanguageTree |LanguageTree| parser object to use for highlighting {tree} LanguageTree |LanguageTree| parser object to use for highlighting
{opts} (table|nil) Configuration of the highlighter: {opts} (table|nil) Configuration of the highlighter:
• queries table overwrite queries used by the highlighter • queries table overwrite queries used by the highlighter
Return: ~ Return: ~
@@ -802,7 +802,7 @@ TSHighlighter:destroy({self}) *TSHighlighter:destroy()*
Removes all internal references to the highlighter Removes all internal references to the highlighter
Parameters: ~ Parameters: ~
{self} {self}
============================================================================== ==============================================================================
@@ -812,14 +812,14 @@ LanguageTree:children({self}) *LanguageTree:children()*
Returns a map of language to child tree. Returns a map of language to child tree.
Parameters: ~ Parameters: ~
{self} {self}
LanguageTree:contains({self}, {range}) *LanguageTree:contains()* LanguageTree:contains({self}, {range}) *LanguageTree:contains()*
Determines whether {range} is contained in the |LanguageTree|. Determines whether {range} is contained in the |LanguageTree|.
Parameters: ~ Parameters: ~
{range} (table) `{ start_line, start_col, end_line, end_col }` {range} (table) `{ start_line, start_col, end_line, end_col }`
{self} {self}
Return: ~ Return: ~
(boolean) (boolean)
@@ -832,17 +832,17 @@ LanguageTree:destroy({self}) *LanguageTree:destroy()*
Note: This DOES NOT remove this tree from a parent. Instead, `remove_child` must be called on the parent to remove it. Note: This DOES NOT remove this tree from a parent. Instead, `remove_child` must be called on the parent to remove it.
Parameters: ~ Parameters: ~
{self} {self}
*LanguageTree:for_each_child()* *LanguageTree:for_each_child()*
LanguageTree:for_each_child({self}, {fn}, {include_self}) LanguageTree:for_each_child({self}, {fn}, {include_self})
Invokes the callback for each |LanguageTree| and its children recursively Invokes the callback for each |LanguageTree| and its children recursively
Parameters: ~ Parameters: ~
{fn} function(tree: LanguageTree, lang: string) {fn} function(tree: LanguageTree, lang: string)
{include_self} (boolean) Whether to include the invoking tree in the {include_self} (boolean) Whether to include the invoking tree in the
results results
{self} {self}
LanguageTree:for_each_tree({self}, {fn}) *LanguageTree:for_each_tree()* LanguageTree:for_each_tree({self}, {fn}) *LanguageTree:for_each_tree()*
Invokes the callback for each |LanguageTree| recursively. Invokes the callback for each |LanguageTree| recursively.
@@ -850,40 +850,40 @@ LanguageTree:for_each_tree({self}, {fn}) *LanguageTree:for_each_tree()*
Note: This includes the invoking tree's child trees as well. Note: This includes the invoking tree's child trees as well.
Parameters: ~ Parameters: ~
{fn} function(tree: TSTree, languageTree: LanguageTree) {fn} function(tree: TSTree, languageTree: LanguageTree)
{self} {self}
LanguageTree:included_regions({self}) *LanguageTree:included_regions()* LanguageTree:included_regions({self}) *LanguageTree:included_regions()*
Gets the set of included regions Gets the set of included regions
Parameters: ~ Parameters: ~
{self} {self}
LanguageTree:invalidate({self}, {reload}) *LanguageTree:invalidate()* LanguageTree:invalidate({self}, {reload}) *LanguageTree:invalidate()*
Invalidates this parser and all its children Invalidates this parser and all its children
Parameters: ~ Parameters: ~
{self} {self}
LanguageTree:is_valid({self}) *LanguageTree:is_valid()* LanguageTree:is_valid({self}) *LanguageTree:is_valid()*
Determines whether this tree is valid. If the tree is invalid, call `parse()` . This will return the updated tree. Determines whether this tree is valid. If the tree is invalid, call `parse()` . This will return the updated tree.
Parameters: ~ Parameters: ~
{self} {self}
LanguageTree:lang({self}) *LanguageTree:lang()* LanguageTree:lang({self}) *LanguageTree:lang()*
Gets the language of this tree node. Gets the language of this tree node.
Parameters: ~ Parameters: ~
{self} {self}
*LanguageTree:language_for_range()* *LanguageTree:language_for_range()*
LanguageTree:language_for_range({self}, {range}) LanguageTree:language_for_range({self}, {range})
Gets the appropriate language that contains {range}. Gets the appropriate language that contains {range}.
Parameters: ~ Parameters: ~
{range} (table) `{ start_line, start_col, end_line, end_col }` {range} (table) `{ start_line, start_col, end_line, end_col }`
{self} {self}
Return: ~ Return: ~
LanguageTree Managing {range} LanguageTree Managing {range}
@@ -893,11 +893,11 @@ LanguageTree:named_node_for_range({self}, {range}, {opts})
Gets the smallest named node that contains {range}. Gets the smallest named node that contains {range}.
Parameters: ~ Parameters: ~
{range} (table) `{ start_line, start_col, end_line, end_col }` {range} (table) `{ start_line, start_col, end_line, end_col }`
{opts} (table|nil) Optional keyword arguments: {opts} (table|nil) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages • ignore_injections boolean Ignore injected languages
(default true) (default true)
{self} {self}
Return: ~ Return: ~
userdata|nil Found |tsnode| userdata|nil Found |tsnode|
@@ -908,7 +908,7 @@ LanguageTree:parse({self}) *LanguageTree:parse()*
determine if any child languages should be created. determine if any child languages should be created.
Parameters: ~ Parameters: ~
{self} {self}
Return: ~ Return: ~
userdata[] Table of parsed |tstree| userdata[] Table of parsed |tstree|
@@ -918,7 +918,7 @@ LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()*
Registers callbacks for the |LanguageTree|. Registers callbacks for the |LanguageTree|.
Parameters: ~ Parameters: ~
{cbs} (table) An |nvim_buf_attach()|-like table argument with the {cbs} (table) An |nvim_buf_attach()|-like table argument with the
following handlers: following handlers:
• `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback. • `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback.
• `on_changedtree` : a callback that will be called every time • `on_changedtree` : a callback that will be called every time
@@ -929,24 +929,24 @@ LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()*
tree. tree.
• `on_child_removed` : emitted when a child is removed from • `on_child_removed` : emitted when a child is removed from
the tree. the tree.
{self} {self}
LanguageTree:source({self}) *LanguageTree:source()* LanguageTree:source({self}) *LanguageTree:source()*
Returns the source content of the language tree (bufnr or string). Returns the source content of the language tree (bufnr or string).
Parameters: ~ Parameters: ~
{self} {self}
*LanguageTree:tree_for_range()* *LanguageTree:tree_for_range()*
LanguageTree:tree_for_range({self}, {range}, {opts}) LanguageTree:tree_for_range({self}, {range}, {opts})
Gets the tree that contains {range}. Gets the tree that contains {range}.
Parameters: ~ Parameters: ~
{range} (table) `{ start_line, start_col, end_line, end_col }` {range} (table) `{ start_line, start_col, end_line, end_col }`
{opts} (table|nil) Optional keyword arguments: {opts} (table|nil) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages • ignore_injections boolean Ignore injected languages
(default true) (default true)
{self} {self}
Return: ~ Return: ~
userdata|nil Contained |tstree| userdata|nil Contained |tstree|
@@ -956,7 +956,7 @@ LanguageTree:trees({self}) *LanguageTree:trees()*
languages. languages.
Parameters: ~ Parameters: ~
{self} {self}
new({source}, {lang}, {opts}) *languagetree.new()* new({source}, {lang}, {opts}) *languagetree.new()*
A |LanguageTree| holds the treesitter parser for a given language {lang} A |LanguageTree| holds the treesitter parser for a given language {lang}
@@ -964,9 +964,9 @@ new({source}, {lang}, {opts}) *languagetree.new()*
may contain child languages themselves, hence the name). may contain child languages themselves, hence the name).
Parameters: ~ Parameters: ~
{source} (number|string) Buffer or a string of text to parse {source} (number|string) Buffer or a string of text to parse
{lang} (string) Root language this tree represents {lang} (string) Root language this tree represents
{opts} (table|nil) Optional keyword arguments: {opts} (table|nil) Optional keyword arguments:
• injections table Mapping language to injection query • injections table Mapping language to injection query
strings. This is useful for overriding the built-in strings. This is useful for overriding the built-in
runtime file searching for the injection language query runtime file searching for the injection language query

View File

@@ -673,7 +673,7 @@ def fmt_node_as_vimhelp(parent, width=text_width - indentation, indent='',
max_name_len = max_name(m.keys()) + 4 max_name_len = max_name(m.keys()) + 4
out = '' out = ''
for name, desc in m.items(): for name, desc in m.items():
name = ' {}'.format('{{{}}}'.format(name).ljust(max_name_len)) name = ' {}'.format('{{{}}}'.format(name).ljust(max_name_len))
out += '{}{}\n'.format(name, desc) out += '{}{}\n'.format(name, desc)
return out.rstrip() return out.rstrip()