mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
docs: remove extra whitespaces
This commit is contained in:
parent
be2def4100
commit
ecc36c3d1c
@ -710,7 +710,7 @@ nvim_call_atomic({calls}) *nvim_call_atomic()*
|
|||||||
be returned.
|
be returned.
|
||||||
|
|
||||||
nvim_chan_send({chan}, {data}) *nvim_chan_send()*
|
nvim_chan_send({chan}, {data}) *nvim_chan_send()*
|
||||||
Send data to channel `id` . For a job, it writes it to the
|
Send data to channel `id`. For a job, it writes it to the
|
||||||
stdin of the process. For the stdio channel |channel-stdio|,
|
stdin of the process. For the stdio channel |channel-stdio|,
|
||||||
it writes to Nvim's stdout. For an internal terminal instance
|
it writes to Nvim's stdout. For an internal terminal instance
|
||||||
(|nvim_open_term()|) it writes directly to terminal output.
|
(|nvim_open_term()|) it writes directly to terminal output.
|
||||||
@ -850,7 +850,7 @@ nvim_exec_lua({code}, {args}) *nvim_exec_lua()*
|
|||||||
inside the chunk. The chunk can return a value.
|
inside the chunk. The chunk can return a value.
|
||||||
|
|
||||||
Only statements are executed. To evaluate an expression,
|
Only statements are executed. To evaluate an expression,
|
||||||
prefix it with `return` : return my_function(...)
|
prefix it with `return`: return my_function(...)
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{code} Lua code to execute
|
{code} Lua code to execute
|
||||||
@ -1133,13 +1133,13 @@ nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()*
|
|||||||
Option value
|
Option value
|
||||||
|
|
||||||
nvim_get_proc({pid}) *nvim_get_proc()*
|
nvim_get_proc({pid}) *nvim_get_proc()*
|
||||||
Gets info describing process `pid` .
|
Gets info describing process `pid`.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
Map of process properties, or NIL if process not found.
|
Map of process properties, or NIL if process not found.
|
||||||
|
|
||||||
nvim_get_proc_children({pid}) *nvim_get_proc_children()*
|
nvim_get_proc_children({pid}) *nvim_get_proc_children()*
|
||||||
Gets the immediate children of process `pid` .
|
Gets the immediate children of process `pid`.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
Array of child process ids, empty if process not found.
|
Array of child process ids, empty if process not found.
|
||||||
@ -1248,8 +1248,8 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
|
|||||||
nvim_list_bufs() *nvim_list_bufs()*
|
nvim_list_bufs() *nvim_list_bufs()*
|
||||||
Gets the current list of buffer handles
|
Gets the current list of buffer handles
|
||||||
|
|
||||||
Includes unlisted (unloaded/deleted) buffers, like `:ls!` .
|
Includes unlisted (unloaded/deleted) buffers, like `:ls!`. Use
|
||||||
Use |nvim_buf_is_loaded()| to check if a buffer is loaded.
|
|nvim_buf_is_loaded()| to check if a buffer is loaded.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
List of buffer handles
|
List of buffer handles
|
||||||
@ -1358,7 +1358,7 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()*
|
|||||||
|
|
||||||
Errors ('nomodifiable', `vim.paste()` failure, …) are
|
Errors ('nomodifiable', `vim.paste()` failure, …) are
|
||||||
reflected in `err` but do not affect the return value (which
|
reflected in `err` but do not affect the return value (which
|
||||||
is strictly decided by `vim.paste()` ). On error, subsequent
|
is strictly decided by `vim.paste()`). On error, subsequent
|
||||||
calls are ignored ("drained") until the next paste is
|
calls are ignored ("drained") until the next paste is
|
||||||
initiated (phase 1 or -1).
|
initiated (phase 1 or -1).
|
||||||
|
|
||||||
@ -1435,7 +1435,7 @@ nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})
|
|||||||
{insert} Whether the selection should be inserted in the
|
{insert} Whether the selection should be inserted in the
|
||||||
buffer.
|
buffer.
|
||||||
{finish} Finish the completion and dismiss the popupmenu.
|
{finish} Finish the completion and dismiss the popupmenu.
|
||||||
Implies `insert` .
|
Implies `insert`.
|
||||||
{opts} Optional parameters. Reserved for future use.
|
{opts} Optional parameters. Reserved for future use.
|
||||||
|
|
||||||
*nvim_set_client_info()*
|
*nvim_set_client_info()*
|
||||||
@ -1548,18 +1548,21 @@ nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
|
|||||||
Sets a highlight group.
|
Sets a highlight group.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{ns_id} Namespace id for this highlight |nvim_create_namespace()|.
|
{ns_id} Namespace id for this highlight
|
||||||
Use 0 to set a highlight group globally |:highlight|.
|
|nvim_create_namespace()|. Use 0 to set a
|
||||||
|
highlight group globally |:highlight|.
|
||||||
{name} Highlight group name, e.g. "ErrorMsg"
|
{name} Highlight group name, e.g. "ErrorMsg"
|
||||||
{val} Highlight definition map, like |synIDattr()|. In
|
{val} Highlight definition map, like |synIDattr()|. In
|
||||||
addition, the following keys are recognized:
|
addition, the following keys are recognized:
|
||||||
• default: Don't override existing definition |:hi-default|
|
• default: Don't override existing definition
|
||||||
• ctermfg: Sets foreground of cterm color |highlight-ctermfg|
|
|:hi-default|
|
||||||
• ctermbg: Sets background of cterm color |highlight-ctermbg|
|
• ctermfg: Sets foreground of cterm color
|
||||||
|
|highlight-ctermfg|
|
||||||
|
• ctermbg: Sets background of cterm color
|
||||||
|
|highlight-ctermbg|
|
||||||
• cterm: cterm attribute map, like
|
• cterm: cterm attribute map, like
|
||||||
|highlight-args|.
|
|highlight-args|. Note: Attributes default to
|
||||||
Note: Attributes default to those set for `gui`
|
those set for `gui` if not set.
|
||||||
if not set.
|
|
||||||
|
|
||||||
nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
|
nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
|
||||||
Sets a global |mapping| for the given mode.
|
Sets a global |mapping| for the given mode.
|
||||||
@ -1628,7 +1631,7 @@ nvim_set_vvar({name}, {value}) *nvim_set_vvar()*
|
|||||||
{value} Variable value
|
{value} Variable value
|
||||||
|
|
||||||
nvim_strwidth({text}) *nvim_strwidth()*
|
nvim_strwidth({text}) *nvim_strwidth()*
|
||||||
Calculates the number of display cells occupied by `text` .
|
Calculates the number of display cells occupied by `text`.
|
||||||
<Tab> counts as one cell.
|
<Tab> counts as one cell.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@ -1880,9 +1883,10 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|
|||||||
{buffer} Buffer handle, or 0 for current buffer
|
{buffer} Buffer handle, or 0 for current buffer
|
||||||
{send_buffer} True if the initial notification should
|
{send_buffer} True if the initial notification should
|
||||||
contain the whole buffer: first
|
contain the whole buffer: first
|
||||||
notification will be `nvim_buf_lines_event`
|
notification will be
|
||||||
. Else the first notification will be
|
`nvim_buf_lines_event`. Else the first
|
||||||
`nvim_buf_changedtick_event` . Not for Lua
|
notification will be
|
||||||
|
`nvim_buf_changedtick_event`. Not for Lua
|
||||||
callbacks.
|
callbacks.
|
||||||
{opts} Optional parameters.
|
{opts} Optional parameters.
|
||||||
• on_lines: Lua callback invoked on change.
|
• on_lines: Lua callback invoked on change.
|
||||||
@ -1938,7 +1942,7 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|
|||||||
|
|
||||||
• utf_sizes: include UTF-32 and UTF-16 size
|
• utf_sizes: include UTF-32 and UTF-16 size
|
||||||
of the replaced region, as args to
|
of the replaced region, as args to
|
||||||
`on_lines` .
|
`on_lines`.
|
||||||
• preview: also attach to command preview
|
• preview: also attach to command preview
|
||||||
(i.e. 'inccommand') events.
|
(i.e. 'inccommand') events.
|
||||||
|
|
||||||
@ -2353,7 +2357,7 @@ nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},
|
|||||||
namespace. All highlights in the same namespace can then be
|
namespace. All highlights in the same namespace can then be
|
||||||
cleared with single call to |nvim_buf_clear_namespace()|. If
|
cleared with single call to |nvim_buf_clear_namespace()|. If
|
||||||
the highlight never will be deleted by an API call, pass
|
the highlight never will be deleted by an API call, pass
|
||||||
`ns_id = -1` .
|
`ns_id = -1`.
|
||||||
|
|
||||||
As a shorthand, `ns_id = 0` can be used to create a new
|
As a shorthand, `ns_id = 0` can be used to create a new
|
||||||
namespace for the highlight, the allocated id is then
|
namespace for the highlight, the allocated id is then
|
||||||
@ -2433,8 +2437,8 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
|
|||||||
nvim_buf_get_extmarks(0, my_ns, [0,0], [-1,-1], {})
|
nvim_buf_get_extmarks(0, my_ns, [0,0], [-1,-1], {})
|
||||||
<
|
<
|
||||||
|
|
||||||
If `end` is less than `start` , traversal works backwards.
|
If `end` is less than `start`, traversal works backwards.
|
||||||
(Useful with `limit` , to get the first marks prior to a given
|
(Useful with `limit`, to get the first marks prior to a given
|
||||||
position.)
|
position.)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@ -2781,7 +2785,7 @@ nvim_win_hide({window}) *nvim_win_hide()*
|
|||||||
|:hide| with a |window-ID|).
|
|:hide| with a |window-ID|).
|
||||||
|
|
||||||
Like |:hide| the buffer becomes hidden unless another window
|
Like |:hide| the buffer becomes hidden unless another window
|
||||||
is editing it, or 'bufhidden' is `unload` , `delete` or `wipe`
|
is editing it, or 'bufhidden' is `unload`, `delete` or `wipe`
|
||||||
as opposed to |:close| or |nvim_win_close|, which will close
|
as opposed to |:close| or |nvim_win_close|, which will close
|
||||||
the buffer.
|
the buffer.
|
||||||
|
|
||||||
@ -3029,7 +3033,7 @@ nvim_win_set_config({window}, {*config}) *nvim_win_set_config()*
|
|||||||
layouts).
|
layouts).
|
||||||
|
|
||||||
When reconfiguring a floating window, absent option keys will
|
When reconfiguring a floating window, absent option keys will
|
||||||
not be changed. `row` / `col` and `relative` must be
|
not be changed. `row`/`col` and `relative` must be
|
||||||
reconfigured together.
|
reconfigured together.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
|
@ -328,11 +328,11 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
|
|||||||
Note:
|
Note:
|
||||||
Each of the configuration options below accepts one of the
|
Each of the configuration options below accepts one of the
|
||||||
following:
|
following:
|
||||||
• `false` : Disable this feature
|
• `false`: Disable this feature
|
||||||
• `true` : Enable this feature, use default settings.
|
• `true`: Enable this feature, use default settings.
|
||||||
• `table` : Enable this feature with overrides. Use an
|
• `table`: Enable this feature with overrides. Use an
|
||||||
empty table to use default values.
|
empty table to use default values.
|
||||||
• `function` : Function with signature (namespace, bufnr)
|
• `function`: Function with signature (namespace, bufnr)
|
||||||
that returns any of the above.
|
that returns any of the above.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
|
@ -563,7 +563,7 @@ buf_request_all({bufnr}, {method}, {params}, {callback})
|
|||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
(function) A function that will cancel all requests which
|
(function) A function that will cancel all requests which
|
||||||
is the same as the one returned from `buf_request` .
|
is the same as the one returned from `buf_request`.
|
||||||
|
|
||||||
*vim.lsp.buf_request_sync()*
|
*vim.lsp.buf_request_sync()*
|
||||||
buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
|
buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
|
||||||
@ -600,9 +600,9 @@ client() *vim.lsp.client*
|
|||||||
{handler} is not specified, If one is not found there,
|
{handler} is not specified, If one is not found there,
|
||||||
then an error will occur. Returns: {status},
|
then an error will occur. Returns: {status},
|
||||||
{[client_id]}. {status} is a boolean indicating if the
|
{[client_id]}. {status} is a boolean indicating if the
|
||||||
notification was successful. If it is `false` , then it
|
notification was successful. If it is `false`, then it
|
||||||
will always be `false` (the client has shutdown). If
|
will always be `false` (the client has shutdown). If
|
||||||
{status} is `true` , the function returns {request_id} as
|
{status} is `true`, the function returns {request_id} as
|
||||||
the second result. You can use this with
|
the second result. You can use this with
|
||||||
`client.cancel_request(request_id)` to cancel the request.
|
`client.cancel_request(request_id)` to cancel the request.
|
||||||
• request_sync(method, params, timeout_ms, bufnr) Sends a
|
• request_sync(method, params, timeout_ms, bufnr) Sends a
|
||||||
@ -612,13 +612,13 @@ client() *vim.lsp.client*
|
|||||||
`err` and `result` come from the |lsp-handler|. On
|
`err` and `result` come from the |lsp-handler|. On
|
||||||
timeout, cancel or error, returns `(nil, err)` where `err`
|
timeout, cancel or error, returns `(nil, err)` where `err`
|
||||||
is a string describing the failure reason. If the request
|
is a string describing the failure reason. If the request
|
||||||
was unsuccessful returns `nil` .
|
was unsuccessful returns `nil`.
|
||||||
• notify(method, params) Sends a notification to an LSP
|
• notify(method, params) Sends a notification to an LSP
|
||||||
server. Returns: a boolean to indicate if the notification
|
server. Returns: a boolean to indicate if the notification
|
||||||
was successful. If it is false, then it will always be
|
was successful. If it is false, then it will always be
|
||||||
false (the client has shutdown).
|
false (the client has shutdown).
|
||||||
• cancel_request(id) Cancels a request with a given request
|
• cancel_request(id) Cancels a request with a given request
|
||||||
id. Returns: same as `notify()` .
|
id. Returns: same as `notify()`.
|
||||||
• stop([force]) Stops a client, optionally with force. By
|
• stop([force]) Stops a client, optionally with force. By
|
||||||
default, it will just ask the server to shutdown without
|
default, it will just ask the server to shutdown without
|
||||||
force. If you request to stop a client which has
|
force. If you request to stop a client which has
|
||||||
@ -639,14 +639,14 @@ client() *vim.lsp.client*
|
|||||||
interaction with the client. See |vim.lsp.rpc.start()|.
|
interaction with the client. See |vim.lsp.rpc.start()|.
|
||||||
• {offset_encoding} (string): The encoding used for
|
• {offset_encoding} (string): The encoding used for
|
||||||
communicating with the server. You can modify this in the
|
communicating with the server. You can modify this in the
|
||||||
`config` 's `on_init` method before text is sent to the
|
`config`'s `on_init` method before text is sent to the
|
||||||
server.
|
server.
|
||||||
• {handlers} (table): The handlers used by the client as
|
• {handlers} (table): The handlers used by the client as
|
||||||
described in |lsp-handler|.
|
described in |lsp-handler|.
|
||||||
• {requests} (table): The current pending requests in flight
|
• {requests} (table): The current pending requests in flight
|
||||||
to the server. Entries are key-value pairs with the key
|
to the server. Entries are key-value pairs with the key
|
||||||
being the request ID while the value is a table with
|
being the request ID while the value is a table with
|
||||||
`type` , `bufnr` , and `method` key-value pairs. `type` is
|
`type`, `bufnr`, and `method` key-value pairs. `type` is
|
||||||
either "pending" for an active request, or "cancel" for a
|
either "pending" for an active request, or "cancel" for a
|
||||||
cancel request.
|
cancel request.
|
||||||
• {config} (table): copy of the table that was passed by the
|
• {config} (table): copy of the table that was passed by the
|
||||||
@ -655,7 +655,7 @@ client() *vim.lsp.client*
|
|||||||
sent on `initialize` describing the server's capabilities.
|
sent on `initialize` describing the server's capabilities.
|
||||||
• {resolved_capabilities} (table): Normalized table of
|
• {resolved_capabilities} (table): Normalized table of
|
||||||
capabilities that we have detected based on the initialize
|
capabilities that we have detected based on the initialize
|
||||||
response from the server in `server_capabilities` .
|
response from the server in `server_capabilities`.
|
||||||
|
|
||||||
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
|
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
|
||||||
Checks whether a client is stopped.
|
Checks whether a client is stopped.
|
||||||
@ -775,7 +775,7 @@ start_client({config}) *vim.lsp.start_client()*
|
|||||||
initiates the LSP client.
|
initiates the LSP client.
|
||||||
{cmd_cwd} (string, default=|getcwd()|)
|
{cmd_cwd} (string, default=|getcwd()|)
|
||||||
Directory to launch the `cmd`
|
Directory to launch the `cmd`
|
||||||
process. Not related to `root_dir` .
|
process. Not related to `root_dir`.
|
||||||
{cmd_env} (table) Environment flags to pass to
|
{cmd_env} (table) Environment flags to pass to
|
||||||
the LSP on spawn. Can be specified
|
the LSP on spawn. Can be specified
|
||||||
using keys like a map or as a list
|
using keys like a map or as a list
|
||||||
@ -800,15 +800,15 @@ start_client({config}) *vim.lsp.start_client()*
|
|||||||
its result.
|
its result.
|
||||||
• Note: To send an empty dictionary
|
• Note: To send an empty dictionary
|
||||||
use
|
use
|
||||||
`{[vim.type_idx]=vim.types.dictionary}`
|
`{[vim.type_idx]=vim.types.dictionary}`,
|
||||||
, else it will be encoded as an
|
else it will be encoded as an
|
||||||
array.
|
array.
|
||||||
{handlers} Map of language server method names
|
{handlers} Map of language server method names
|
||||||
to |lsp-handler|
|
to |lsp-handler|
|
||||||
{settings} Map with language server specific
|
{settings} Map with language server specific
|
||||||
settings. These are returned to the
|
settings. These are returned to the
|
||||||
language server if requested via
|
language server if requested via
|
||||||
`workspace/configuration` . Keys are
|
`workspace/configuration`. Keys are
|
||||||
case-sensitive.
|
case-sensitive.
|
||||||
{commands} table Table that maps string of
|
{commands} table Table that maps string of
|
||||||
clientside commands to user-defined
|
clientside commands to user-defined
|
||||||
@ -821,7 +821,7 @@ start_client({config}) *vim.lsp.start_client()*
|
|||||||
action, code lenses, ...) triggers
|
action, code lenses, ...) triggers
|
||||||
the command.
|
the command.
|
||||||
{init_options} Values to pass in the initialization
|
{init_options} Values to pass in the initialization
|
||||||
request as `initializationOptions` .
|
request as `initializationOptions`.
|
||||||
See `initialize` in the LSP spec.
|
See `initialize` in the LSP spec.
|
||||||
{name} (string, default=client-id) Name in
|
{name} (string, default=client-id) Name in
|
||||||
log messages.
|
log messages.
|
||||||
@ -976,7 +976,7 @@ code_action({context}) *vim.lsp.buf.code_action()*
|
|||||||
• only: (string|nil) LSP `CodeActionKind` used
|
• only: (string|nil) LSP `CodeActionKind` used
|
||||||
to filter the code actions. Most language
|
to filter the code actions. Most language
|
||||||
servers support values like `refactor` or
|
servers support values like `refactor` or
|
||||||
`quickfix` .
|
`quickfix`.
|
||||||
|
|
||||||
See also: ~
|
See also: ~
|
||||||
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
|
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
|
||||||
@ -1007,7 +1007,7 @@ definition() *vim.lsp.buf.definition()*
|
|||||||
document_highlight() *vim.lsp.buf.document_highlight()*
|
document_highlight() *vim.lsp.buf.document_highlight()*
|
||||||
Send request to the server to resolve document highlights for
|
Send request to the server to resolve document highlights for
|
||||||
the current text document position. This request can be
|
the current text document position. This request can be
|
||||||
triggered by a key mapping or by events such as `CursorHold` ,
|
triggered by a key mapping or by events such as `CursorHold`,
|
||||||
e.g.:
|
e.g.:
|
||||||
>
|
>
|
||||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||||
@ -1124,7 +1124,7 @@ range_code_action({context}, {start_pos}, {end_pos})
|
|||||||
• only: (string|nil) LSP `CodeActionKind`
|
• only: (string|nil) LSP `CodeActionKind`
|
||||||
used to filter the code actions. Most
|
used to filter the code actions. Most
|
||||||
language servers support values like
|
language servers support values like
|
||||||
`refactor` or `quickfix` .
|
`refactor` or `quickfix`.
|
||||||
{start_pos} ({number, number}, optional) mark-indexed
|
{start_pos} ({number, number}, optional) mark-indexed
|
||||||
position. Defaults to the start of the last
|
position. Defaults to the start of the last
|
||||||
visual selection.
|
visual selection.
|
||||||
@ -1246,8 +1246,8 @@ 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[] |
|
{lenses} table of lenses to display (`CodeLens[] |
|
||||||
null` )
|
null`)
|
||||||
{bufnr} number
|
{bufnr} number
|
||||||
{client_id} number
|
{client_id} number
|
||||||
|
|
||||||
@ -1259,7 +1259,7 @@ get({bufnr}) *vim.lsp.codelens.get()*
|
|||||||
current buffer.
|
current buffer.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
table ( `CodeLens[]` )
|
table (`CodeLens[]`)
|
||||||
|
|
||||||
*vim.lsp.codelens.on_codelens()*
|
*vim.lsp.codelens.on_codelens()*
|
||||||
on_codelens({err}, {result}, {ctx}, {_})
|
on_codelens({err}, {result}, {ctx}, {_})
|
||||||
@ -1281,8 +1281,8 @@ 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[] |
|
{lenses} table of lenses to store (`CodeLens[] |
|
||||||
null` )
|
null`)
|
||||||
{bufnr} number
|
{bufnr} number
|
||||||
{client_id} number
|
{client_id} number
|
||||||
|
|
||||||
@ -1333,7 +1333,7 @@ Lua module: vim.lsp.util *lsp-util*
|
|||||||
|
|
||||||
*vim.lsp.util.apply_text_document_edit()*
|
*vim.lsp.util.apply_text_document_edit()*
|
||||||
apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
|
apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
|
||||||
Applies a `TextDocumentEdit` , which is a list of changes to a
|
Applies a `TextDocumentEdit`, which is a list of changes to a
|
||||||
single document.
|
single document.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@ -1360,7 +1360,7 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
|
|||||||
|
|
||||||
*vim.lsp.util.apply_workspace_edit()*
|
*vim.lsp.util.apply_workspace_edit()*
|
||||||
apply_workspace_edit({workspace_edit}, {offset_encoding})
|
apply_workspace_edit({workspace_edit}, {offset_encoding})
|
||||||
Applies a `WorkspaceEdit` .
|
Applies a `WorkspaceEdit`.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{workspace_edit} table `WorkspaceEdit`
|
{workspace_edit} table `WorkspaceEdit`
|
||||||
@ -1408,13 +1408,13 @@ convert_input_to_markdown_lines({input}, {contents})
|
|||||||
Converts any of `MarkedString` | `MarkedString[]` |
|
Converts any of `MarkedString` | `MarkedString[]` |
|
||||||
`MarkupContent` into a list of lines containing valid
|
`MarkupContent` into a list of lines containing valid
|
||||||
markdown. Useful to populate the hover window for
|
markdown. Useful to populate the hover window for
|
||||||
`textDocument/hover` , for parsing the result of
|
`textDocument/hover`, for parsing the result of
|
||||||
`textDocument/signatureHelp` , and potentially others.
|
`textDocument/signatureHelp`, and potentially others.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{input} ( `MarkedString` | `MarkedString[]` |
|
{input} (`MarkedString` | `MarkedString[]` |
|
||||||
`MarkupContent` )
|
`MarkupContent`)
|
||||||
{contents} (table, optional, default `{}` ) List of
|
{contents} (table, optional, default `{}`) List of
|
||||||
strings to extend with converted lines
|
strings to extend with converted lines
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
@ -1475,7 +1475,7 @@ jump_to_location({location}, {offset_encoding})
|
|||||||
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)
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
@ -1491,8 +1491,8 @@ locations_to_items({locations}, {offset_encoding})
|
|||||||
|setqflist()| or |setloclist()|.
|
|setqflist()| or |setloclist()|.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{locations} table list of `Location` s or
|
{locations} table list of `Location`s or
|
||||||
`LocationLink` s
|
`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
|
||||||
|
|
||||||
@ -1526,7 +1526,7 @@ make_floating_popup_options({width}, {height}, {opts})
|
|||||||
• border (string or table) override `border`
|
• border (string or table) override `border`
|
||||||
• focusable (string or table) override
|
• focusable (string or table) override
|
||||||
`focusable`
|
`focusable`
|
||||||
• zindex (string or table) override `zindex` ,
|
• zindex (string or table) override `zindex`,
|
||||||
defaults to 50
|
defaults to 50
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
@ -1566,7 +1566,7 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
|
|||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
{ textDocument = { uri = `current_file_uri` }, range = {
|
{ textDocument = { uri = `current_file_uri` }, range = {
|
||||||
start = `start_position` , end = `end_position` } }
|
start = `start_position`, end = `end_position` } }
|
||||||
|
|
||||||
*vim.lsp.util.make_position_params()*
|
*vim.lsp.util.make_position_params()*
|
||||||
make_position_params({window}, {offset_encoding})
|
make_position_params({window}, {offset_encoding})
|
||||||
@ -1590,9 +1590,9 @@ make_position_params({window}, {offset_encoding})
|
|||||||
make_range_params({window}, {offset_encoding})
|
make_range_params({window}, {offset_encoding})
|
||||||
Using the current position in the current buffer, creates an
|
Using the current position in the current buffer, creates an
|
||||||
object that can be used as a building block for several LSP
|
object that can be used as a building block for several LSP
|
||||||
requests, such as `textDocument/codeAction` ,
|
requests, such as `textDocument/codeAction`,
|
||||||
`textDocument/colorPresentation` ,
|
`textDocument/colorPresentation`,
|
||||||
`textDocument/rangeFormatting` .
|
`textDocument/rangeFormatting`.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{window} (optional, number): window handle or 0
|
{window} (optional, number): window handle or 0
|
||||||
@ -1603,7 +1603,7 @@ make_range_params({window}, {offset_encoding})
|
|||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
{ textDocument = { uri = `current_file_uri` }, range = {
|
{ textDocument = { uri = `current_file_uri` }, range = {
|
||||||
start = `current_position` , end = `current_position` } }
|
start = `current_position`, end = `current_position` } }
|
||||||
|
|
||||||
*vim.lsp.util.make_text_document_params()*
|
*vim.lsp.util.make_text_document_params()*
|
||||||
make_text_document_params({bufnr})
|
make_text_document_params({bufnr})
|
||||||
@ -1657,8 +1657,8 @@ open_floating_preview({contents}, {syntax}, {opts})
|
|||||||
closes the floating window
|
closes the floating window
|
||||||
• focusable: (boolean, default true) Make
|
• focusable: (boolean, default true) Make
|
||||||
float focusable
|
float focusable
|
||||||
• focus: (boolean, default true) If `true` ,
|
• focus: (boolean, default true) If `true`,
|
||||||
and if {focusable} is also `true` , focus an
|
and if {focusable} is also `true`, focus an
|
||||||
existing floating window with the same
|
existing floating window with the same
|
||||||
{focus_id}
|
{focus_id}
|
||||||
|
|
||||||
@ -1757,7 +1757,7 @@ text_document_completion_list_to_complete_items({result}, {prefix})
|
|||||||
Parameters: ~
|
Parameters: ~
|
||||||
{result} The result of a `textDocument/completion` call,
|
{result} The result of a `textDocument/completion` call,
|
||||||
e.g. from |vim.lsp.buf.completion()|, which may
|
e.g. from |vim.lsp.buf.completion()|, which may
|
||||||
be one of `CompletionItem[]` , `CompletionList`
|
be one of `CompletionItem[]`, `CompletionList`
|
||||||
or `null`
|
or `null`
|
||||||
{prefix} (string) the prefix to filter the completion
|
{prefix} (string) the prefix to filter the completion
|
||||||
items
|
items
|
||||||
|
@ -1418,7 +1418,7 @@ deep_equal({a}, {b}) *vim.deep_equal()*
|
|||||||
{b} second value
|
{b} second value
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
`true` if values are equals, else `false` .
|
`true` if values are equals, else `false`.
|
||||||
|
|
||||||
deepcopy({orig}) *vim.deepcopy()*
|
deepcopy({orig}) *vim.deepcopy()*
|
||||||
Returns a deep copy of the given object. Non-table objects are
|
Returns a deep copy of the given object. Non-table objects are
|
||||||
@ -1435,7 +1435,7 @@ deepcopy({orig}) *vim.deepcopy()*
|
|||||||
New table of copied keys and (nested) values.
|
New table of copied keys and (nested) values.
|
||||||
|
|
||||||
endswith({s}, {suffix}) *vim.endswith()*
|
endswith({s}, {suffix}) *vim.endswith()*
|
||||||
Tests if `s` ends with `suffix` .
|
Tests if `s` ends with `suffix`.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{s} (string) a string
|
{s} (string) a string
|
||||||
@ -1539,7 +1539,7 @@ split({s}, {sep}, {kwargs}) *vim.split()*
|
|||||||
|vim.gsplit()|
|
|vim.gsplit()|
|
||||||
|
|
||||||
startswith({s}, {prefix}) *vim.startswith()*
|
startswith({s}, {prefix}) *vim.startswith()*
|
||||||
Tests if `s` starts with `prefix` .
|
Tests if `s` starts with `prefix`.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{s} (string) a string
|
{s} (string) a string
|
||||||
@ -1556,7 +1556,7 @@ tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
|
|||||||
{o} table The table to add the reverse to.
|
{o} table The table to add the reverse to.
|
||||||
|
|
||||||
tbl_contains({t}, {value}) *vim.tbl_contains()*
|
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 to check
|
{t} Table to check
|
||||||
@ -1566,7 +1566,7 @@ tbl_contains({t}, {value}) *vim.tbl_contains()*
|
|||||||
true if `t` contains `value`
|
true if `t` contains `value`
|
||||||
|
|
||||||
tbl_count({t}) *vim.tbl_count()*
|
tbl_count({t}) *vim.tbl_count()*
|
||||||
Counts the number of non-nil values in table `t` .
|
Counts the number of non-nil values in table `t`.
|
||||||
>
|
>
|
||||||
|
|
||||||
vim.tbl_count({ a=1, b=2 }) => 2
|
vim.tbl_count({ a=1, b=2 }) => 2
|
||||||
@ -1651,7 +1651,7 @@ tbl_islist({t}) *vim.tbl_islist()*
|
|||||||
{t} Table
|
{t} Table
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
`true` if array-like table, else `false` .
|
`true` if array-like table, else `false`.
|
||||||
|
|
||||||
tbl_keys({t}) *vim.tbl_keys()*
|
tbl_keys({t}) *vim.tbl_keys()*
|
||||||
Return a list of all keys used in a table. However, the order
|
Return a list of all keys used in a table. However, the order
|
||||||
@ -1813,7 +1813,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.
|
||||||
Defaults to `Input:` .
|
Defaults to `Input:`.
|
||||||
• default (string|nil) Default reply to the
|
• default (string|nil) Default reply to the
|
||||||
input
|
input
|
||||||
• completion (string|nil) Specifies type of
|
• completion (string|nil) Specifies type of
|
||||||
@ -1856,16 +1856,16 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
|
|||||||
Defaults to `Select one of:`
|
Defaults to `Select one of:`
|
||||||
• format_item (function item -> text)
|
• format_item (function item -> text)
|
||||||
Function to format an individual item from
|
Function to format an individual item from
|
||||||
`items` . Defaults to `tostring` .
|
`items`. Defaults to `tostring`.
|
||||||
• kind (string|nil) Arbitrary hint string
|
• kind (string|nil) Arbitrary hint string
|
||||||
indicating the item shape. Plugins
|
indicating the item shape. Plugins
|
||||||
reimplementing `vim.ui.select` may wish to
|
reimplementing `vim.ui.select` may wish to
|
||||||
use this to infer the structure or
|
use this to infer the structure or
|
||||||
semantics of `items` , or the context in
|
semantics of `items`, or the context in
|
||||||
which select() was called.
|
which select() was called.
|
||||||
{on_choice} function ((item|nil, idx|nil) -> ()) Called
|
{on_choice} function ((item|nil, idx|nil) -> ()) Called
|
||||||
once the user made a choice. `idx` is the
|
once the user made a choice. `idx` is the
|
||||||
1-based index of `item` within `item` . `nil`
|
1-based index of `item` within `item`. `nil`
|
||||||
if the user aborted the dialog.
|
if the user aborted the dialog.
|
||||||
|
|
||||||
|
|
||||||
@ -1990,9 +1990,9 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
|
|||||||
vim.keymap.set('n', 'asdf', require('jkl').my_fun)
|
vim.keymap.set('n', 'asdf', require('jkl').my_fun)
|
||||||
<
|
<
|
||||||
|
|
||||||
the require('jkl') gets evaluated during this call in order to
|
the require('jkl )` gets evaluated during this call in order to access the
|
||||||
access the function. If you want to avoid this cost at startup
|
function. If you want to avoid this cost at startup you can
|
||||||
you can wrap it in a function, for example: >
|
wrap it in a function, for example: >
|
||||||
|
|
||||||
vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end)
|
vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end)
|
||||||
<
|
<
|
||||||
@ -2014,7 +2014,7 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
|
|||||||
result of Lua expr maps.
|
result of Lua expr maps.
|
||||||
• remap: (boolean) Make the mapping recursive.
|
• remap: (boolean) Make the mapping recursive.
|
||||||
This is the inverse of the "noremap" option from
|
This is the inverse of the "noremap" option from
|
||||||
|nvim_set_keymap()|. Default `false` .
|
|nvim_set_keymap()|. Default `false`.
|
||||||
|
|
||||||
See also: ~
|
See also: ~
|
||||||
|nvim_set_keymap()|
|
|nvim_set_keymap()|
|
||||||
|
@ -468,7 +468,7 @@ parse_query({lang}, {query}) *parse_query()*
|
|||||||
|
|
||||||
Exposes `info` and `captures` with additional context about {query}.
|
Exposes `info` and `captures` with additional context about {query}.
|
||||||
• `captures` contains the list of unique capture names defined
|
• `captures` contains the list of unique capture names defined
|
||||||
in {query}. - `info.captures` also points to `captures` .
|
in {query}. -`info.captures` also points to `captures`.
|
||||||
• `info.patterns` contains information about predicates.
|
• `info.patterns` contains information about predicates.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@ -528,8 +528,8 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
|
|||||||
a table mapping capture indices to nodes, and metadata from
|
a table mapping capture indices to nodes, and metadata from
|
||||||
any directives processing the match. If the query has more
|
any directives processing the match. If the query has more
|
||||||
than one pattern the capture table might be sparse, and e.g.
|
than one pattern the capture table might be sparse, and e.g.
|
||||||
`pairs()` method should be used over `ipairs` . Here an
|
`pairs()` method should be used over `ipairs`. Here an example
|
||||||
example iterating over all captures in every match:
|
iterating over all captures in every match:
|
||||||
>
|
>
|
||||||
|
|
||||||
for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, first, last) do
|
for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, first, last) do
|
||||||
|
@ -343,14 +343,6 @@ def self_or_child(n):
|
|||||||
return n.childNodes[0]
|
return n.childNodes[0]
|
||||||
|
|
||||||
|
|
||||||
def clean_text(text):
|
|
||||||
"""Cleans text.
|
|
||||||
|
|
||||||
Only cleans superfluous whitespace at the moment.
|
|
||||||
"""
|
|
||||||
return ' '.join(text.split()).strip()
|
|
||||||
|
|
||||||
|
|
||||||
def clean_lines(text):
|
def clean_lines(text):
|
||||||
"""Removes superfluous lines.
|
"""Removes superfluous lines.
|
||||||
|
|
||||||
@ -371,12 +363,12 @@ def get_text(n, preformatted=False):
|
|||||||
if n.nodeName == 'computeroutput':
|
if n.nodeName == 'computeroutput':
|
||||||
for node in n.childNodes:
|
for node in n.childNodes:
|
||||||
text += get_text(node)
|
text += get_text(node)
|
||||||
return '`{}` '.format(text)
|
return '`{}`'.format(text)
|
||||||
for node in n.childNodes:
|
for node in n.childNodes:
|
||||||
if node.nodeType == node.TEXT_NODE:
|
if node.nodeType == node.TEXT_NODE:
|
||||||
text += node.data if preformatted else clean_text(node.data)
|
text += node.data
|
||||||
elif node.nodeType == node.ELEMENT_NODE:
|
elif node.nodeType == node.ELEMENT_NODE:
|
||||||
text += ' ' + get_text(node, preformatted)
|
text += get_text(node, preformatted)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user