build(lua2dox): add parenthesis around parameter types in documentation (#18532)

This will check if the string after the variable in a @param is either
"number", "string", "table", "boolean" and "function" and if so add a
parenthesis around it. This will help separate the variable type with
the following text. Had all our functions been annotated with emmylua
then a more robust solution might have been preferable (such as always
assuming the third string is parameter type without making any checks).
I believe however this is a clear improvement over the current situation
and will suffice for now.
This commit is contained in:
dundargoc
2022-05-12 16:02:46 +02:00
committed by GitHub
parent 2bbd588e73
commit a1b663cce8
5 changed files with 264 additions and 235 deletions

View File

@@ -336,8 +336,8 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
that returns any of the above. that returns any of the above.
Parameters: ~ Parameters: ~
{opts} table|nil When omitted or "nil", retrieve the {opts} (table|nil) When omitted or "nil", retrieve
current configuration. Otherwise, a the current configuration. Otherwise, a
configuration table with the following keys: configuration table with the following keys:
• underline: (default true) Use underline for • underline: (default true) Use underline for
diagnostics. Options: diagnostics. Options:
@@ -401,7 +401,7 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
displayed before lower severities (e.g. displayed before lower severities (e.g.
ERROR is displayed before WARN). Options: ERROR is displayed before WARN). Options:
• reverse: (boolean) Reverse sort order • reverse: (boolean) Reverse sort order
{namespace} number|nil Update the options for the given {namespace} (number|nil) Update the options for the given
namespace. When omitted, update the global namespace. When omitted, update the global
diagnostic options. diagnostic options.
@@ -409,28 +409,28 @@ disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer. Disable diagnostics in the given buffer.
Parameters: ~ Parameters: ~
{bufnr} number|nil Buffer number, or 0 for current {bufnr} (number|nil) Buffer number, or 0 for current
buffer. When omitted, disable diagnostics in buffer. When omitted, disable diagnostics in
all buffers. all buffers.
{namespace} number|nil Only disable diagnostics for the {namespace} (number|nil) Only disable diagnostics for the
given namespace. given namespace.
enable({bufnr}, {namespace}) *vim.diagnostic.enable()* enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer. Enable diagnostics in the given buffer.
Parameters: ~ Parameters: ~
{bufnr} number|nil Buffer number, or 0 for current {bufnr} (number|nil) Buffer number, or 0 for current
buffer. When omitted, enable diagnostics in buffer. When omitted, enable diagnostics in
all buffers. all buffers.
{namespace} number|nil Only enable diagnostics for the {namespace} (number|nil) Only enable diagnostics for the
given namespace. given namespace.
fromqflist({list}) *vim.diagnostic.fromqflist()* fromqflist({list}) *vim.diagnostic.fromqflist()*
Convert a list of quickfix items to a list of diagnostics. Convert a list of quickfix items to a list of diagnostics.
Parameters: ~ Parameters: ~
{list} table A list of quickfix items from |getqflist()| {list} (table) A list of quickfix items from
or |getloclist()|. |getqflist()| or |getloclist()|.
Return: ~ Return: ~
array of diagnostics |diagnostic-structure| array of diagnostics |diagnostic-structure|
@@ -439,9 +439,10 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics. Get current diagnostics.
Parameters: ~ Parameters: ~
{bufnr} number|nil Buffer number to get diagnostics from. {bufnr} (number|nil) Buffer number to get diagnostics
Use 0 for current buffer or nil for all buffers. from. Use 0 for current buffer or nil for all
{opts} table|nil A table with the following keys: buffers.
{opts} (table|nil) A table with the following keys:
• namespace: (number) Limit diagnostics to the • namespace: (number) Limit diagnostics to the
given namespace. given namespace.
• lnum: (number) Limit diagnostics to the given • lnum: (number) Limit diagnostics to the given
@@ -449,67 +450,68 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
• severity: See |diagnostic-severity|. • severity: See |diagnostic-severity|.
Return: ~ Return: ~
table A list of diagnostic items |diagnostic-structure|. (table) A list of diagnostic items |diagnostic-structure|.
get_namespace({namespace}) *vim.diagnostic.get_namespace()* get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata. Get namespace metadata.
Parameters: ~ Parameters: ~
{namespace} number Diagnostic namespace {namespace} (number) Diagnostic namespace
Return: ~ Return: ~
table Namespace metadata (table) Namespace metadata
get_namespaces() *vim.diagnostic.get_namespaces()* get_namespaces() *vim.diagnostic.get_namespaces()*
Get current diagnostic namespaces. Get current diagnostic namespaces.
Return: ~ Return: ~
table A list of active diagnostic namespaces (table) A list of active diagnostic namespaces
|vim.diagnostic|. |vim.diagnostic|.
get_next({opts}) *vim.diagnostic.get_next()* get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position. Get the next diagnostic closest to the cursor position.
Parameters: ~ Parameters: ~
{opts} table See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
table Next diagnostic (table) Next diagnostic
get_next_pos({opts}) *vim.diagnostic.get_next_pos()* get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
Return the position of the next diagnostic in the current Return the position of the next diagnostic in the current
buffer. buffer.
Parameters: ~ Parameters: ~
{opts} table See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
table Next diagnostic position as a (row, col) tuple. (table) Next diagnostic position as a (row, col) tuple.
get_prev({opts}) *vim.diagnostic.get_prev()* get_prev({opts}) *vim.diagnostic.get_prev()*
Get the previous diagnostic closest to the cursor position. Get the previous diagnostic closest to the cursor position.
Parameters: ~ Parameters: ~
{opts} table See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
table Previous diagnostic (table) Previous diagnostic
get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()* get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
Return the position of the previous diagnostic in the current Return the position of the previous diagnostic in the current
buffer. buffer.
Parameters: ~ Parameters: ~
{opts} table See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~ Return: ~
table Previous diagnostic position as a (row, col) tuple. (table) Previous diagnostic position as a (row, col)
tuple.
goto_next({opts}) *vim.diagnostic.goto_next()* goto_next({opts}) *vim.diagnostic.goto_next()*
Move to the next diagnostic. Move to the next diagnostic.
Parameters: ~ Parameters: ~
{opts} table|nil Configuration table with the following {opts} (table|nil) Configuration table with the following
keys: keys:
• namespace: (number) Only consider diagnostics • namespace: (number) Only consider diagnostics
from the given namespace. from the given namespace.
@@ -533,7 +535,7 @@ goto_prev({opts}) *vim.diagnostic.goto_prev()*
Move to the previous diagnostic in the current buffer. Move to the previous diagnostic in the current buffer.
Parameters: ~ Parameters: ~
{opts} table See |vim.diagnostic.goto_next()| {opts} (table) See |vim.diagnostic.goto_next()|
hide({namespace}, {bufnr}) *vim.diagnostic.hide()* hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics. Hide currently displayed diagnostics.
@@ -547,10 +549,10 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|. |vim.diagnostic.disable()|.
Parameters: ~ Parameters: ~
{namespace} number|nil Diagnostic namespace. When {namespace} (number|nil) Diagnostic namespace. When
omitted, hide diagnostics from all omitted, hide diagnostics from all
namespaces. namespaces.
{bufnr} number|nil Buffer number, or 0 for current {bufnr} (number|nil) Buffer number, or 0 for current
buffer. When omitted, hide diagnostics in all buffer. When omitted, hide diagnostics in all
buffers. buffers.
@@ -573,16 +575,16 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
< <
Parameters: ~ Parameters: ~
{str} string String to parse diagnostics from. {str} (string) String to parse diagnostics from.
{pat} string Lua pattern with capture groups. {pat} (string) Lua pattern with capture groups.
{groups} table List of fields in a {groups} (table) List of fields in a
|diagnostic-structure| to associate with |diagnostic-structure| to associate with
captures from {pat}. captures from {pat}.
{severity_map} table A table mapping the severity field {severity_map} (table) A table mapping the severity field
from {groups} with an item from from {groups} with an item from
|vim.diagnostic.severity|. |vim.diagnostic.severity|.
{defaults} table|nil Table of default values for any {defaults} (table|nil) Table of default values for
fields not listed in {groups}. When any fields not listed in {groups}. When
omitted, numeric values default to 0 and omitted, numeric values default to 0 and
"severity" defaults to ERROR. "severity" defaults to ERROR.
@@ -594,7 +596,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window. Show diagnostics in a floating window.
Parameters: ~ Parameters: ~
{opts} table|nil Configuration table with the same keys {opts} (table|nil) Configuration table with the same keys
as |vim.lsp.util.open_floating_preview()| in as |vim.lsp.util.open_floating_preview()| in
addition to the following: addition to the following:
• bufnr: (number) Buffer number to show • bufnr: (number) Buffer number to show
@@ -665,10 +667,10 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
|vim.diagnostic.hide()|. |vim.diagnostic.hide()|.
Parameters: ~ Parameters: ~
{namespace} number|nil Diagnostic namespace. When {namespace} (number|nil) Diagnostic namespace. When
omitted, remove diagnostics from all omitted, remove diagnostics from all
namespaces. namespaces.
{bufnr} number|nil Remove diagnostics for the given {bufnr} (number|nil) Remove diagnostics for the given
buffer. When omitted, diagnostics are removed buffer. When omitted, diagnostics are removed
for all buffers. for all buffers.
@@ -676,18 +678,18 @@ set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer. Set diagnostics for the given namespace and buffer.
Parameters: ~ Parameters: ~
{namespace} number The diagnostic namespace {namespace} (number) The diagnostic namespace
{bufnr} number Buffer number {bufnr} (number) Buffer number
{diagnostics} table A list of diagnostic items {diagnostics} (table) A list of diagnostic items
|diagnostic-structure| |diagnostic-structure|
{opts} table|nil Display options to pass to {opts} (table|nil) Display options to pass to
|vim.diagnostic.show()| |vim.diagnostic.show()|
setloclist({opts}) *vim.diagnostic.setloclist()* setloclist({opts}) *vim.diagnostic.setloclist()*
Add buffer diagnostics to the location list. Add buffer diagnostics to the location list.
Parameters: ~ Parameters: ~
{opts} table|nil Configuration table with the following {opts} (table|nil) Configuration table with the following
keys: keys:
• namespace: (number) Only add diagnostics from • namespace: (number) Only add diagnostics from
the given namespace. the given namespace.
@@ -703,7 +705,7 @@ setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list. Add all diagnostics to the quickfix list.
Parameters: ~ Parameters: ~
{opts} table|nil Configuration table with the following {opts} (table|nil) Configuration table with the following
keys: keys:
• namespace: (number) Only add diagnostics from • namespace: (number) Only add diagnostics from
the given namespace. the given namespace.
@@ -718,20 +720,20 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer. Display diagnostics for the given namespace and buffer.
Parameters: ~ Parameters: ~
{namespace} number|nil Diagnostic namespace. When {namespace} (number|nil) Diagnostic namespace. When
omitted, show diagnostics from all omitted, show diagnostics from all
namespaces. namespaces.
{bufnr} number|nil Buffer number, or 0 for current {bufnr} (number|nil) Buffer number, or 0 for
buffer. When omitted, show diagnostics in current buffer. When omitted, show
all buffers. diagnostics in all buffers.
{diagnostics} table|nil The diagnostics to display. When {diagnostics} (table|nil) The diagnostics to display.
omitted, use the saved diagnostics for the When omitted, use the saved diagnostics for
given namespace and buffer. This can be the given namespace and buffer. This can be
used to display a list of diagnostics used to display a list of diagnostics
without saving them or to display only a without saving them or to display only a
subset of diagnostics. May not be used when subset of diagnostics. May not be used when
{namespace} or {bufnr} is nil. {namespace} or {bufnr} is nil.
{opts} table|nil Display options. See {opts} (table|nil) Display options. See
|vim.diagnostic.config()|. |vim.diagnostic.config()|.
toqflist({diagnostics}) *vim.diagnostic.toqflist()* toqflist({diagnostics}) *vim.diagnostic.toqflist()*
@@ -739,7 +741,7 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()*
can be passed to |setqflist()| or |setloclist()|. can be passed to |setqflist()| or |setloclist()|.
Parameters: ~ Parameters: ~
{diagnostics} table List of diagnostics {diagnostics} (table) List of diagnostics
|diagnostic-structure|. |diagnostic-structure|.
Return: ~ Return: ~

View File

@@ -495,8 +495,8 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
notification. notification.
Parameters: ~ Parameters: ~
{bufnr} number Buffer handle, or 0 for current {bufnr} (number) Buffer handle, or 0 for current
{client_id} number Client id {client_id} (number) Client id
buf_get_clients({bufnr}) *vim.lsp.buf_get_clients()* buf_get_clients({bufnr}) *vim.lsp.buf_get_clients()*
Gets a map of client_id:client pairs for the given buffer, Gets a map of client_id:client pairs for the given buffer,
@@ -668,11 +668,11 @@ for_each_buffer_client({bufnr}, {fn})
Invokes a function for each LSP client attached to a buffer. Invokes a function for each LSP client attached to a buffer.
Parameters: ~ Parameters: ~
{bufnr} number Buffer number {bufnr} (number) Buffer number
{fn} function Function to run on each client attached {fn} (function) Function to run on each client
to buffer {bufnr}. The function takes the client, attached to buffer {bufnr}. The function takes
client ID, and buffer number as arguments. the client, client ID, and buffer number as
Example: > arguments. Example: >
vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr) vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr)
print(vim.inspect(client)) print(vim.inspect(client))
@@ -690,7 +690,7 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`. 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
Parameters: ~ Parameters: ~
{opts} table options for customizing the formatting {opts} (table) options for customizing the formatting
expression which takes the following optional expression which takes the following optional
keys: keys:
• timeout_ms (default 500ms). The timeout period • timeout_ms (default 500ms). The timeout period
@@ -707,7 +707,7 @@ get_buffers_by_client_id({client_id})
Returns list of buffers attached to client_id. Returns list of buffers attached to client_id.
Parameters: ~ Parameters: ~
{client_id} number client id {client_id} (number) client id
Return: ~ Return: ~
list of buffer ids list of buffer ids
@@ -717,7 +717,7 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
client may not yet be fully initialized. client may not yet be fully initialized.
Parameters: ~ Parameters: ~
{client_id} number client id {client_id} (number) client id
Return: ~ Return: ~
|vim.lsp.client| object, or nil |vim.lsp.client| object, or nil
@@ -820,7 +820,7 @@ start_client({config}) *vim.lsp.start_client()*
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
functions. Commands passed to functions. Commands passed to
start_client take precedence over the start_client take precedence over the
@@ -908,10 +908,10 @@ start_client({config}) *vim.lsp.start_client()*
kill -15. If set to false, nvim kill -15. If set to false, nvim
exits immediately after sending the exits immediately after sending the
'shutdown' request to the server. 'shutdown' request to the server.
{root_dir} string Directory where the LSP server {root_dir} (string) Directory where the LSP
will base its workspaceFolders, server will base its
rootUri, and rootPath on workspaceFolders, rootUri, and
initialization. rootPath on initialization.
Return: ~ Return: ~
Client id. |vim.lsp.get_client_by_id()| Note: client may Client id. |vim.lsp.get_client_by_id()| Note: client may
@@ -935,7 +935,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
Parameters: ~ Parameters: ~
{client_id} client id or |vim.lsp.client| object, or list {client_id} client id or |vim.lsp.client| object, or list
thereof thereof
{force} boolean (optional) shutdown forcefully {force} (boolean) (optional) shutdown forcefully
tagfunc({...}) *vim.lsp.tagfunc()* tagfunc({...}) *vim.lsp.tagfunc()*
Provides an interface between the built-in client and Provides an interface between the built-in client and
@@ -980,7 +980,7 @@ code_action({options}) *vim.lsp.buf.code_action()*
position. position.
Parameters: ~ Parameters: ~
{options} table|nil Optional table which holds the {options} (table|nil) Optional table which holds the
following optional fields: following optional fields:
• context (table|nil): Corresponds to `CodeActionContext` of the LSP specification: • context (table|nil): Corresponds to `CodeActionContext` of the LSP specification:
• diagnostics (table|nil): LSP`Diagnostic[]` . Inferred from the current position if not • diagnostics (table|nil): LSP`Diagnostic[]` . Inferred from the current position if not
@@ -1048,7 +1048,7 @@ execute_command({command_params}) *vim.lsp.buf.execute_command()*
Executes an LSP server command. Executes an LSP server command.
Parameters: ~ Parameters: ~
{command_params} table A valid `ExecuteCommandParams` {command_params} (table) A valid `ExecuteCommandParams`
object object
See also: ~ See also: ~
@@ -1146,7 +1146,7 @@ formatting_sync({options}, {timeout_ms})
< <
Parameters: ~ Parameters: ~
{options} table|nil with valid `FormattingOptions` {options} (table|nil) with valid `FormattingOptions`
entries entries
{timeout_ms} (number) Request timeout {timeout_ms} (number) Request timeout
@@ -1180,7 +1180,7 @@ range_code_action({context}, {start_pos}, {end_pos})
Performs |vim.lsp.buf.code_action()| for a given range. Performs |vim.lsp.buf.code_action()| for a given range.
Parameters: ~ Parameters: ~
{context} table|nil `CodeActionContext` of the LSP specification: {context} (table|nil) `CodeActionContext` of the LSP specification:
• diagnostics: (table|nil) LSP`Diagnostic[]` . Inferred from the current position if not • diagnostics: (table|nil) LSP`Diagnostic[]` . Inferred from the current position if not
provided. provided.
• only: (table|nil) List of LSP • only: (table|nil) List of LSP
@@ -1227,10 +1227,10 @@ rename({new_name}, {options}) *vim.lsp.buf.rename()*
Renames all references to the symbol under the cursor. Renames all references to the symbol under the cursor.
Parameters: ~ Parameters: ~
{new_name} string|nil If not provided, the user will be {new_name} (string|nil) If not provided, the user will be
prompted for a new name using prompted for a new name using
|vim.ui.input()|. |vim.ui.input()|.
{options} table|nil additional options {options} (table|nil) additional options
• filter (function|nil): Predicate to filter • filter (function|nil): Predicate to filter
clients used for rename. Receives the clients used for rename. Receives the
attached clients as argument and must return attached clients as argument and must return
@@ -1275,7 +1275,7 @@ get_namespace({client_id}) *vim.lsp.diagnostic.get_namespace()*
|vim.diagnostic|. |vim.diagnostic|.
Parameters: ~ Parameters: ~
{client_id} number The id of the LSP client {client_id} (number) The id of the LSP client
*vim.lsp.diagnostic.on_publish_diagnostics()* *vim.lsp.diagnostic.on_publish_diagnostics()*
on_publish_diagnostics({_}, {result}, {ctx}, {config}) on_publish_diagnostics({_}, {result}, {ctx}, {config})
@@ -1305,7 +1305,7 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config})
< <
Parameters: ~ Parameters: ~
{config} table Configuration table (see {config} (table) Configuration table (see
|vim.diagnostic.config()|). |vim.diagnostic.config()|).
@@ -1316,20 +1316,20 @@ 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)
get({bufnr}) *vim.lsp.codelens.get()* get({bufnr}) *vim.lsp.codelens.get()*
Return all lenses for the given buffer Return all lenses for the given buffer
Parameters: ~ Parameters: ~
{bufnr} number Buffer number. 0 can be used for the {bufnr} (number) Buffer number. 0 can be used for the
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}, {_})
@@ -1351,10 +1351,10 @@ 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)
============================================================================== ==============================================================================
@@ -1372,7 +1372,7 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
< <
Parameters: ~ Parameters: ~
{config} table Configuration table. {config} (table) Configuration table.
• border: (default=nil) • border: (default=nil)
• Add borders to the floating window • Add borders to the floating window
• See |nvim_open_win()| • See |nvim_open_win()|
@@ -1392,7 +1392,7 @@ signature_help({_}, {result}, {ctx}, {config})
< <
Parameters: ~ Parameters: ~
{config} table Configuration table. {config} (table) Configuration table.
• border: (default=nil) • border: (default=nil)
• Add borders to the floating window • Add borders to the floating window
• See |vim.api.nvim_open_win()| • See |vim.api.nvim_open_win()|
@@ -1420,9 +1420,9 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Applies a list of text edits to a buffer. Applies a list of text edits to a buffer.
Parameters: ~ Parameters: ~
{text_edits} table list of `TextEdit` objects {text_edits} (table) list of `TextEdit` objects
{bufnr} number Buffer id {bufnr} (number) Buffer id
{offset_encoding} string utf-8|utf-16|utf-32 {offset_encoding} (string) utf-8|utf-16|utf-32
See also: ~ See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
@@ -1432,24 +1432,24 @@ apply_workspace_edit({workspace_edit}, {offset_encoding})
Applies a `WorkspaceEdit`. Applies a `WorkspaceEdit`.
Parameters: ~ Parameters: ~
{workspace_edit} table `WorkspaceEdit` {workspace_edit} (table) `WorkspaceEdit`
{offset_encoding} string utf-8|utf-16|utf-32 (required) {offset_encoding} (string) utf-8|utf-16|utf-32 (required)
buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()* buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer. Removes document highlights from a buffer.
Parameters: ~ Parameters: ~
{bufnr} number Buffer id {bufnr} (number) Buffer id
*vim.lsp.util.buf_highlight_references()* *vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {offset_encoding}) buf_highlight_references({bufnr}, {references}, {offset_encoding})
Shows a list of document highlights for a certain buffer. Shows a list of document highlights for a certain buffer.
Parameters: ~ Parameters: ~
{bufnr} number Buffer id {bufnr} (number) Buffer id
{references} table List of `DocumentHighlight` {references} (table) List of `DocumentHighlight`
objects to highlight objects to highlight
{offset_encoding} string One of "utf-8", "utf-16", {offset_encoding} (string) One of "utf-8", "utf-16",
"utf-32". "utf-32".
See also: ~ See also: ~
@@ -1464,9 +1464,9 @@ character_offset({buf}, {row}, {col}, {offset_encoding})
{buf} buffer id (0 for current) {buf} buffer id (0 for current)
{row} 0-indexed line {row} 0-indexed line
{col} 0-indexed byte offset in line {col} 0-indexed byte offset in line
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults {offset_encoding} (string) utf-8|utf-16|utf-32|nil
to `offset_encoding` of first client of defaults to `offset_encoding` of first
`buf` client of `buf`
Return: ~ Return: ~
(number, number) `offset_encoding` index of the character (number, number) `offset_encoding` index of the character
@@ -1543,8 +1543,8 @@ 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: ~
`true` if the jump succeeded `true` if the jump succeeded
@@ -1559,9 +1559,9 @@ 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
Return: ~ Return: ~
@@ -1606,7 +1606,7 @@ make_formatting_params({options})
buffer and cursor position. buffer and cursor position.
Parameters: ~ Parameters: ~
{options} table|nil with valid `FormattingOptions` {options} (table|nil) with valid `FormattingOptions`
entries entries
Return: ~ Return: ~
@@ -1629,9 +1629,9 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
end of the last visual selection. end of the last visual selection.
{bufnr} (optional, number): buffer handle or 0 {bufnr} (optional, number): buffer handle or 0
for current, defaults to current for current, defaults to current
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults {offset_encoding} (string) utf-8|utf-16|utf-32|nil
to `offset_encoding` of first client of defaults to `offset_encoding` of first
`bufnr` client of `bufnr`
Return: ~ Return: ~
{ textDocument = { uri = `current_file_uri` }, range = { { textDocument = { uri = `current_file_uri` }, range = {
@@ -1645,9 +1645,9 @@ make_position_params({window}, {offset_encoding})
Parameters: ~ Parameters: ~
{window} (optional, number): window handle or 0 {window} (optional, number): window handle or 0
for current, defaults to current for current, defaults to current
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults {offset_encoding} (string) utf-8|utf-16|utf-32|nil
to `offset_encoding` of first client of defaults to `offset_encoding` of first
buffer of `window` client of buffer of `window`
Return: ~ Return: ~
`TextDocumentPositionParams` object `TextDocumentPositionParams` object
@@ -1666,9 +1666,9 @@ make_range_params({window}, {offset_encoding})
Parameters: ~ Parameters: ~
{window} (optional, number): window handle or 0 {window} (optional, number): window handle or 0
for current, defaults to current for current, defaults to current
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults {offset_encoding} (string) utf-8|utf-16|utf-32|nil
to `offset_encoding` of first client of defaults to `offset_encoding` of first
buffer of `window` client of buffer of `window`
Return: ~ Return: ~
{ textDocument = { uri = `current_file_uri` }, range = { { textDocument = { uri = `current_file_uri` }, range = {
@@ -1702,9 +1702,9 @@ open_floating_preview({contents}, {syntax}, {opts})
Shows contents in a floating window. Shows contents in a floating window.
Parameters: ~ Parameters: ~
{contents} table of lines to show in window {contents} (table) of lines to show in window
{syntax} string of syntax to set for opened buffer {syntax} (string) of syntax to set for opened buffer
{opts} table with optional fields (additional keys {opts} (table) with optional fields (additional keys
are passed on to |vim.api.nvim_open_win()|) are passed on to |vim.api.nvim_open_win()|)
• height: (number) height of floating window • height: (number) height of floating window
• width: (number) width of floating window • width: (number) width of floating window
@@ -1739,10 +1739,10 @@ parse_snippet({input}) *vim.lsp.util.parse_snippet()*
Parses snippets in a completion entry. Parses snippets in a completion entry.
Parameters: ~ Parameters: ~
{input} string unparsed snippet {input} (string) unparsed snippet
Return: ~ Return: ~
string parsed snippet (string) parsed snippet
preview_location({location}, {opts}) *vim.lsp.util.preview_location()* preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
Previews a location in a floating window Previews a location in a floating window
@@ -1795,7 +1795,7 @@ stylize_markdown({bufnr}, {contents}, {opts})
`open_floating_preview` instead `open_floating_preview` instead
Parameters: ~ Parameters: ~
{contents} table of lines to show in window {contents} (table) of lines to show in window
{opts} dictionary with optional fields {opts} dictionary with optional fields
• height of floating window • height of floating window
• width of floating window • width of floating window
@@ -1873,14 +1873,15 @@ get_level() *vim.lsp.log.get_level()*
Gets the current log level. Gets the current log level.
Return: ~ Return: ~
string current log level (string) current log level
set_format_func({handle}) *vim.lsp.log.set_format_func()* set_format_func({handle}) *vim.lsp.log.set_format_func()*
Sets formatting function used to format logs Sets formatting function used to format logs
Parameters: ~ Parameters: ~
{handle} function function to apply to logging arguments, {handle} (function) function to apply to logging
pass vim.inspect for multi-line formatting arguments, pass vim.inspect for multi-line
formatting
set_level({level}) *vim.lsp.log.set_level()* set_level({level}) *vim.lsp.log.set_level()*
Sets the current log level. Sets the current log level.
@@ -1892,7 +1893,7 @@ should_log({level}) *vim.lsp.log.should_log()*
Checks whether the level is sufficient for logging. Checks whether the level is sufficient for logging.
Parameters: ~ Parameters: ~
{level} number log level {level} (number) log level
Return: ~ Return: ~
(bool) true if would log, false if not (bool) true if would log, false if not
@@ -1998,19 +1999,19 @@ compute_diff({prev_lines}, {curr_lines}, {firstline}, {lastline},
curr lines curr lines
Parameters: ~ Parameters: ~
{prev_lines} table list of lines {prev_lines} (table) list of lines
{curr_lines} table list of lines {curr_lines} (table) list of lines
{firstline} number line to begin search for first {firstline} (number) line to begin search for first
difference difference
{lastline} number line to begin search in {lastline} (number) line to begin search in
old_lines for last difference old_lines for last difference
{new_lastline} number line to begin search in {new_lastline} (number) line to begin search in
new_lines for last difference new_lines for last difference
{offset_encoding} string encoding requested by language {offset_encoding} (string) encoding requested by language
server server
Return: ~ Return: ~
table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent (table) TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent
============================================================================== ==============================================================================
@@ -2027,10 +2028,10 @@ resolve_capabilities({server_capabilities})
capabilities. capabilities.
Parameters: ~ Parameters: ~
{server_capabilities} table Table of capabilities {server_capabilities} (table) Table of capabilities
supported by the server supported by the server
Return: ~ Return: ~
table Normalized table of capabilities (table) Normalized table of capabilities
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@@ -1336,7 +1336,8 @@ deprecate({name}, {alternative}, {version}, {plugin}) *vim.deprecate()*
Parameters: ~ Parameters: ~
{name} string Deprecated function. {name} string Deprecated function.
{alternative} string|nil Preferred alternative function. {alternative} (string|nil) Preferred alternative
function.
{version} string Version in which the deprecated {version} string Version in which the deprecated
function will be removed. function will be removed.
{plugin} string|nil Plugin name that the function {plugin} string|nil Plugin name that the function
@@ -1357,11 +1358,12 @@ notify({msg}, {level}, {opts}) *vim.notify()*
notification provider). By default, writes to |:messages|. notification provider). By default, writes to |:messages|.
Parameters: ~ Parameters: ~
{msg} string Content of the notification to show to the {msg} (string) Content of the notification to show to
user. the user.
{level} number|nil One of the values from {level} (number|nil) One of the values from
|vim.log.levels|. |vim.log.levels|.
{opts} table|nil Optional parameters. Unused by default. {opts} (table|nil) Optional parameters. Unused by
default.
notify_once({msg}, {level}, {opts}) *vim.notify_once()* notify_once({msg}, {level}, {opts}) *vim.notify_once()*
Display a notification only one time. Display a notification only one time.
@@ -1370,11 +1372,12 @@ notify_once({msg}, {level}, {opts}) *vim.notify_once()*
message will not display a notification. message will not display a notification.
Parameters: ~ Parameters: ~
{msg} string Content of the notification to show to the {msg} (string) Content of the notification to show to
user. the user.
{level} number|nil One of the values from {level} (number|nil) One of the values from
|vim.log.levels|. |vim.log.levels|.
{opts} table|nil Optional parameters. Unused by default. {opts} (table|nil) Optional parameters. Unused by
default.
on_key({fn}, {ns_id}) *vim.on_key()* on_key({fn}, {ns_id}) *vim.on_key()*
Adds Lua function {fn} with namespace id {ns_id} as a listener Adds Lua function {fn} with namespace id {ns_id} as a listener
@@ -1400,8 +1403,8 @@ on_key({fn}, {ns_id}) *vim.on_key()*
returns a new |nvim_create_namespace()| id. returns a new |nvim_create_namespace()| id.
Return: ~ Return: ~
number Namespace id associated with {fn}. Or count of all (number) Namespace id associated with {fn}. Or count of
callbacks if on_key() is called without arguments. all callbacks if on_key() is called without arguments.
Note: Note:
{fn} will be removed if an error occurs while calling. {fn} will be removed if an error occurs while calling.
@@ -1455,12 +1458,12 @@ region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
marked by two points marked by two points
Parameters: ~ Parameters: ~
{bufnr} number of buffer {bufnr} (number) of buffer
{pos1} (line, column) tuple marking beginning of {pos1} (line, column) tuple marking beginning of
region region
{pos2} (line, column) tuple marking end of region {pos2} (line, column) tuple marking end of region
{regtype} type of selection (:help setreg) {regtype} type of selection (:help setreg)
{inclusive} boolean indicating whether the selection is {inclusive} (boolean) indicating whether the selection is
end-inclusive end-inclusive
Return: ~ Return: ~
@@ -1487,7 +1490,7 @@ deep_equal({a}, {b}) *vim.deep_equal()*
{b} any Second value {b} any Second value
Return: ~ Return: ~
boolean `true` if values are equals, else `false` (boolean) `true` if values are equals, else `false`
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
@@ -1498,32 +1501,32 @@ deepcopy({orig}) *vim.deepcopy()*
and will throw an error. and will throw an error.
Parameters: ~ Parameters: ~
{orig} table Table to copy {orig} (table) Table to copy
Return: ~ Return: ~
table Table of copied keys and (nested) values. (table) Table of copied keys and (nested) values.
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 String {s} (string) String
{suffix} string Suffix to match {suffix} (string) Suffix to match
Return: ~ Return: ~
boolean `true` if `suffix` is a suffix of `s` (boolean) `true` if `suffix` is a suffix of `s`
gsplit({s}, {sep}, {plain}) *vim.gsplit()* gsplit({s}, {sep}, {plain}) *vim.gsplit()*
Splits a string at each instance of a separator. Splits a string at each instance of a separator.
Parameters: ~ Parameters: ~
{s} string String to split {s} (string) String to split
{sep} string Separator or pattern {sep} (string) Separator or pattern
{plain} boolean If `true` use `sep` literally (passed to {plain} (boolean) If `true` use `sep` literally (passed
string.find) to string.find)
Return: ~ Return: ~
function Iterator over the split components (function) Iterator over the split components
See also: ~ See also: ~
|vim.split()| |vim.split()|
@@ -1537,7 +1540,7 @@ is_callable({f}) *vim.is_callable()*
{f} any Any object {f} any Any object
Return: ~ Return: ~
boolean `true` if `f` is callable, else `false` (boolean) `true` if `f` is callable, else `false`
list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()* list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
Extends a list-like table with the values of another list-like Extends a list-like table with the values of another list-like
@@ -1546,14 +1549,14 @@ list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
NOTE: This mutates dst! NOTE: This mutates dst!
Parameters: ~ Parameters: ~
{dst} table List which will be modified and appended {dst} (table) List which will be modified and appended
to to
{src} table List from which values will be inserted {src} (table) List from which values will be inserted
{start} number Start index on src. Defaults to 1 {start} (number) Start index on src. Defaults to 1
{finish} number Final index on src. Defaults to `#src` {finish} (number) Final index on src. Defaults to `#src`
Return: ~ Return: ~
table dst (table) dst
See also: ~ See also: ~
|vim.tbl_extend()| |vim.tbl_extend()|
@@ -1563,22 +1566,22 @@ list_slice({list}, {start}, {finish}) *vim.list_slice()*
to end (inclusive) to end (inclusive)
Parameters: ~ Parameters: ~
{list} table Table {list} (table) Table
{start} number Start range of slice {start} (number) Start range of slice
{finish} number End range of slice {finish} (number) End range of slice
Return: ~ Return: ~
table Copy of table sliced from start to finish (table) Copy of table sliced from start to finish
(inclusive) (inclusive)
pesc({s}) *vim.pesc()* pesc({s}) *vim.pesc()*
Escapes magic chars in a Lua pattern. Escapes magic chars in a Lua pattern.
Parameters: ~ Parameters: ~
{s} string String to escape {s} (string) String to escape
Return: ~ Return: ~
string %-escaped pattern string (string) %-escaped pattern string
See also: ~ See also: ~
https://github.com/rxi/lume https://github.com/rxi/lume
@@ -1595,16 +1598,16 @@ split({s}, {sep}, {kwargs}) *vim.split()*
< <
Parameters: ~ Parameters: ~
{s} string String to split {s} (string) String to split
{sep} string Separator or pattern {sep} (string) Separator or pattern
{kwargs} table Keyword arguments: {kwargs} (table) Keyword arguments:
• plain: (boolean) If `true` use `sep` literally • plain: (boolean) If `true` use `sep` literally
(passed to string.find) (passed to string.find)
• trimempty: (boolean) If `true` remove empty • trimempty: (boolean) If `true` remove empty
items from the front and back of the list items from the front and back of the list
Return: ~ Return: ~
table List of split components (table) List of split components
See also: ~ See also: ~
|vim.gsplit()| |vim.gsplit()|
@@ -1613,11 +1616,11 @@ startswith({s}, {prefix}) *vim.startswith()*
Tests if `s` starts with `prefix`. Tests if `s` starts with `prefix`.
Parameters: ~ Parameters: ~
{s} string String {s} (string) String
{prefix} string Prefix to match {prefix} (string) Prefix to match
Return: ~ Return: ~
boolean `true` if `prefix` is a prefix of `s` (boolean) `true` if `prefix` is a prefix of `s`
tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()* tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
Add the reverse lookup values to an existing table. For Add the reverse lookup values to an existing table. For
@@ -1627,20 +1630,20 @@ tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
Note that this modifies the input. Note that this modifies the input.
Parameters: ~ Parameters: ~
{o} table Table to add the reverse to {o} (table) Table to add the reverse to
Return: ~ Return: ~
table o (table) o
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 Table to check {t} (table) Table to check
{value} any Value to compare {value} any Value to compare
Return: ~ Return: ~
boolean `true` if `t` contains `value` (boolean) `true` if `t` contains `value`
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`.
@@ -1651,10 +1654,10 @@ tbl_count({t}) *vim.tbl_count()*
< <
Parameters: ~ Parameters: ~
{t} table Table {t} (table) Table
Return: ~ Return: ~
number Number of non-nil values in table (number) Number of non-nil values in table
See also: ~ See also: ~
https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
@@ -1663,15 +1666,15 @@ tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more map-like tables. Merges recursively two or more map-like tables.
Parameters: ~ Parameters: ~
{behavior} string Decides what to do if a key is found in {behavior} (string) Decides what to do if a key is found
more than one map: in more than one map:
• "error": raise an error • "error": raise an error
• "keep": use value from the leftmost map • "keep": use value from the leftmost map
• "force": use value from the rightmost map • "force": use value from the rightmost map
{...} table Two or more map-like tables {...} (table) Two or more map-like tables
Return: ~ Return: ~
table Merged table (table) Merged table
See also: ~ See also: ~
|tbl_extend()| |tbl_extend()|
@@ -1680,15 +1683,15 @@ tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more map-like tables. Merges two or more map-like tables.
Parameters: ~ Parameters: ~
{behavior} string Decides what to do if a key is found in {behavior} (string) Decides what to do if a key is found
more than one map: in more than one map:
• "error": raise an error • "error": raise an error
• "keep": use value from the leftmost map • "keep": use value from the leftmost map
• "force": use value from the rightmost map • "force": use value from the rightmost map
{...} table Two or more map-like tables {...} (table) Two or more map-like tables
Return: ~ Return: ~
table Merged table (table) Merged table
See also: ~ See also: ~
|extend()| |extend()|
@@ -1698,20 +1701,20 @@ tbl_filter({func}, {t}) *vim.tbl_filter()*
Parameters: ~ Parameters: ~
{func} function|table Function or callable table {func} function|table Function or callable table
{t} table Table {t} (table) Table
Return: ~ Return: ~
table Table of filtered values (table) Table of filtered values
tbl_flatten({t}) *vim.tbl_flatten()* tbl_flatten({t}) *vim.tbl_flatten()*
Creates a copy of a list-like table such that any nested Creates a copy of a list-like table such that any nested
tables are "unrolled" and appended to the result. tables are "unrolled" and appended to the result.
Parameters: ~ Parameters: ~
{t} table List-like table {t} (table) List-like table
Return: ~ Return: ~
table Flattened copy of the given list-like table (table) Flattened copy of the given list-like table
See also: ~ See also: ~
From https://github.com/premake/premake-core/blob/master/src/base/table.lua From https://github.com/premake/premake-core/blob/master/src/base/table.lua
@@ -1727,8 +1730,8 @@ tbl_get({o}, {...}) *vim.tbl_get()*
< <
Parameters: ~ Parameters: ~
{o} table Table to index {o} (table) Table to index
{...} string Optional strings (0 or more, variadic) via {...} (string) Optional strings (0 or more, variadic) via
which to index the table which to index the table
Return: ~ Return: ~
@@ -1738,10 +1741,10 @@ tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty. Checks if a table is empty.
Parameters: ~ Parameters: ~
{t} table Table to check {t} (table) Table to check
Return: ~ Return: ~
boolean `true` if `t` is empty (boolean) `true` if `t` is empty
See also: ~ See also: ~
https://github.com/premake/premake-core/blob/master/src/base/table.lua https://github.com/premake/premake-core/blob/master/src/base/table.lua
@@ -1755,20 +1758,20 @@ tbl_islist({t}) *vim.tbl_islist()*
|vim.fn|. |vim.fn|.
Parameters: ~ Parameters: ~
{t} table Table {t} (table) Table
Return: ~ Return: ~
boolean `true` if array-like table, else `false` (boolean) `true` if array-like table, else `false`
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
of the return table of keys is not guaranteed. of the return table of keys is not guaranteed.
Parameters: ~ Parameters: ~
{t} table Table {t} (table) Table
Return: ~ Return: ~
table List of keys (table) List of keys
See also: ~ See also: ~
From https://github.com/premake/premake-core/blob/master/src/base/table.lua From https://github.com/premake/premake-core/blob/master/src/base/table.lua
@@ -1778,30 +1781,30 @@ tbl_map({func}, {t}) *vim.tbl_map()*
Parameters: ~ Parameters: ~
{func} function|table Function or callable table {func} function|table Function or callable table
{t} table Table {t} (table) Table
Return: ~ Return: ~
table Table of transformed values (table) Table of transformed values
tbl_values({t}) *vim.tbl_values()* tbl_values({t}) *vim.tbl_values()*
Return a list of all values used in a table. However, the Return a list of all values used in a table. However, the
order of the return table of values is not guaranteed. order of the return table of values is not guaranteed.
Parameters: ~ Parameters: ~
{t} table Table {t} (table) Table
Return: ~ Return: ~
table List of values (table) List of values
trim({s}) *vim.trim()* trim({s}) *vim.trim()*
Trim whitespace (Lua pattern "%s") from both sides of a Trim whitespace (Lua pattern "%s") from both sides of a
string. string.
Parameters: ~ Parameters: ~
{s} string String to trim {s} (string) String to trim
Return: ~ Return: ~
string String with whitespace removed from its beginning (string) String with whitespace removed from its beginning
and end and end
See also: ~ See also: ~
@@ -1844,9 +1847,9 @@ validate({opt}) *vim.validate()*
< <
Parameters: ~ Parameters: ~
{opt} table Names of parameters to validate. Each key is {opt} (table) Names of parameters to validate. Each key
a parameter name; each value is a tuple in one of is a parameter name; each value is a tuple in one
these forms: of these forms:
1. (arg_value, type_name, optional) 1. (arg_value, type_name, optional)
• arg_value: argument value • arg_value: argument value
• type_name: string|table type name, one of: • type_name: string|table type name, one of:
@@ -1874,38 +1877,38 @@ uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()*
Get a URI from a bufnr Get a URI from a bufnr
Parameters: ~ Parameters: ~
{bufnr} number {bufnr} (number)
Return: ~ Return: ~
string URI (string) URI
uri_from_fname({path}) *vim.uri_from_fname()* uri_from_fname({path}) *vim.uri_from_fname()*
Get a URI from a file path. Get a URI from a file path.
Parameters: ~ Parameters: ~
{path} string Path to file {path} (string) Path to file
Return: ~ Return: ~
string URI (string) URI
uri_to_bufnr({uri}) *vim.uri_to_bufnr()* uri_to_bufnr({uri}) *vim.uri_to_bufnr()*
Get the buffer for a uri. Creates a new unloaded buffer if no Get the buffer for a uri. Creates a new unloaded buffer if no
buffer for the uri already exists. buffer for the uri already exists.
Parameters: ~ Parameters: ~
{uri} string {uri} (string)
Return: ~ Return: ~
number bufnr (number) bufnr
uri_to_fname({uri}) *vim.uri_to_fname()* uri_to_fname({uri}) *vim.uri_to_fname()*
Get a filename from a URI Get a filename from a URI
Parameters: ~ Parameters: ~
{uri} string {uri} (string)
Return: ~ Return: ~
string filename or unchanged URI for non-file URIs (string) filename or unchanged URI for non-file URIs
============================================================================== ==============================================================================
@@ -1922,7 +1925,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
@@ -1935,10 +1938,10 @@ input({opts}, {on_confirm}) *vim.ui.input()*
|:command-completion| |:command-completion|
• highlight (function) Function that will be • highlight (function) Function that will be
used for highlighting user inputs. used for highlighting user inputs.
{on_confirm} function ((input|nil) -> ()) Called once the {on_confirm} (function) ((input|nil) -> ()) Called once
user confirms or abort the input. `input` is the user confirms or abort the input.
what the user typed. `nil` if the user `input` is what the user typed. `nil` if the
aborted the dialog. user aborted the dialog.
select({items}, {opts}, {on_choice}) *vim.ui.select()* select({items}, {opts}, {on_choice}) *vim.ui.select()*
Prompts the user to pick a single item from a collection of Prompts the user to pick a single item from a collection of
@@ -1961,8 +1964,8 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
< <
Parameters: ~ Parameters: ~
{items} table Arbitrary items {items} (table) Arbitrary items
{opts} table Additional options {opts} (table) Additional options
• prompt (string|nil) Text of the prompt. • prompt (string|nil) Text of the prompt.
Defaults to `Select one of:` Defaults to `Select one of:`
• format_item (function item -> text) • format_item (function item -> text)
@@ -1974,7 +1977,7 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
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 `items`. `nil` 1-based index of `item` within `items`. `nil`
if the user aborted the dialog. if the user aborted the dialog.
@@ -2043,16 +2046,16 @@ add({filetypes}) *vim.filetype.add()*
< <
Parameters: ~ Parameters: ~
{filetypes} table A table containing new filetype maps {filetypes} (table) A table containing new filetype maps
(see example). (see example).
match({name}, {bufnr}) *vim.filetype.match()* match({name}, {bufnr}) *vim.filetype.match()*
Set the filetype for the given buffer from a file name. Set the filetype for the given buffer from a file name.
Parameters: ~ Parameters: ~
{name} string File name (can be an absolute or relative {name} (string) File name (can be an absolute or
path) relative path)
{bufnr} number|nil The buffer to set the filetype for. {bufnr} (number|nil) The buffer to set the filetype for.
Defaults to the current buffer. Defaults to the current buffer.
@@ -2068,7 +2071,7 @@ del({modes}, {lhs}, {opts}) *vim.keymap.del()*
< <
Parameters: ~ Parameters: ~
{opts} table A table of optional arguments: {opts} (table) A table of optional arguments:
• buffer: (number or boolean) Remove a mapping • buffer: (number or boolean) Remove a mapping
from the given buffer. When "true" or 0, use the from the given buffer. When "true" or 0, use the
current buffer. current buffer.
@@ -2112,12 +2115,12 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
{mode} string|table Same mode short names as {mode} string|table Same mode short names as
|nvim_set_keymap()|. Can also be list of modes to |nvim_set_keymap()|. Can also be list of modes to
create mapping on multiple modes. create mapping on multiple modes.
{lhs} string Left-hand side |{lhs}| of the mapping. {lhs} (string) Left-hand side |{lhs}| of the mapping.
{rhs} string|function Right-hand side |{rhs}| of the {rhs} string|function Right-hand side |{rhs}| of the
mapping. Can also be a Lua function. If a Lua mapping. Can also be a Lua function. If a Lua
function and `opts.expr == true`, returning `nil` function and `opts.expr == true`, returning `nil`
is equivalent to an empty string. is equivalent to an empty string.
{opts} table A table of |:map-arguments| such as {opts} (table) A table of |:map-arguments| such as
"silent". In addition to the options listed in "silent". In addition to the options listed in
|nvim_set_keymap()|, this table also accepts the |nvim_set_keymap()|, this table also accepts the
following keys: following keys:

View File

@@ -472,8 +472,8 @@ parse_query({lang}, {query}) *parse_query()*
• `info.patterns` contains information about predicates. • `info.patterns` contains information about predicates.
Parameters: ~ Parameters: ~
{lang} string The language {lang} (string) The language
{query} string A string containing the query (s-expr {query} (string) A string containing the query (s-expr
syntax) syntax)
Return: ~ Return: ~
@@ -704,7 +704,7 @@ LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()*
Registers callbacks for the parser. Registers callbacks for the parser.
Parameters: ~ Parameters: ~
{cbs} table An |nvim_buf_attach()|-like table argument {cbs} (table) An |nvim_buf_attach()|-like table argument
with the following keys : with the following keys :
• `on_bytes` : see |nvim_buf_attach()|, but this will be • `on_bytes` : see |nvim_buf_attach()|, but this will be
called after the parsers callback. called after the parsers callback.

View File

@@ -403,6 +403,29 @@ function TLua2DoX_filter.readfile(this,AppStamp,Filename)
if string.sub(line, 3, 3) == '@' or string.sub(line, 1, 4) == '---@' then -- it's a magic comment if string.sub(line, 3, 3) == '@' or string.sub(line, 1, 4) == '---@' then -- it's a magic comment
state = 'in_magic_comment' state = 'in_magic_comment'
local magic = string.sub(line, 4 + offset) local magic = string.sub(line, 4 + offset)
local magic_split = string_split(magic, ' ')
local type_index = 2
if magic_split[1] == 'param' then
type_index = type_index + 1
end
if magic_split[type_index] == 'number' or
magic_split[type_index] == 'number|nil' or
magic_split[type_index] == 'string' or
magic_split[type_index] == 'string|nil' or
magic_split[type_index] == 'table' or
magic_split[type_index] == 'table|nil' or
magic_split[type_index] == 'boolean' or
magic_split[type_index] == 'boolean|nil' or
magic_split[type_index] == 'function' or
magic_split[type_index] == 'function|nil'
then
magic_split[type_index] = '(' .. magic_split[type_index] .. ')'
end
magic = table.concat(magic_split, ' ')
outStream:writeln('/// @' .. magic) outStream:writeln('/// @' .. magic)
fn_magic = checkComment4fn(fn_magic,magic) fn_magic = checkComment4fn(fn_magic,magic)
elseif string.sub(line,3,3)=='-' then -- it's a nonmagic doc comment elseif string.sub(line,3,3)=='-' then -- it's a nonmagic doc comment