aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/builtin.txt21
-rw-r--r--runtime/doc/deprecated.txt2
-rw-r--r--runtime/doc/develop.txt33
-rw-r--r--runtime/doc/diagnostic.txt189
-rw-r--r--runtime/doc/lsp.txt776
-rw-r--r--runtime/doc/lua.txt181
-rw-r--r--runtime/doc/treesitter.txt42
7 files changed, 725 insertions, 519 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 290fba5281..a043121adf 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -2928,32 +2928,31 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
The optional argument {opts} is a Dict and supports the
following items:
- type Specify the selection type
+ type Specify the region's selection type
(default: "v"):
"v" for |charwise| mode
"V" for |linewise| mode
"<CTRL-V>" for |blockwise-visual| mode
exclusive If |TRUE|, use exclusive selection
- for the end position 'selection'.
+ for the end position
+ (default: follow 'selection')
You can get the last selection type by |visualmode()|.
If Visual mode is active, use |mode()| to get the Visual mode
(e.g., in a |:vmap|).
- This function uses the line and column number from the
- specified position.
- It is useful to get text starting and ending in different
- columns, such as |charwise-visual| selection.
+ This function is useful to get text starting and ending in
+ different columns, such as a |charwise-visual| selection.
Note that:
- Order of {pos1} and {pos2} doesn't matter, it will always
return content from the upper left position to the lower
right position.
- - If 'virtualedit' is enabled and selection is past the end of
- line, resulting lines are filled with blanks.
- - If the selection starts or ends in the middle of a multibyte
- character, it is not included but its selected part is
- substituted with spaces.
+ - If 'virtualedit' is enabled and the region is past the end
+ of the lines, resulting lines are padded with spaces.
+ - If the region is blockwise and it starts or ends in the
+ middle of a multi-cell character, it is not included but
+ its selected part is substituted with spaces.
- If {pos1} or {pos2} is not current in the buffer, an empty
list is returned.
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 1b16a19aca..9ca4e66c7b 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -141,7 +141,7 @@ LSP FUNCTIONS
- *vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()|
or |vim.lsp.buf.format()| instead.
- *vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| or access
- `progress` of |vim.lsp.client|
+ `progress` of |vim.lsp.Client|
- *vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()|
- *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()|
- *vim.lsp.util.lookup_section()* Use |vim.tbl_get()| and
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index 28f43a70e0..1d566efec8 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -179,6 +179,8 @@ Strict "vimdoc" subset:
- Do not use indentation in random places—that prevents the page from using
"flow" layout. If you need a preformatted section, put it in
a |help-codeblock| starting with ">".
+- Parameters and fields are documented as `{foo}`.
+- Optional parameters and fields are documented as `{foo}?`.
C docstrings ~
@@ -189,9 +191,8 @@ from the docstrings defined in src/nvim/api/*.c.
Docstring format:
- Lines start with `///`
- Special tokens start with `@` followed by the token name:
- `@note`, `@param`, `@returns`
-- Limited markdown is supported.
- - List-items start with `-` (useful to nest or "indent")
+ `@note`, `@param`, `@return`
+- Markdown is supported.
- Use ``` for code samples.
Code samples can be annotated as `vim` or `lua`
@@ -233,11 +234,33 @@ definitions. The |lua-vim| :help is generated from the docstrings.
Docstring format:
- Use LuaCATS annotations: https://luals.github.io/wiki/annotations/
-- Limited markdown is supported.
- - List-items start with `-` (useful to nest or "indent")
+- Markdown is supported.
- Use ``` for code samples.
Code samples can be annotated as `vim` or `lua`
- Use `@nodoc` to prevent documentation generation.
+- Use `@inlinedoc` to inline `@class` blocks into `@param` blocks.
+ E.g. >lua
+ --- Object with fields:
+ --- @class myOpts
+ --- @inlinedoc
+ ---
+ --- Documentation for some field
+ --- @field somefield? integer
+
+ --- @param opts? myOpts
+ function foo(opts)
+ end
+<
+
+ Will be rendered as: >vimdoc
+
+ foo({opts})
+
+ Parameters:
+ - {opts}? (table) Object with the fields:
+ - {somefield}? (integer) Documentation
+ for some field
+<
- Files which has `@meta` are only used for typing and documentation.
Example: the help for |vim.paste()| is generated from a docstring decorating
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index dbfa0148af..29859f7b05 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -38,24 +38,6 @@ optionally supplied). A good rule of thumb is that if a method is meant to
modify the diagnostics for a buffer (e.g. |vim.diagnostic.set()|) then it
requires a namespace.
- *diagnostic-structure*
-A diagnostic is a Lua table with the following keys. Required keys are
-indicated with (+):
-
- bufnr: Buffer number
- lnum(+): The starting line of the diagnostic
- end_lnum: The final line of the diagnostic
- col(+): The starting column of the diagnostic
- end_col: The final column of the diagnostic
- severity: The severity of the diagnostic |vim.diagnostic.severity|
- message(+): The diagnostic text
- source: The source of the diagnostic
- code: The diagnostic code
- user_data: Arbitrary data plugins or users can add
-
-Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
-rows and columns). |api-indexing|
-
*vim.diagnostic.severity* *diagnostic-severity*
The "severity" key in a diagnostic is one of the values defined in
`vim.diagnostic.severity`:
@@ -361,6 +343,105 @@ Example: >lua
==============================================================================
Lua module: vim.diagnostic *diagnostic-api*
+*vim.Diagnostic*
+ *diagnostic-structure*
+
+ Diagnostics use the same indexing as the rest of the Nvim API (i.e.
+ 0-based rows and columns). |api-indexing|
+
+ Fields: ~
+ • {bufnr}? (`integer`) Buffer number
+ • {lnum} (`integer`) The starting line of the diagnostic
+ (0-indexed)
+ • {end_lnum}? (`integer`) The final line of the diagnostic (0-indexed)
+ • {col} (`integer`) The starting column of the diagnostic
+ (0-indexed)
+ • {end_col}? (`integer`) The final column of the diagnostic
+ (0-indexed)
+ • {severity}? (`vim.diagnostic.Severity`) The severity of the
+ diagnostic |vim.diagnostic.severity|
+ • {message} (`string`) The diagnostic text
+ • {source}? (`string`) The source of the diagnostic
+ • {code}? (`string|integer`) The diagnostic code
+ • {_tags}? (`{ deprecated: boolean, unnecessary: boolean}`)
+ • {user_data}? (`any`) arbitrary data plugins can add
+ • {namespace}? (`integer`)
+
+*vim.diagnostic.NS*
+
+ Fields: ~
+ • {name} (`string`)
+ • {opts} (`vim.diagnostic.Opts`)
+ • {user_data} (`table`)
+ • {disabled}? (`boolean`)
+
+*vim.diagnostic.Opts*
+
+ Fields: ~
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`)
+ • {update_in_insert}? (`boolean`)
+ • {underline}? (`boolean|vim.diagnostic.Opts.Underline`)
+ • {virtual_text}? (`boolean|vim.diagnostic.Opts.VirtualText`)
+ • {signs}? (`boolean|vim.diagnostic.Opts.Signs`)
+ • {severity_sort}? (`boolean|{reverse?:boolean}`)
+
+*vim.diagnostic.Opts.Float*
+
+ Fields: ~
+ • {bufnr}? (`integer`)
+ • {namespace}? (`integer`)
+ • {scope}? (`'line'|'buffer'|'cursor'|'c'|'l'|'b'`)
+ • {pos}? (`integer|{[1]:integer,[2]:integer}`)
+ • {severity_sort}? (`boolean|{reverse?:boolean}`)
+ • {severity}? (`vim.diagnostic.SeverityFilter`)
+ • {header}? (`string|{[1]:string,[2]:any}`)
+ • {source}? (`boolean|string`)
+ • {format}? (`fun(diagnostic:vim.Diagnostic): string`)
+ • {prefix}? (`string|table`)
+ • {suffix}? (`string|table`)
+ • {focus_id}? (`string`)
+
+*vim.diagnostic.Opts.Signs*
+
+ Fields: ~
+ • {severity}? (`vim.diagnostic.SeverityFilter`)
+ • {priority}? (`integer`)
+ • {text}? (`table<vim.diagnostic.Severity,string>`)
+ • {numhl}? (`table<vim.diagnostic.Severity,string>`)
+ • {linehl}? (`table<vim.diagnostic.Severity,string>`)
+ • {texthl}? (`table<vim.diagnostic.Severity,string>`)
+
+*vim.diagnostic.Opts.Underline*
+
+ Fields: ~
+ • {severity}? (`vim.diagnostic.SeverityFilter`)
+
+*vim.diagnostic.Opts.VirtualText*
+
+ Fields: ~
+ • {severity}? (`vim.diagnostic.SeverityFilter`)
+ • {source}? (`boolean|string`)
+ • {prefix}? (`string|function`)
+ • {suffix}? (`string|function`)
+ • {spacing}? (`integer`)
+ • {format}? (`function`)
+ • {hl_mode}? (`'replace'|'combine'|'blend'`)
+ • {virt_text}? (`{[1]:string,[2]:any}[]`)
+ • {virt_text_pos}? (`'eol'|'overlay'|'right_align'|'inline'`)
+ • {virt_text_win_col}? (`integer`)
+ • {virt_text_hide}? (`boolean`)
+
+*vim.diagnostic.OptsResolved*
+
+ Fields: ~
+ • {float} (`vim.diagnostic.Opts.Float`)
+ • {update_in_insert} (`boolean`)
+ • {underline} (`vim.diagnostic.Opts.Underline`)
+ • {virtual_text} (`vim.diagnostic.Opts.VirtualText`)
+ • {signs} (`vim.diagnostic.Opts.Signs`)
+ • {severity_sort} (`{reverse?:boolean}`)
+
+
config({opts}, {namespace}) *vim.diagnostic.config()*
Configure diagnostic options globally or for a specific diagnostic
namespace.
@@ -518,7 +599,8 @@ fromqflist({list}) *vim.diagnostic.fromqflist()*
|getloclist()|.
Return: ~
- (`vim.Diagnostic[]`) array of |diagnostic-structure|
+ (`vim.Diagnostic[]`) array of |diagnostic-structure|. See
+ |vim.Diagnostic|.
get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics.
@@ -538,7 +620,7 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Return: ~
(`vim.Diagnostic[]`) table A list of diagnostic items
|diagnostic-structure|. Keys `bufnr`, `end_lnum`, `end_col`, and
- `severity` are guaranteed to be present.
+ `severity` are guaranteed to be present. See |vim.Diagnostic|.
get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata.
@@ -563,7 +645,7 @@ get_next({opts}) *vim.diagnostic.get_next()*
• {opts} (`table?`) See |vim.diagnostic.goto_next()|
Return: ~
- (`vim.Diagnostic?`) Next diagnostic
+ (`vim.Diagnostic?`) Next diagnostic. See |vim.Diagnostic|.
get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
Return the position of the next diagnostic in the current buffer.
@@ -582,7 +664,7 @@ get_prev({opts}) *vim.diagnostic.get_prev()*
• {opts} (`table?`) See |vim.diagnostic.goto_next()|
Return: ~
- (`vim.Diagnostic?`) Previous diagnostic
+ (`vim.Diagnostic?`) Previous diagnostic. See |vim.Diagnostic|.
get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
Return the position of the previous diagnostic in the current buffer.
@@ -599,21 +681,22 @@ goto_next({opts}) *vim.diagnostic.goto_next()*
Parameters: ~
• {opts} (`table?`) Configuration table with the following keys:
- • namespace: (integer) Only consider diagnostics from the
+ • {namespace} (`integer`) Only consider diagnostics from the
given namespace.
- • cursor_position: (cursor position) Cursor position as a
- (row, col) tuple. See |nvim_win_get_cursor()|. Defaults to
- the current cursor position.
- • wrap: (boolean, default true) Whether to loop around file or
- not. Similar to 'wrapscan'.
- • severity: See |diagnostic-severity|.
- • float: (boolean or table, default true) If "true", call
- |vim.diagnostic.open_float()| after moving. If a table, pass
- the table as the {opts} parameter to
- |vim.diagnostic.open_float()|. Unless overridden, the float
- will show diagnostics at the new cursor position (as if
- "cursor" were passed to the "scope" option).
- • win_id: (number, default 0) Window ID
+ • {cursor_position}? (`{[1]:integer,[2]:integer}`) Cursor
+ position as a (row, col) tuple. See |nvim_win_get_cursor()|.
+ Defaults to the current cursor position.
+ • {wrap}? (`boolean`, default: `true`) Whether to loop around
+ file or not. Similar to 'wrapscan'.
+ • {severity} (`vim.diagnostic.Severity`) See
+ |diagnostic-severity|.
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`, default:
+ `true`) If "true", call |vim.diagnostic.open_float()| after
+ moving. If a table, pass the table as the {opts} parameter
+ to |vim.diagnostic.open_float()|. Unless overridden, the
+ float will show diagnostics at the new cursor position (as
+ if "cursor" were passed to the "scope" option).
+ • {win_id}? (`integer`, default: `0`) Window ID
goto_prev({opts}) *vim.diagnostic.goto_prev()*
Move to the previous diagnostic in the current buffer.
@@ -678,7 +761,7 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
Return: ~
(`vim.Diagnostic?`) |diagnostic-structure| or `nil` if {pat} fails to
- match {str}.
+ match {str}. See |vim.Diagnostic|.
open_float({opts}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window.
@@ -758,7 +841,7 @@ set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
• {namespace} (`integer`) The diagnostic namespace
• {bufnr} (`integer`) Buffer number
• {diagnostics} (`vim.Diagnostic[]`) A list of diagnostic items
- |diagnostic-structure|
+ |diagnostic-structure|. See |vim.Diagnostic|.
• {opts} (`table?`) Display options to pass to
|vim.diagnostic.show()|
@@ -767,28 +850,30 @@ setloclist({opts}) *vim.diagnostic.setloclist()*
Parameters: ~
• {opts} (`table?`) Configuration table with the following keys:
- • namespace: (number) Only add diagnostics from the given
+ • {namespace}? (`integer`) Only add diagnostics from the given
namespace.
- • winnr: (number, default 0) Window number to set location
- list for.
- • open: (boolean, default true) Open the location list after
- setting.
- • title: (string) Title of the location list. Defaults to
+ • {winnr}? (`integer`, default: `0`) Window number to set
+ location list for.
+ • {open}? (`boolean`, default: `true`) Open the location list
+ after setting.
+ • {title}? (`string`) Title of the location list. Defaults to
"Diagnostics".
- • severity: See |diagnostic-severity|.
+ • {severity}? (`vim.diagnostic.Severity`) See
+ |diagnostic-severity|.
setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list.
Parameters: ~
• {opts} (`table?`) Configuration table with the following keys:
- • namespace: (number) Only add diagnostics from the given
+ • {namespace}? (`integer`) Only add diagnostics from the given
namespace.
- • open: (boolean, default true) Open quickfix list after
- setting.
- • title: (string) Title of quickfix list. Defaults to
+ • {open}? (`boolean`, default: `true`) Open quickfix list
+ after setting.
+ • {title}? (`string`) Title of quickfix list. Defaults to
"Diagnostics".
- • severity: See |diagnostic-severity|.
+ • {severity}? (`vim.diagnostic.Severity`) See
+ |diagnostic-severity|.
*vim.diagnostic.show()*
show({namespace}, {bufnr}, {diagnostics}, {opts})
@@ -804,7 +889,7 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
namespace and buffer. This can be used to display a
list of diagnostics without saving them or to display
only a subset of diagnostics. May not be used when
- {namespace} or {bufnr} is nil.
+ {namespace} or {bufnr} is nil. See |vim.Diagnostic|.
• {opts} (`table?`) Display options. See
|vim.diagnostic.config()|.
@@ -814,7 +899,7 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()*
Parameters: ~
• {diagnostics} (`vim.Diagnostic[]`) List of diagnostics
- |diagnostic-structure|.
+ |diagnostic-structure|. See |vim.Diagnostic|.
Return: ~
(`table[]`) of quickfix list items |setqflist-what|
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index c14c0e5b9c..d78189780d 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -218,7 +218,7 @@ Each response handler has this signature: >
- {ctx} (table) Table of calling state associated with the
handler, with these keys:
- {method} (string) |lsp-method| name.
- - {client_id} (number) |vim.lsp.client| identifier.
+ - {client_id} (number) |vim.lsp.Client| identifier.
- {bufnr} (Buffer) Buffer handle.
- {params} (table|nil) Request parameters table.
- {version} (number) Document version at time of
@@ -366,31 +366,6 @@ https://microsoft.github.io/language-server-protocol/specifications/specificatio
LSP notification shape:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage
- *lsp-on-list-handler*
-
-`on_list` receives a table with:
-
- - `items` table[], structured like |setqflist-what|
- - `title` string, title for the list.
- - `context` table|nil. `ctx` from |lsp-handler|
-
-This table can be used with vim.fn.setqflist or vim.fn.setloclist. E.g.:
->lua
- local function on_list(options)
- vim.fn.setqflist({}, ' ', options)
- vim.api.nvim_command('cfirst')
- end
-
- vim.lsp.buf.definition{on_list=on_list}
- vim.lsp.buf.references(nil, {on_list=on_list})
-<
-If you prefer loclist do something like this:
->lua
- local function on_list(options)
- vim.fn.setloclist(0, {}, ' ', options)
- vim.api.nvim_command('lopen')
- end
-<
================================================================================
LSP HIGHLIGHT *lsp-highlight*
@@ -557,7 +532,7 @@ LspNotify *LspNotify*
LspProgress *LspProgress*
Upon receipt of a progress notification from the server. Notifications can
- be polled from a `progress` ring buffer of a |vim.lsp.client| or use
+ be polled from a `progress` ring buffer of a |vim.lsp.Client| or use
|vim.lsp.status()| to get an aggregate message
If the server sends a "work done progress", the `pattern` is set to `kind`
@@ -583,7 +558,7 @@ LspRequest *LspRequest*
will trigger with {type} == `cancel`.
When used from Lua, the client ID, request ID, and request are sent in
- the "data" table. See {requests} in |vim.lsp.client| for details on the
+ the "data" table. See {requests} in |vim.lsp.Client| for details on the
{request} value. If the request type is `complete`, the request will be
deleted from the client's pending requests table immediately after
calling the event's callbacks. Example: >lua
@@ -712,77 +687,6 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
(`string?`) err On timeout, cancel, or error, `err` is a string
describing the failure reason, and `result` is nil.
-client *vim.lsp.client*
- LSP client object. You can get an active client object via
- |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|.
- • Methods:
- • request(method, params, [handler], bufnr) Sends a request to the
- server. This is a thin wrapper around {client.rpc.request} with some
- additional checking. If {handler} is not specified, If one is not
- found there, then an error will occur. Returns: {status},
- {[client_id]}. {status} is a boolean indicating if the notification
- was successful. If it is `false`, then it will always be `false` (the
- client has shutdown). If {status} is `true`, the function returns
- {request_id} as the second result. You can use this with
- `client.cancel_request(request_id)` to cancel the request.
- • request_sync(method, params, timeout_ms, bufnr) Sends a request to the
- server and synchronously waits for the response. This is a wrapper
- around {client.request} Returns: { err=err, result=result }, a
- dictionary, where `err` and `result` come from the |lsp-handler|. On
- timeout, cancel or error, returns `(nil, err)` where `err` is a string
- describing the failure reason. If the request was unsuccessful returns
- `nil`.
- • notify(method, params) Sends a notification to an LSP server. Returns:
- a boolean to indicate if the notification was successful. If it is
- false, then it will always be false (the client has shutdown).
- • cancel_request(id) Cancels a request with a given request id. Returns:
- same as `notify()`.
- • stop([force]) Stops a client, optionally with force. By default, it
- will just ask the server to shutdown without force. If you request to
- stop a client which has previously been requested to shutdown, it will
- automatically escalate and force shutdown.
- • is_stopped() Checks whether a client is stopped. Returns: true if the
- client is fully stopped.
- • on_attach(client, bufnr) Runs the on_attach function from the client's
- config if it was defined. Useful for buffer-local setup.
- • supports_method(method, [opts]): boolean Checks if a client supports a
- given method. Always returns true for unknown off-spec methods. [opts]
- is a optional `{bufnr?: integer}` table. Some language server
- capabilities can be file specific.
- • Members
- • {id} (number): The id allocated to the client.
- • {name} (string): If a name is specified on creation, that will be
- used. Otherwise it is just the client id. This is used for logs and
- messages.
- • {rpc} (table): RPC client object, for low level interaction with the
- client. See |vim.lsp.rpc.start()|.
- • {offset_encoding} (string): The encoding used for communicating with
- the server. You can modify this in the `config`'s `on_init` method
- before text is sent to the server.
- • {handlers} (table): The handlers used by the client as described in
- |lsp-handler|.
- • {commands} (table): Table of command name to function which is called
- if any LSP action (code action, code lenses, ...) triggers the
- command. Client commands take precedence over the global command
- registry.
- • {requests} (table): The current pending requests in flight to the
- server. Entries are key-value pairs with the key being the request ID
- while the value is a table with `type`, `bufnr`, and `method`
- key-value pairs. `type` is either "pending" for an active request, or
- "cancel" for a cancel request. It will be "complete" ephemerally while
- executing |LspRequest| autocmds when replies are received from the
- server.
- • {config} (table): Reference of the table that was passed by the user
- to |vim.lsp.start_client()|.
- • {server_capabilities} (table): Response from the server sent on
- `initialize` describing the server's capabilities.
- • {progress} A ring buffer (|vim.ringbuf()|) containing progress
- messages sent by the server.
- • {settings} Map with language server specific settings. See {config} in
- |vim.lsp.start_client()|
- • {flags} A table with flags for the client. See {config} in
- |vim.lsp.start_client()|
-
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Checks whether a client is stopped.
@@ -820,10 +724,9 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
Parameters: ~
- • {opts} (`table`) options for customizing the formatting expression
- which takes the following optional keys:
- • timeout_ms (default 500ms). The timeout period for the
- formatting request.
+ • {opts} (`table?`) A table with the following fields:
+ • {timeout_ms} (`integer`, default: 500ms) The timeout period
+ for the formatting request..
*vim.lsp.get_buffers_by_client_id()*
get_buffers_by_client_id({client_id})
@@ -843,23 +746,23 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
• {client_id} (`integer`) client id
Return: ~
- (`lsp.Client?`) client rpc object
+ (`vim.lsp.Client?`) client rpc object
get_clients({filter}) *vim.lsp.get_clients()*
Get active clients.
Parameters: ~
- • {filter} (`table?`) A table with key-value pairs used to filter the
- returned clients. The available keys are:
- • id (number): Only return clients with the given id
- • bufnr (number): Only return clients attached to this
+ • {filter} (`table?`) Key-value pairs used to filter the returned
+ clients.
+ • {id}? (`integer`) Only return clients with the given id
+ • {bufnr}? (`integer`) Only return clients attached to this
buffer
- • name (string): Only return clients with the given name
- • method (string): Only return clients supporting the given
- method
+ • {name}? (`string`) Only return clients with the given name
+ • {method}? (`string`) Only return clients supporting the
+ given method
Return: ~
- (`lsp.Client[]`) List of |vim.lsp.client| objects
+ (`vim.lsp.Client[]`) List of |vim.lsp.Client| objects
get_log_path() *vim.lsp.get_log_path()*
Gets the path of the logfile used by the LSP client.
@@ -937,15 +840,16 @@ start({config}, {opts}) *vim.lsp.start()*
`ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
Parameters: ~
- • {config} (`lsp.ClientConfig`) Same configuration as documented in
- |vim.lsp.start_client()|
- • {opts} (`lsp.StartOpts?`) Optional keyword arguments:
- • reuse_client (fun(client: client, config: table): boolean)
- Predicate used to decide if a client should be re-used.
- Used on all running clients. The default implementation
- re-uses a client if name and root_dir matches.
- • bufnr (number) Buffer handle to attach to if starting or
- re-using a client (0 for current).
+ • {config} (`vim.lsp.ClientConfig`) Configuration for the server. See
+ |vim.lsp.ClientConfig|.
+ • {opts} (`table?`) Optional keyword arguments
+ • {reuse_client} (`fun(client: vim.lsp.Client, config:
+ table): boolean`) Predicate used to decide if a client
+ should be re-used. Used on all running clients. The
+ default implementation re-uses a client if name and
+ root_dir matches.
+ • {bufnr} (`integer`) Buffer handle to attach to if starting
+ or re-using a client (0 for current).
Return: ~
(`integer?`) client_id
@@ -953,112 +857,12 @@ start({config}, {opts}) *vim.lsp.start()*
start_client({config}) *vim.lsp.start_client()*
Starts and initializes a client with the given configuration.
- Field `cmd` in {config} is required.
-
- Parameters: ~
- • {config} (`lsp.ClientConfig`) Configuration for the server:
- • cmd: (string[]|fun(dispatchers: table):table) command
- string[] that launches the language server (treated as in
- |jobstart()|, must be absolute or on `$PATH`, shell
- constructs like "~" are not expanded), or function that
- creates an RPC client. Function receives a `dispatchers`
- table and returns a table with member functions `request`,
- `notify`, `is_closing` and `terminate`. See
- |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|. For TCP
- there is a builtin RPC client factory:
- |vim.lsp.rpc.connect()|
- • cmd_cwd: (string, default=|getcwd()|) Directory to launch
- the `cmd` process. Not related to `root_dir`.
- • cmd_env: (table) Environment flags to pass to the LSP on
- spawn. Must be specified using a table. Non-string values
- are coerced to string. Example: >
- { PORT = 8080; HOST = "0.0.0.0"; }
-<
- • detached: (boolean, default true) Daemonize the server
- process so that it runs in a separate process group from
- Nvim. Nvim will shutdown the process on exit, but if Nvim
- fails to exit cleanly this could leave behind orphaned
- server processes.
- • workspace_folders: (table) List of workspace folders
- passed to the language server. For backwards compatibility
- rootUri and rootPath will be derived from the first
- workspace folder in this list. See `workspaceFolders` in
- the LSP spec.
- • capabilities: Map overriding the default capabilities
- defined by |vim.lsp.protocol.make_client_capabilities()|,
- passed to the language server on initialization. Hint: use
- make_client_capabilities() and modify its result.
- • Note: To send an empty dictionary use
- |vim.empty_dict()|, else it will be encoded as an array.
- • handlers: Map of language server method names to
- |lsp-handler|
- • settings: Map with language server specific settings.
- These are returned to the language server if requested via
- `workspace/configuration`. Keys are case-sensitive.
- • commands: table Table that maps string of clientside
- commands to user-defined functions. Commands passed to
- start_client take precedence over the global command
- registry. Each key must be a unique command name, and the
- value is a function which is called if any LSP action
- (code action, code lenses, ...) triggers the command.
- • init_options Values to pass in the initialization request
- as `initializationOptions`. See `initialize` in the LSP
- spec.
- • name: (string, default=client-id) Name in log messages.
- • get_language_id: function(bufnr, filetype) -> language ID
- as string. Defaults to the filetype.
- • offset_encoding: (default="utf-16") One of "utf-8",
- "utf-16", or "utf-32" which is the encoding that the LSP
- server expects. Client does not verify this is correct.
- • on_error: Callback with parameters (code, ...), invoked
- when the client operation throws an error. `code` is a
- number describing the error. Other arguments may be passed
- depending on the error kind. See
- `vim.lsp.rpc.client_errors` for possible errors. Use
- `vim.lsp.rpc.client_errors[code]` to get human-friendly
- name.
- • before_init: Callback with parameters (initialize_params,
- config) invoked before the LSP "initialize" phase, where
- `params` contains the parameters being sent to the server
- and `config` is the config that was passed to
- |vim.lsp.start_client()|. You can use this to modify
- parameters before they are sent.
- • on_init: Callback (client, initialize_result) invoked
- after LSP "initialize", where `result` is a table of
- `capabilities` and anything else the server may send. For
- example, clangd sends `initialize_result.offsetEncoding`
- if `capabilities.offsetEncoding` was sent to it. You can
- only modify the `client.offset_encoding` here before any
- notifications are sent.
- • on_exit Callback (code, signal, client_id) invoked on
- client exit.
- • code: exit code of the process
- • signal: number describing the signal used to terminate
- (if any)
- • client_id: client handle
- • on_attach: Callback (client, bufnr) invoked when client
- attaches to a buffer.
- • trace: ("off" | "messages" | "verbose" | nil) passed
- directly to the language server in the initialize request.
- Invalid/empty values will default to "off"
- • flags: A table with flags for the client. The current
- (experimental) flags are:
- • allow_incremental_sync (bool, default true): Allow using
- incremental sync for buffer edits
- • debounce_text_changes (number, default 150): Debounce
- didChange notifications to the server by the given
- number in milliseconds. No debounce occurs if nil
- • exit_timeout (number|boolean, default false):
- Milliseconds to wait for server to exit cleanly after
- sending the "shutdown" request before sending kill -15.
- If set to false, nvim exits immediately after sending
- the "shutdown" request to the server.
- • root_dir: (string) Directory where the LSP server will
- base its workspaceFolders, rootUri, and rootPath on
- initialization.
+ Parameters: ~
+ • {config} (`vim.lsp.ClientConfig`) Configuration for the server. See
+ |vim.lsp.ClientConfig|.
Return: ~
- (`integer?`) client_id. |vim.lsp.get_client_by_id()| Note: client may
+ (`integer?`) client_id |vim.lsp.get_client_by_id()| Note: client may
not be fully initialized. Use `on_init` to do any actions once the
client has been initialized.
@@ -1072,7 +876,7 @@ status() *vim.lsp.status()*
stop_client({client_id}, {force}) *vim.lsp.stop_client()*
Stops a client(s).
- You can also use the `stop()` function on a |vim.lsp.client| object. To
+ You can also use the `stop()` function on a |vim.lsp.Client| object. To
stop all clients: >lua
vim.lsp.stop_client(vim.lsp.get_clients())
<
@@ -1081,8 +885,8 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
for this client, then force-shutdown is attempted.
Parameters: ~
- • {client_id} (`integer|table`) id or |vim.lsp.client| object, or list
- thereof
+ • {client_id} (`integer|vim.lsp.Client`) id or |vim.lsp.Client| object,
+ or list thereof
• {force} (`boolean?`) shutdown forcefully
tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()*
@@ -1110,8 +914,280 @@ with({handler}, {override_config}) *vim.lsp.with()*
==============================================================================
+Lua module: vim.lsp.client *lsp-client*
+
+*vim.lsp.Client*
+
+ Fields: ~
+ • {id} (`integer`) The id allocated to the client.
+ • {name} (`string`) If a name is specified on creation,
+ that will be used. Otherwise it is just the
+ client id. This is used for logs and messages.
+ • {rpc} (`vim.lsp.rpc.PublicClient`) RPC client
+ object, for low level interaction with the
+ client. See |vim.lsp.rpc.start()|.
+ • {offset_encoding} (`string`) The encoding used for communicating
+ with the server. You can modify this in the
+ `config`'s `on_init` method before text is
+ sent to the server.
+ • {handlers} (`table<string,lsp.Handler>`) The handlers
+ used by the client as described in
+ |lsp-handler|.
+ • {requests} (`table<integer,{ type: string, bufnr: integer, method: string}>`)
+ The current pending requests in flight to the
+ server. Entries are key-value pairs with the
+ key being the request ID while the value is a
+ table with `type`, `bufnr`, and `method`
+ key-value pairs. `type` is either "pending"
+ for an active request, or "cancel" for a
+ cancel request. It will be "complete"
+ ephemerally while executing |LspRequest|
+ autocmds when replies are received from the
+ server.
+ • {config} (`vim.lsp.ClientConfig`) copy of the table
+ that was passed by the user to
+ |vim.lsp.start_client()|.
+ • {server_capabilities} (`lsp.ServerCapabilities?`) Response from the
+ server sent on initialize` describing the
+ server's capabilities.
+ • {progress} (`vim.lsp.Client.Progress`) A ring buffer
+ (|vim.ringbuf()|) containing progress messages
+ sent by the server.
+ • {initialized} (`true?`)
+ • {workspace_folders} (`lsp.WorkspaceFolder[]?`) The workspace
+ folders configured in the client when the
+ server starts. This property is only available
+ if the client supports workspace folders. It
+ can be `null` if the client supports workspace
+ folders but none are configured.
+ • {root_dir} (`string`)
+ • {attached_buffers} (`table<integer,true>`)
+ • {commands} (`table<string,fun(command: lsp.Command, ctx:
+ table)>`) Table of command name to function
+ which is called if any LSP action (code
+ action, code lenses, ...) triggers the
+ command. Client commands take precedence over
+ the global command registry.
+ • {settings} (`table`)
+ • {flags} (`table`)
+ • {get_language_id} (`fun(bufnr: integer, filetype: string): string`)
+ • {capabilities} (`lsp.ClientCapabilities`) The capabilities
+ provided by the client (editor or tool)
+ • {dynamic_capabilities} (`lsp.DynamicCapabilities`)
+ • {request} (`fun(method: string, params: table?, handler: lsp.Handler?, bufnr: integer): boolean, integer?`)
+ Sends a request to the server. This is a thin
+ wrapper around {client.rpc.request} with some
+ additional checking. If {handler} is not
+ specified, If one is not found there, then an
+ error will occur. Returns: {status},
+ {[client_id]}. {status} is a boolean
+ indicating if the notification was successful.
+ If it is `false`, then it will always be
+ `false` (the client has shutdown). If {status}
+ is `true`, the function returns {request_id}
+ as the second result. You can use this with
+ `client.cancel_request(request_id)` to cancel
+ the request.
+ • {request_sync} (`fun(method: string, params: table?, timeout_ms: integer?, bufnr: integer): {err: lsp.ResponseError?, result:any}?, string?`)
+ err # a dictionary, where
+ • {notify} (`fun(method: string, params: table?):
+ boolean`) Sends a notification to an LSP
+ server. Returns: a boolean to indicate if the
+ notification was successful. If it is false,
+ then it will always be false (the client has
+ shutdown).
+ • {cancel_request} (`fun(id: integer): boolean`) Cancels a
+ request with a given request id. Returns: same
+ as `notify()`.
+ • {stop} (`fun(force?: boolean)`) Stops a client,
+ optionally with force. By default, it will
+ just ask the server to shutdown without force.
+ If you request to stop a client which has
+ previously been requested to shutdown, it will
+ automatically escalate and force shutdown.
+ • {on_attach} (`fun(bufnr: integer)`) Runs the on_attach
+ function from the client's config if it was
+ defined. Useful for buffer-local setup.
+ • {supports_method} (`fun(method: string, opts?: {bufnr: integer?}): boolean`)
+ Checks if a client supports a given method.
+ Always returns true for unknown off-spec
+ methods. [opts] is a optional `{bufnr?:
+ integer}` table. Some language server
+ capabilities can be file specific.
+ • {is_stopped} (`fun(): boolean`) Checks whether a client is
+ stopped. Returns: true if the client is fully
+ stopped.
+
+*vim.lsp.Client.Progress*
+ Extends: |vim.Ringbuf|
+
+ Fields: ~
+ • {pending} (`table<lsp.ProgressToken,lsp.LSPAny>`)
+
+*vim.lsp.ClientConfig*
+
+ Fields: ~
+ • {cmd} (`string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient?`)
+ command string[] that launches the language
+ server (treated as in |jobstart()|, must be
+ absolute or on `$PATH`, shell constructs like
+ "~" are not expanded), or function that creates
+ an RPC client. Function receives a `dispatchers`
+ table and returns a table with member functions
+ `request`, `notify`, `is_closing` and
+ `terminate`. See |vim.lsp.rpc.request()|,
+ |vim.lsp.rpc.notify()|. For TCP there is a
+ builtin RPC client factory:
+ |vim.lsp.rpc.connect()|
+ • {cmd_cwd}? (`string`, default: cwd) Directory to launch the
+ `cmd` process. Not related to `root_dir`.
+ • {cmd_env}? (`table`) Environment flags to pass to the LSP
+ on spawn. Must be specified using a table.
+ Non-string values are coerced to string.
+ Example: >lua
+ { PORT = 8080; HOST = "0.0.0.0"; }
+<
+ • {detached}? (`boolean`, default: true) Daemonize the server
+ process so that it runs in a separate process
+ group from Nvim. Nvim will shutdown the process
+ on exit, but if Nvim fails to exit cleanly this
+ could leave behind orphaned server processes.
+ • {workspace_folders}? (`lsp.WorkspaceFolder[]`) List of workspace
+ folders passed to the language server. For
+ backwards compatibility rootUri and rootPath
+ will be derived from the first workspace folder
+ in this list. See `workspaceFolders` in the LSP
+ spec.
+ • {capabilities}? (`lsp.ClientCapabilities`) Map overriding the
+ default capabilities defined by
+ |vim.lsp.protocol.make_client_capabilities()|,
+ passed to the language server on initialization.
+ Hint: use make_client_capabilities() and modify
+ its result.
+ • Note: To send an empty dictionary use
+ |vim.empty_dict()|, else it will be encoded as
+ an array.
+ • {handlers}? (`table<string,function>`) Map of language
+ server method names to |lsp-handler|
+ • {settings}? (`table`) Map with language server specific
+ settings. These are returned to the language
+ server if requested via
+ `workspace/configuration`. Keys are
+ case-sensitive.
+ • {commands}? (`table<string,fun(command: lsp.Command, ctx:
+ table)>`) Table that maps string of clientside
+ commands to user-defined functions. Commands
+ passed to start_client take precedence over the
+ global command registry. Each key must be a
+ unique command name, and the value is a function
+ which is called if any LSP action (code action,
+ code lenses, ...) triggers the command.
+ • {init_options}? (`table`) Values to pass in the initialization
+ request as `initializationOptions`. See
+ `initialize` in the LSP spec.
+ • {name}? (`string`, default: client-id) Name in log
+ messages.
+ • {get_language_id}? (`fun(bufnr: integer, filetype: string):
+ string`) Language ID as string. Defaults to the
+ filetype.
+ • {offset_encoding}? (`'utf-8'|'utf-16'|'utf-32'`) The encoding that
+ the LSP server expects. Client does not verify
+ this is correct.
+ • {on_error}? (`fun(code: integer, err: string)`) Callback
+ invoked when the client operation throws an
+ error. `code` is a number describing the error.
+ Other arguments may be passed depending on the
+ error kind. See `vim.lsp.rpc.client_errors` for
+ possible errors. Use
+ `vim.lsp.rpc.client_errors[code]` to get
+ human-friendly name.
+ • {before_init}? (`vim.lsp.client.before_init_cb`) Callback
+ invoked before the LSP "initialize" phase, where
+ `params` contains the parameters being sent to
+ the server and `config` is the config that was
+ passed to |vim.lsp.start_client()|. You can use
+ this to modify parameters before they are sent.
+ • {on_init}? (`elem_or_list<vim.lsp.client.on_init_cb>`)
+ Callback invoked after LSP "initialize", where
+ `result` is a table of `capabilities` and
+ anything else the server may send. For example,
+ clangd sends `initialize_result.offsetEncoding`
+ if `capabilities.offsetEncoding` was sent to it.
+ You can only modify the `client.offset_encoding`
+ here before any notifications are sent.
+ • {on_exit}? (`elem_or_list<vim.lsp.client.on_exit_cb>`)
+ Callback invoked on client exit.
+ • code: exit code of the process
+ • signal: number describing the signal used to
+ terminate (if any)
+ • client_id: client handle
+ • {on_attach}? (`elem_or_list<vim.lsp.client.on_attach_cb>`)
+ Callback invoked when client attaches to a
+ buffer.
+ • {trace}? (`'off'|'messages'|'verbose'`, default: "off")
+ Passed directly to the language server in the
+ initialize request. Invalid/empty values will
+ • {flags}? (`table`) A table with flags for the client. The
+ current (experimental) flags are:
+ • allow_incremental_sync (bool, default true):
+ Allow using incremental sync for buffer edits
+ • debounce_text_changes (number, default 150):
+ Debounce didChange notifications to the server
+ by the given number in milliseconds. No
+ debounce occurs if nil
+ • exit_timeout (number|boolean, default false):
+ Milliseconds to wait for server to exit
+ cleanly after sending the "shutdown" request
+ before sending kill -15. If set to false, nvim
+ exits immediately after sending the "shutdown"
+ request to the server.
+ • {root_dir}? (`string`) Directory where the LSP server will
+ base its workspaceFolders, rootUri, and rootPath
+ on initialization.
+
+
+
+==============================================================================
Lua module: vim.lsp.buf *lsp-buf*
+*vim.lsp.ListOpts*
+
+ Fields: ~
+ • {on_list}? (`fun(t: vim.lsp.LocationOpts.OnList)`) list-handler
+ replacing the default handler. Called for any non-empty
+ result. This table can be used with |setqflist()| or
+ |setloclist()|. E.g.: >lua
+ local function on_list(options)
+ vim.fn.setqflist({}, ' ', options)
+ vim.cmd.cfirst()
+ end
+
+ vim.lsp.buf.definition({ on_list = on_list })
+ vim.lsp.buf.references(nil, { on_list = on_list })
+<
+
+ If you prefer loclist do something like this: >lua
+ local function on_list(options)
+ vim.fn.setloclist(0, {}, ' ', options)
+ vim.cmd.lopen()
+ end
+<
+
+*vim.lsp.LocationOpts*
+ Extends: |vim.lsp.ListOpts|
+
+ Fields: ~
+ • {reuse_win}? (`boolean`) Jump to existing window if buffer is already
+ open.
+
+*vim.lsp.LocationOpts.OnList*
+
+ Fields: ~
+ • {items} (`table[]`) Structured like |setqflist-what|
+ • {title}? (`string`) Title for the list.
+ • {context}? (`table`) `ctx` from |lsp-handler|
+
+
*vim.lsp.buf.add_workspace_folder()*
add_workspace_folder({workspace_folder})
Add the folder at path to the workspace folders. If {path} is not
@@ -1127,27 +1203,26 @@ code_action({options}) *vim.lsp.buf.code_action()*
Selects a code action available at the current cursor position.
Parameters: ~
- • {options} (`table?`) Optional table which holds the following
- optional fields:
- • context: (table|nil) Corresponds to `CodeActionContext`
- of the LSP specification:
- • diagnostics (table|nil): LSP `Diagnostic[]`. Inferred
+ • {options} (`table?`) A table with the following fields:
+ • {context}? (`lsp.CodeActionContext`) Corresponds to
+ `CodeActionContext` of the LSP specification:
+ • {diagnostics}? (`table`) LSP `Diagnostic[]`. Inferred
from the current position if not provided.
- • only (table|nil): List of LSP `CodeActionKind`s used to
+ • {only}? (`table`) List of LSP `CodeActionKind`s used to
filter the code actions. Most language servers support
values like `refactor` or `quickfix`.
- • triggerKind (number|nil): The reason why code actions
+ • {triggerKind}? (`integer`) The reason why code actions
were requested.
- • filter: (function|nil) Predicate taking an `CodeAction`
- and returning a boolean.
- • apply: (boolean|nil) When set to `true`, and there is
+ • {filter}? (`fun(x: lsp.CodeAction|lsp.Command):boolean`)
+ Predicate taking an `CodeAction` and returning a boolean.
+ • {apply}? (`boolean`) When set to `true`, and there is
just one remaining action (after filtering), the action
is applied without user query.
- • range: (table|nil) Range for which code actions should be
- requested. If in visual mode this defaults to the active
- selection. Table must contain `start` and `end` keys with
- {row,col} tuples using mark-like indexing. See
- |api-indexing|
+ • {range}? (`{start: integer[], end: integer[]}`) Range for
+ which code actions should be requested. If in visual mode
+ this defaults to the active selection. Table must contain
+ `start` and `end` keys with {row,col} tuples using
+ mark-like indexing. See |api-indexing|
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
@@ -1174,21 +1249,13 @@ declaration({options}) *vim.lsp.buf.declaration()*
|vim.lsp.buf.definition()| instead.
Parameters: ~
- • {options} (`table?`) additional options
- • reuse_win: (boolean) Jump to existing window if buffer is
- already open.
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
definition({options}) *vim.lsp.buf.definition()*
Jumps to the definition of the symbol under the cursor.
Parameters: ~
- • {options} (`table?`) additional options
- • reuse_win: (boolean) Jump to existing window if buffer is
- already open.
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
document_highlight() *vim.lsp.buf.document_highlight()*
Send request to the server to resolve document highlights for the current
@@ -1208,15 +1275,13 @@ document_symbol({options}) *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix window.
Parameters: ~
- • {options} (`table?`) additional options
- • on_list: (function) handler for list results. See
- |lsp-on-list-handler|
+ • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
execute_command({command_params}) *vim.lsp.buf.execute_command()*
Executes an LSP server command.
Parameters: ~
- • {command_params} (`table`) A valid `ExecuteCommandParams` object
+ • {command_params} (`lsp.ExecuteCommandParams`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
@@ -1226,38 +1291,37 @@ format({options}) *vim.lsp.buf.format()*
server clients.
Parameters: ~
- • {options} (`table?`) Optional table which holds the following
- optional fields:
- • formatting_options (table|nil): Can be used to specify
+ • {options} (`table?`) A table with the following fields:
+ • {formatting_options}? (`table`) Can be used to specify
FormattingOptions. Some unspecified options will be
automatically derived from the current Nvim options. See
https://microsoft.github.io/language-server-protocol/specification/#formattingOptions
- • timeout_ms (integer|nil, default 1000): Time in
+ • {timeout_ms}? (`integer`, default: `1000`) Time in
milliseconds to block for formatting requests. No effect
- if async=true
- • bufnr (number|nil): Restrict formatting to the clients
- attached to the given buffer, defaults to the current
- buffer (0).
- • filter (function|nil): Predicate used to filter clients.
- Receives a client as argument and must return a boolean.
- Clients matching the predicate are included. Example: >lua
- -- Never request typescript-language-server for formatting
- vim.lsp.buf.format {
- filter = function(client) return client.name ~= "tsserver" end
- }
+ if async=true.
+ • {bufnr}? (`integer`, default: current buffer) Restrict
+ formatting to the clients attached to the given buffer.
+ • {filter}? (`fun(client: vim.lsp.Client): boolean?`)
+ Predicate used to filter clients. Receives a client as
+ argument and must return a boolean. Clients matching the
+ predicate are included. Example: >lua
+ -- Never request typescript-language-server for formatting
+ vim.lsp.buf.format {
+ filter = function(client) return client.name ~= "tsserver" end
+ }
<
- • async boolean|nil If true the method won't block.
- Defaults to false. Editing the buffer while formatting
+ • {async}? (`boolean`, default: false) If true the method
+ won't block. Editing the buffer while formatting
asynchronous can lead to unexpected changes.
- • id (number|nil): Restrict formatting to the client with
+ • {id}? (`integer`) Restrict formatting to the client with
ID (client.id) matching this field.
- • name (string|nil): Restrict formatting to the client with
+ • {name}? (`string`) Restrict formatting to the client with
name (client.name) matching this field.
- • range (table|nil) Range to format. Table must contain
- `start` and `end` keys with {row,col} tuples using (1,0)
- indexing. Defaults to current selection in visual mode
- Defaults to `nil` in other modes, formatting the full
- buffer
+ • {range}? (`{start:integer[],end:integer[]}`, default:
+ current selection in visual mode, `nil` in other modes,
+ formatting the full buffer) Range to format. Table must
+ contain `start` and `end` keys with {row,col} tuples
+ using (1,0) indexing.
hover() *vim.lsp.buf.hover()*
Displays hover information about the symbol under the cursor in a floating
@@ -1268,9 +1332,7 @@ implementation({options}) *vim.lsp.buf.implementation()*
quickfix window.
Parameters: ~
- • {options} (`table?`) additional options
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
incoming_calls() *vim.lsp.buf.incoming_calls()*
Lists all the call sites of the symbol under the cursor in the |quickfix|
@@ -1291,9 +1353,7 @@ references({context}, {options}) *vim.lsp.buf.references()*
Parameters: ~
• {context} (`table?`) Context for the request
- • {options} (`table?`) additional options
- • on_list: (function) handler for list results. See
- |lsp-on-list-handler|
+ • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
@@ -1312,11 +1372,12 @@ rename({new_name}, {options}) *vim.lsp.buf.rename()*
Parameters: ~
• {new_name} (`string?`) If not provided, the user will be prompted for
a new name using |vim.ui.input()|.
- • {options} (`table?`) additional options
- • filter (function|nil): Predicate used to filter clients.
- Receives a client as argument and must return a boolean.
- Clients matching the predicate are included.
- • name (string|nil): Restrict clients used for rename to
+ • {options} (`table?`) Additional options:
+ • {filter}? (`fun(client: vim.lsp.Client): boolean?`)
+ Predicate used to filter clients. Receives a client as
+ argument and must return a boolean. Clients matching the
+ predicate are included.
+ • {name}? (`string`) Restrict clients used for rename to
ones where client.name matches this field.
signature_help() *vim.lsp.buf.signature_help()*
@@ -1327,11 +1388,7 @@ type_definition({options}) *vim.lsp.buf.type_definition()*
Jumps to the definition of the type of the symbol under the cursor.
Parameters: ~
- • {options} (`table?`) additional options
- • reuse_win: (boolean) Jump to existing window if buffer is
- already open.
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()*
Lists all symbols in the current workspace in the quickfix window.
@@ -1342,9 +1399,7 @@ workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()*
Parameters: ~
• {query} (`string?`) optional
- • {options} (`table?`) additional options
- • on_list: (function) handler for list results. See
- |lsp-on-list-handler|
+ • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
==============================================================================
@@ -1470,10 +1525,9 @@ refresh({opts}) *vim.lsp.codelens.refresh()*
<
Parameters: ~
- • {opts} (`vim.lsp.codelens.RefreshOptions?`) Table with the following
- fields:
- • `bufnr` (integer|nil): filter by buffer. All buffers if nil,
- 0 for current buffer
+ • {opts} (`table?`) Optional fields
+ • {bufnr} (`integer?`) filter by buffer. All buffers if nil, 0
+ for current buffer
run() *vim.lsp.codelens.run()*
Run the code lens in the current line
@@ -1525,17 +1579,15 @@ get({filter}) *vim.lsp.inlay_hint.get()*
• This API is pre-release (unstable).
Parameters: ~
- • {filter} (`vim.lsp.inlay_hint.get.filter?`) Optional filters
- |kwargs|:
- • bufnr (integer?): 0 for current buffer
- • range (lsp.Range?)
+ • {filter} (`table?`) Optional filters |kwargs|:
+ • {bufnr} (`integer?`)
+ • {range} (`lsp.Range?`)
Return: ~
- (`vim.lsp.inlay_hint.get.ret[]`) Each list item is a table with the
- following fields:
- • bufnr (integer)
- • client_id (integer)
- • inlay_hint (lsp.InlayHint)
+ (`table[]`) A list of objects with the following fields:
+ • {bufnr} (`integer`)
+ • {client_id} (`integer`)
+ • {inlay_hint} (`lsp.InlayHint`)
is_enabled({bufnr}) *vim.lsp.inlay_hint.is_enabled()*
@@ -1596,12 +1648,12 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts})
• {token} (`table`) a semantic token, found as `args.data.token` in
|LspTokenUpdate|.
• {bufnr} (`integer`) the buffer to highlight
- • {client_id} (`integer`) The ID of the |vim.lsp.client|
+ • {client_id} (`integer`) The ID of the |vim.lsp.Client|
• {hl_group} (`string`) Highlight group name
- • {opts} (`table?`) Optional parameters.
- • priority: (integer|nil) Priority for the applied
- extmark. Defaults to
- `vim.highlight.priorities.semantic_tokens + 3`
+ • {opts} (`table?`) Optional parameters:
+ • {priority}? (`integer`, default:
+ `vim.highlight.priorities.semantic_tokens + 3`)
+ Priority for the applied extmark.
start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()*
Start the semantic token highlighting engine for the given buffer with the
@@ -1841,7 +1893,12 @@ locations_to_items({locations}, {offset_encoding})
buffer
Return: ~
- (`vim.lsp.util.LocationItem[]`) list of items
+ (`table[]`) A list of objects with the following fields:
+ • {filename} (`string`)
+ • {lnum} (`integer`) 1-indexed line number
+ • {col} (`integer`) 1-indexed column
+ • {text} (`string`)
+ • {user_data} (`lsp.Location|lsp.LocationLink`)
*vim.lsp.util.make_floating_popup_options()*
make_floating_popup_options({width}, {height}, {opts})
@@ -1966,22 +2023,25 @@ open_floating_preview({contents}, {syntax}, {opts})
Parameters: ~
• {contents} (`table`) of lines to show in window
• {syntax} (`string`) of syntax to set for opened buffer
- • {opts} (`table`) with optional fields (additional keys are
+ • {opts} (`table?`) with optional fields (additional keys are
filtered with |vim.lsp.util.make_floating_popup_options()|
before they are passed on to |nvim_open_win()|)
- • height: (integer) height of floating window
- • width: (integer) width of floating window
- • wrap: (boolean, default true) wrap long lines
- • wrap_at: (integer) character to wrap at for computing
- height when wrap is enabled
- • max_width: (integer) maximal width of floating window
- • max_height: (integer) maximal height of floating window
- • focus_id: (string) if a popup with this id is opened,
- then focus it
- • close_events: (table) list of events that closes the
+ • {height}? (`integer`) Height of floating window
+ • {width}? (`integer`) Width of floating window
+ • {wrap}? (`boolean`, default: `true`) Wrap long lines
+ • {wrap_at}? (`integer`) Character to wrap at for
+ computing height when wrap is enabled
+ • {max_width}? (`integer`) Maximal width of floating
+ window
+ • {max_height}? (`integer`) Maximal height of floating
+ window
+ • {focus_id}? (`string`) If a popup with this id is
+ opened, then focus it
+ • {close_events}? (`table`) List of events that closes the
floating window
- • focusable: (boolean, default true) Make float focusable
- • focus: (boolean, default true) If `true`, and if
+ • {focusable}? (`boolean`, default: `true`) Make float
+ focusable.
+ • {focus}? (`boolean`, default: `true`) If `true`, and if
{focusable} is also `true`, focus an existing floating
window with the same {focus_id}
@@ -2011,9 +2071,9 @@ rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()*
Parameters: ~
• {old_fname} (`string`)
• {new_fname} (`string`)
- • {opts} (`table?`) options
- • overwrite? boolean
- • ignoreIfExists? boolean
+ • {opts} (`table?`) Options:
+ • {overwrite}? (`boolean`)
+ • {ignoreIfExists}? (`boolean`)
*vim.lsp.util.show_document()*
show_document({location}, {offset_encoding}, {opts})
@@ -2106,6 +2166,17 @@ should_log({level}) *vim.lsp.log.should_log()*
==============================================================================
Lua module: vim.lsp.rpc *lsp-rpc*
+*vim.lsp.rpc.PublicClient*
+
+ Fields: ~
+ • {request} (`fun(method: string, params: table?, callback: fun(err: lsp.ResponseError?, result: any), notify_reply_callback: fun(integer)?):boolean,integer?`)
+ see |vim.lsp.rpc.request()|
+ • {notify} (`fun(method: string, params: any):boolean`) see
+ |vim.lsp.rpc.notify()|
+ • {is_closing} (`fun(): boolean`)
+ • {terminate} (`fun()`)
+
+
connect({host}, {port}) *vim.lsp.rpc.connect()*
Create a LSP RPC client factory that connects via TCP to the given host
and port.
@@ -2199,28 +2270,31 @@ start({cmd}, {dispatchers}, {extra_spawn_params}) *vim.lsp.rpc.start()*
Parameters: ~
• {cmd} (`string[]`) Command to start the LSP server.
- • {dispatchers} (`vim.lsp.rpc.Dispatchers?`) Dispatchers for LSP
- message types. Valid dispatcher names are:
- • `"notification"`
- • `"server_request"`
- • `"on_error"`
- • `"on_exit"`
- • {extra_spawn_params} (`vim.lsp.rpc.ExtraSpawnParams?`) Additional
- context for the LSP server process. May contain:
- • {cwd} (string) Working directory for the LSP
- server process
- • {detached?} (boolean) Detach the LSP server
- process from the current process. Defaults to
- false on Windows and true otherwise.
- • {env?} (table) Additional environment
- variables for LSP server process
+ • {dispatchers} (`table?`) Dispatchers for LSP message types.
+ • {notification} (`fun(method: string, params:
+ table)`)
+ • {server_request} (`fun(method: string, params:
+ table): any?, lsp.ResponseError?`)
+ • {on_exit} (`fun(code: integer, signal:
+ integer)`)
+ • {on_error} (`fun(code: integer, err: any)`)
+ • {extra_spawn_params} (`table?`) Additional context for the LSP server
+ process.
+ • {cwd}? (`string`) Working directory for the
+ LSP server process
+ • {detached}? (`boolean`) Detach the LSP server
+ process from the current process
+ • {env}? (`table<string,string>`) Additional
+ environment variables for LSP server process.
+ See |vim.system()|
Return: ~
(`vim.lsp.rpc.PublicClient?`) Client RPC object, with these methods:
• `notify()` |vim.lsp.rpc.notify()|
• `request()` |vim.lsp.rpc.request()|
• `is_closing()` returns a boolean indicating if the RPC is closing.
- • `terminate()` terminates the RPC client.
+ • `terminate()` terminates the RPC client. See
+ |vim.lsp.rpc.PublicClient|.
==============================================================================
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 797b097096..b4d66f11ae 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -1828,16 +1828,16 @@ vim.inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()*
the current cursor
• {col} (`integer?`) col to inspect, 0-based. Defaults to the col of
the current cursor
- • {filter} (`table?`) a table with key-value pairs to filter the items
- • syntax (boolean): include syntax based highlight groups
- (defaults to true)
- • treesitter (boolean): include treesitter based highlight
- groups (defaults to true)
- • extmarks (boolean|"all"): include extmarks. When `all`,
- then extmarks without a `hl_group` will also be included
- (defaults to true)
- • semantic_tokens (boolean): include semantic tokens
+ • {filter} (`table?`) Table with key-value pairs to filter the items
+ • {syntax} (`boolean`) Include syntax based highlight groups
(defaults to true)
+ • {treesitter} (`boolean`) Include treesitter based
+ highlight groups (defaults to true)
+ • {extmarks} (`boolean|"all"`, default: true) Include
+ extmarks. When `all`, then extmarks without a `hl_group`
+ will also be included.
+ • {semantic_tokens} (`boolean`) Include semantic token
+ highlights (defaults to true)
Return: ~
(`table`) a table with the following key-value pairs. Items are in
@@ -1866,6 +1866,17 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()*
+*vim.Ringbuf*
+
+ Fields: ~
+ • {clear} (`fun()`) Clear all items
+ • {push} (`fun(item: T)`) Adds an item, overriding the oldest item if
+ the buffer is full.
+ • {pop} (`fun(): T?`) Removes and returns the first unread item
+ • {peek} (`fun(): T?`) Returns the first unread item without removing
+ it
+
+
Ringbuf:clear() *Ringbuf:clear()*
Clear all items
@@ -1970,9 +1981,10 @@ vim.gsplit({s}, {sep}, {opts}) *vim.gsplit()*
• {s} (`string`) String to split
• {sep} (`string`) Separator or pattern
• {opts} (`table?`) Keyword arguments |kwargs|:
- • plain: (boolean) Use `sep` literally (as in string.find).
- • trimempty: (boolean) Discard empty segments at start and end
- of the sequence.
+ • {plain}? (`boolean`) Use `sep` literally (as in
+ string.find).
+ • {trimempty}? (`boolean`) Discard empty segments at start and
+ end of the sequence.
Return: ~
(`function`) Iterator over the split components
@@ -2104,8 +2116,11 @@ vim.split({s}, {sep}, {opts}) *vim.split()*
Parameters: ~
• {s} (`string`) String to split
• {sep} (`string`) Separator or pattern
- • {opts} (`table?`) Keyword arguments |kwargs| accepted by
- |vim.gsplit()|
+ • {opts} (`table?`) Keyword arguments |kwargs|:
+ • {plain}? (`boolean`) Use `sep` literally (as in
+ string.find).
+ • {trimempty}? (`boolean`) Discard empty segments at start and
+ end of the sequence.
Return: ~
(`string[]`) List of split components
@@ -2151,8 +2166,8 @@ vim.tbl_contains({t}, {value}, {opts}) *vim.tbl_contains()*
• {t} (`table`) Table to check
• {value} (`any`) Value to compare or predicate function reference
• {opts} (`table?`) Keyword arguments |kwargs|:
- • predicate: (boolean) `value` is a function reference to be
- checked (default false)
+ • {predicate}? (`boolean`) `value` is a function reference to
+ be checked (default false)
Return: ~
(`boolean`) `true` if `t` contains `value`
@@ -2419,23 +2434,23 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()*
• {modname} (`string`) Module name, or `"*"` to find the top-level
modules instead
• {opts} (`table?`) Options for finding a module:
- • rtp: (boolean) Search for modname in the runtime path
- (defaults to `true`)
- • paths: (string[]) Extra paths to search for modname
- (defaults to `{}`)
- • patterns: (string[]) List of patterns to use when
- searching for modules. A pattern is a string added to the
- basename of the Lua module being searched. (defaults to
- `{"/init.lua", ".lua"}`)
- • all: (boolean) Return all matches instead of just the
- first one (defaults to `false`)
-
- Return: ~
- (`table`) A list of results with the following properties:
- • modpath: (string) the path to the module
- • modname: (string) the name of the module
- • stat: (table|nil) the fs_stat of the module path. Won't be returned
- for `modname="*"`
+ • {rtp}? (`boolean`, default: `true`) Search for modname in
+ the runtime path.
+ • {paths}? (`string[]`, default: `{}`) Extra paths to
+ search for modname
+ • {patterns}? (`string[]`, default: `{"/init.lua",
+ ".lua"}`) List of patterns to use when searching for
+ modules. A pattern is a string added to the basename of
+ the Lua module being searched.
+ • {all}? (`boolean`, default: `false`) Search for all
+ matches.
+
+ Return: ~
+ (`table[]`) A list of objects with the following fields:
+ • {modpath} (`string`) Path of the module
+ • {modname} (`string`) Name of the module
+ • {stat}? (`uv.uv_fs_t`) The fs_stat of the module path. Won't be
+ returned for `modname="*"`
vim.loader.reset({path}) *vim.loader.reset()*
Resets the cache for the path, or all the paths if path is nil.
@@ -2678,6 +2693,9 @@ vim.filetype.add({filetypes}) *vim.filetype.add()*
Parameters: ~
• {filetypes} (`table`) A table containing new filetype maps (see
example).
+ • {pattern}? (`vim.filetype.mapping`)
+ • {extension}? (`vim.filetype.mapping`)
+ • {filename}? (`vim.filetype.mapping`)
*vim.filetype.get_option()*
vim.filetype.get_option({filetype}, {option})
@@ -2734,16 +2752,16 @@ vim.filetype.match({args}) *vim.filetype.match()*
Parameters: ~
• {args} (`table`) Table specifying which matching strategy to use.
Accepted keys are:
- • buf (number): Buffer number to use for matching. Mutually
- exclusive with {contents}
- • filename (string): Filename to use for matching. When {buf}
- is given, defaults to the filename of the given buffer
+ • {buf}? (`integer`) Buffer number to use for matching.
+ Mutually exclusive with {contents}
+ • {filename}? (`string`) Filename to use for matching. When
+ {buf} is given, defaults to the filename of the given buffer
number. The file need not actually exist in the filesystem.
When used without {buf} only the name of the file is used
for filetype matching. This may result in failure to detect
the filetype in cases where the filename alone is not enough
to disambiguate the filetype.
- • contents (table): An array of lines representing file
+ • {contents}? (`string[]`) An array of lines representing file
contents to use for matching. Can be used with {filename}.
Mutually exclusive with {buf}.
@@ -2896,18 +2914,18 @@ vim.fs.find({names}, {opts}) *vim.fs.find()*
• path: full path of the current item The function should
return `true` if the given item is considered a match.
• {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-directory| is used.
- • upward (boolean, default false): If true, search upward
+ • {upward} (`boolean`, default: `false`) Search upward
through parent directories. Otherwise, search through child
directories (recursively).
- • stop (string): Stop searching when this directory is
+ • {stop} (`string`) Stop searching when this directory is
reached. The directory itself is not searched.
- • type (string): Find only items of the given type. If
+ • {type} (`string`) Find only items of the given type. If
omitted, all items that match {names} are included.
- • limit (number, default 1): Stop the search after finding
- this many matches. Use `math.huge` to place no limit on the
- number of matches.
+ • {limit} (`number`, default: `1`) Stop the search after
+ finding this many matches. Use `math.huge` to place no
+ limit on the number of matches.
Return: ~
(`string[]`) Normalized paths |vim.fs.normalize()| of all matching
@@ -2942,9 +2960,9 @@ vim.fs.normalize({path}, {opts}) *vim.fs.normalize()*
Parameters: ~
• {path} (`string`) Path to normalize
- • {opts} (`table?`) Options:
- • expand_env: boolean Expand environment variables (default:
- true)
+ • {opts} (`table?`) A table with the following fields:
+ • {expand_env} (`boolean`, default: `true`) Expand environment
+ variables.
Return: ~
(`string`) Normalized path
@@ -3538,14 +3556,15 @@ vim.secure.trust({opts}) *vim.secure.trust()*
The trust database is located at |$XDG_STATE_HOME|/nvim/trust.
Parameters: ~
- • {opts} (`table`)
- • action (string): "allow" to add a file to the trust database
- and trust it, "deny" to add a file to the trust database and
- deny it, "remove" to remove file from the trust database
- • path (string|nil): Path to a file to update. Mutually
+ • {opts} (`table?`) A table with the following fields:
+ • {action} (`'allow'|'deny'|'remove'`) - `'allow'` to add a
+ file to the trust database and trust it,
+ • `'deny'` to add a file to the trust database and deny it,
+ • `'remove'` to remove file from the trust database
+ • {path}? (`string`) Path to a file to update. Mutually
exclusive with {bufnr}. Cannot be used when {action} is
"allow".
- • bufnr (number|nil): Buffer number to update. Mutually
+ • {bufnr}? (`integer`) Buffer number to update. Mutually
exclusive with {path}.
Return (multiple): ~
@@ -3628,8 +3647,8 @@ vim.version.cmp({v1}, {v2}) *vim.version.cmp()*
otherwise-equivalent versions.
Parameters: ~
- • {v1} (`Version|number[]|string`) Version object.
- • {v2} (`Version|number[]|string`) Version to compare with `v1`.
+ • {v1} (`vim.Version|number[]|string`) Version object.
+ • {v2} (`vim.Version|number[]|string`) Version to compare with `v1`.
Return: ~
(`integer`) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`.
@@ -3639,8 +3658,8 @@ vim.version.eq({v1}, {v2}) *vim.version.eq()*
for usage.
Parameters: ~
- • {v1} (`Version|number[]|string`)
- • {v2} (`Version|number[]|string`)
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
(`boolean`)
@@ -3649,8 +3668,8 @@ vim.version.ge({v1}, {v2}) *vim.version.ge()*
Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage.
Parameters: ~
- • {v1} (`Version|number[]|string`)
- • {v2} (`Version|number[]|string`)
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
(`boolean`)
@@ -3659,8 +3678,8 @@ vim.version.gt({v1}, {v2}) *vim.version.gt()*
Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage.
Parameters: ~
- • {v1} (`Version|number[]|string`)
- • {v2} (`Version|number[]|string`)
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
(`boolean`)
@@ -3669,17 +3688,17 @@ vim.version.last({versions}) *vim.version.last()*
TODO: generalize this, move to func.lua
Parameters: ~
- • {versions} (`Version[]`)
+ • {versions} (`vim.Version[]`)
Return: ~
- (`Version?`)
+ (`vim.Version?`)
vim.version.le({v1}, {v2}) *vim.version.le()*
Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage.
Parameters: ~
- • {v1} (`Version|number[]|string`)
- • {v2} (`Version|number[]|string`)
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
(`boolean`)
@@ -3688,8 +3707,8 @@ vim.version.lt({v1}, {v2}) *vim.version.lt()*
Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage.
Parameters: ~
- • {v1} (`Version|number[]|string`)
- • {v2} (`Version|number[]|string`)
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
(`boolean`)
@@ -3710,7 +3729,7 @@ vim.version.parse({version}, {opts}) *vim.version.parse()*
"1.0", "0-x", "tmux 3.2a" into valid versions.
Return: ~
- (`Version?`) parsed_version Version object or `nil` if input is
+ (`vim.Version?`) parsed_version Version object or `nil` if input is
invalid.
See also: ~
@@ -3744,6 +3763,12 @@ vim.version.range({spec}) *vim.version.range()*
Parameters: ~
• {spec} (`string`) Version range "spec"
+ Return: ~
+ (`table`) A table with the following fields:
+ • {from} (`vim.Version`)
+ • {to}? (`vim.Version`)
+ • {has} (`fun(self: vim.VersionRangeversion: string|vim.Version)`)
+
See also: ~
• https://github.com/npm/node-semver#ranges
@@ -4380,15 +4405,15 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()*
Parameters: ~
• {winid} (`integer?`) Window to convert (defaults to current window)
• {opt} (`table?`) Optional parameters.
- • title (string): Title tag to set in the generated HTML code
- (defaults to buffer name)
- • number_lines (boolean): Show line numbers (defaults to
- `false`)
- • font (string|string[]): Fonts to use (defaults to
- `guifont`)
- • width (integer) Width used for items which are either right
- aligned or repeat a character infinitely (defaults to
- 'textwidth' if non-zero or window width otherwise)
+ • {title}? (`string|false`, default: buffer name) Title tag
+ to set in the generated HTML code.
+ • {number_lines}? (`boolean`, default: `false`) Show line
+ numbers.
+ • {font}? (`string[]|string`, default: `guifont`) Fonts to
+ use.
+ • {width}? (`integer`, default: 'textwidth' if non-zero or
+ window width otherwise) Width used for items which are
+ either right aligned or repeat a character infinitely.
Return: ~
(`string[]`)
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 09c086b7f7..1d9b67adec 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -732,16 +732,16 @@ get_node({opts}) *vim.treesitter.get_node()*
<
Parameters: ~
- • {opts} (`vim.treesitter.GetNodeOpts?`) Optional keyword arguments:
- • bufnr integer|nil Buffer number (nil or 0 for current
+ • {opts} (`table?`) Optional keyword arguments:
+ • {bufnr} (`integer?`) Buffer number (nil or 0 for current
buffer)
- • pos table|nil 0-indexed (row, col) tuple. Defaults to cursor
- position in the current window. Required if {bufnr} is not
- the current buffer
- • lang string|nil Parser language. (default: from buffer
+ • {pos} (`{ [1]: integer, [2]: integer }?`) 0-indexed (row,
+ col) tuple. Defaults to cursor position in the current
+ window. Required if {bufnr} is not the current buffer
+ • {lang} (`string?`) Parser language. (default: from buffer
filetype)
- • ignore_injections boolean Ignore injected languages (default
- true)
+ • {ignore_injections} (`boolean?`) Ignore injected languages
+ (default true)
Return: ~
(`TSNode?`) Node at the given position
@@ -787,7 +787,7 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()*
• {opts} (`table?`) Options to pass to the created language tree
Return: ~
- (`LanguageTree`) object to use for parsing
+ (`vim.treesitter.LanguageTree`) object to use for parsing
get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()*
Get the range of a |TSNode|. Can also supply {source} and {metadata} to
@@ -797,7 +797,7 @@ get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()*
• {node} (`TSNode`)
• {source} (`integer|string?`) Buffer or string from which the {node}
is extracted
- • {metadata} (`TSMetadata?`)
+ • {metadata} (`vim.treesitter.query.TSMetadata?`)
Return: ~
(`Range6`)
@@ -812,7 +812,7 @@ get_string_parser({str}, {lang}, {opts})
• {opts} (`table?`) Options to pass to the created language tree
Return: ~
- (`LanguageTree`) object to use for parsing
+ (`vim.treesitter.LanguageTree`) object to use for parsing
inspect_tree({opts}) *vim.treesitter.inspect_tree()*
Open a window that displays a textual representation of the nodes in the
@@ -917,10 +917,10 @@ add({lang}, {opts}) *vim.treesitter.language.add()*
Parameters: ~
• {lang} (`string`) Name of the parser (alphanumerical and `_` only)
• {opts} (`table?`) Options:
- • filetype (string|string[]) Default filetype the parser
- should be associated with. Defaults to {lang}.
- • path (string|nil) Optional path the parser is located at
- • symbol_name (string|nil) Internal symbol name for the
+ • {filetype}? (`string|string[]`, default: {lang}) Default
+ filetype the parser should be associated with.
+ • {path}? (`string`) Optional path the parser is located at
+ • {symbol_name}? (`string`) Internal symbol name for the
language to load
get_filetypes({lang}) *vim.treesitter.language.get_filetypes()*
@@ -1069,10 +1069,10 @@ lint({buf}, {opts}) *vim.treesitter.query.lint()*
Parameters: ~
• {buf} (`integer`) Buffer handle
• {opts} (`table?`) Optional keyword arguments:
- • langs (string|string[]|nil) Language(s) to use for checking
+ • {langs}? (`string|string[]`) Language(s) to use for checking
the query. If multiple languages are specified, queries are
validated for all of them
- • clear (boolean) if `true`, just clear current lint errors
+ • {clear} (`boolean`) Just clear current lint errors
list_directives() *vim.treesitter.query.list_directives()*
Lists the currently available directives to use in queries.
@@ -1153,8 +1153,8 @@ Query:iter_captures({node}, {source}, {start}, {stop})
Defaults to `node:end_()`.
Return: ~
- (`fun(end_line: integer?): integer, TSNode, TSMetadata`) capture id,
- capture node, metadata
+ (`fun(end_line: integer?): integer, TSNode,
+ vim.treesitter.query.TSMetadata`) capture id, capture node, metadata
*Query:iter_matches()*
Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
@@ -1279,7 +1279,7 @@ LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()*
Note: This includes the invoking tree's child trees as well.
Parameters: ~
- • {fn} (`fun(tree: TSTree, ltree: LanguageTree)`)
+ • {fn} (`fun(tree: TSTree, ltree: vim.treesitter.LanguageTree)`)
LanguageTree:included_regions() *LanguageTree:included_regions()*
Gets the set of included regions managed by this LanguageTree. This can be
@@ -1318,7 +1318,7 @@ LanguageTree:language_for_range({range})
• {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
Return: ~
- (`LanguageTree`) Managing {range}
+ (`vim.treesitter.LanguageTree`) Managing {range}
*LanguageTree:named_node_for_range()*
LanguageTree:named_node_for_range({range}, {opts})