aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-03-16 17:11:42 +0000
committerLewis Russell <me@lewisr.dev>2024-03-16 19:26:10 +0000
commit14e4b6bbd8640675d7393bdeb3e93d74ab875ff1 (patch)
tree3e48d63a51e5ff90b9d47deccc86b22c43fc5fcf /runtime/doc
parent924a7ef8bb3b74eccbffd48bc1a283d3867b8119 (diff)
downloadrneovim-14e4b6bbd8640675d7393bdeb3e93d74ab875ff1.tar.gz
rneovim-14e4b6bbd8640675d7393bdeb3e93d74ab875ff1.tar.bz2
rneovim-14e4b6bbd8640675d7393bdeb3e93d74ab875ff1.zip
refactor(lua): type annotations
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lua.txt45
-rw-r--r--runtime/doc/treesitter.txt45
2 files changed, 46 insertions, 44 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 135a1b42de..85f3d3288e 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -643,12 +643,14 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts})
tuple or string accepted by |getpos()|
• {finish} (`integer[]|string`) End of region as a (line, column)
tuple or string accepted by |getpos()|
- • {opts} (`table?`) Optional parameters
- • regtype type of range (see |setreg()|, default charwise)
- • inclusive boolean indicating whether the range is
- end-inclusive (default false)
- • priority number indicating priority of highlight (default
- priorities.user)
+ • {opts} (`table?`) A table with the following fields:
+ • {regtype}? (`string`, default: `'charwise'`) Type of
+ range. See |setreg()|
+ • {inclusive}? (`boolean`, default: `false`) Indicates
+ whether the range is end-inclusive
+ • {priority}? (`integer`, default:
+ `vim.highlight.priorities.user`) Indicates priority of
+ highlight
==============================================================================
@@ -2794,9 +2796,9 @@ vim.keymap.del({modes}, {lhs}, {opts}) *vim.keymap.del()*
Parameters: ~
• {modes} (`string|string[]`)
• {lhs} (`string`)
- • {opts} (`table?`) A table of optional arguments:
- • "buffer": (integer|boolean) Remove a mapping from the given
- buffer. When `0` or `true`, use the current buffer.
+ • {opts} (`table?`) A table with the following fields:
+ • {buffer}? (`integer|boolean`) Remove a mapping from the
+ given buffer. When `0` or `true`, use the current buffer.
See also: ~
• |vim.keymap.set()|
@@ -2818,20 +2820,20 @@ vim.keymap.set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
<
Parameters: ~
- • {mode} (`string|table`) Mode short-name, see |nvim_set_keymap()|. Can
- also be list of modes to create mapping on multiple modes.
+ • {mode} (`string|string[]`) Mode short-name, see |nvim_set_keymap()|.
+ Can also be list of modes to create mapping on multiple modes.
• {lhs} (`string`) Left-hand side |{lhs}| of the mapping.
• {rhs} (`string|function`) Right-hand side |{rhs}| of the mapping,
can be a Lua function.
- • {opts} (`table?`) Table of |:map-arguments|.
- • Same as |nvim_set_keymap()| {opts}, except:
- • "replace_keycodes" defaults to `true` if "expr" is `true`.
- • "noremap": inverse of "remap" (see below).
- • Also accepts:
- • "buffer": (integer|boolean) Creates buffer-local mapping,
- `0` or `true` for current buffer.
- • "remap": (boolean) Make the mapping recursive. Inverse of
- "noremap". Defaults to `false`.
+ • {opts} (`table?`) Table of |:map-arguments|. Same as
+ |nvim_set_keymap()| {opts}, except:
+ • {replace_keycodes} defaults to `true` if "expr" is `true`.
+
+ Also accepts:
+ • {buffer}? (`integer|boolean`) Creates buffer-local mapping,
+ `0` or `true` for current buffer.
+ • {remap}? (`boolean`, default: `false`) Make the mapping
+ recursive. Inverse of {noremap}.
See also: ~
• |nvim_set_keymap()|
@@ -3566,7 +3568,7 @@ vim.secure.trust({opts}) *vim.secure.trust()*
The trust database is located at |$XDG_STATE_HOME|/nvim/trust.
Parameters: ~
- • {opts} (`table?`) A table with the following fields:
+ • {opts} (`table`) A table with the following fields:
• {action} (`'allow'|'deny'|'remove'`) - `'allow'` to add a
file to the trust database and trust it,
• `'deny'` to add a file to the trust database and deny it,
@@ -3777,7 +3779,6 @@ vim.version.range({spec}) *vim.version.range()*
(`table?`) A table with the following fields:
• {from} (`vim.Version`)
• {to}? (`vim.Version`)
- • {has} (`fun(self: vim.VersionRangeversion: string|vim.Version)`)
See also: ~
• https://github.com/npm/node-semver#ranges
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 5f33802ad5..74dcc5a120 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -978,7 +978,7 @@ add_directive({name}, {handler}, {opts})
Parameters: ~
• {name} (`string`) Name of the directive, without leading #
- • {handler} (`function`)
+ • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)`)
• match: A table mapping capture IDs to a list of captured
nodes
• pattern: the index of the matching pattern in the query
@@ -986,10 +986,10 @@ add_directive({name}, {handler}, {opts})
• predicate: list of strings containing the full directive
being called, e.g. `(node (#set! conceal "-"))` would get
the predicate `{ "#set!", "conceal", "-" }`
- • {opts} (`table<string, any>`) Optional options:
- • force (boolean): Override an existing predicate of the
- same name
- • all (boolean): Use the correct implementation of the
+ • {opts} (`table`) A table with the following fields:
+ • {force}? (`boolean`) Override an existing predicate of
+ the same name
+ • {all}? (`boolean`) Use the correct implementation of the
match table where capture IDs map to a list of nodes
instead of a single node. Defaults to false (for backward
compatibility). This option will eventually become the
@@ -1001,13 +1001,13 @@ add_predicate({name}, {handler}, {opts})
Parameters: ~
• {name} (`string`) Name of the predicate, without leading #
- • {handler} (`function`)
+ • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)`)
• see |vim.treesitter.query.add_directive()| for argument
meanings
- • {opts} (`table<string, any>`) Optional options:
- • force (boolean): Override an existing predicate of the
- same name
- • all (boolean): Use the correct implementation of the
+ • {opts} (`table`) A table with the following fields:
+ • {force}? (`boolean`) Override an existing predicate of
+ the same name
+ • {all}? (`boolean`) Use the correct implementation of the
match table where capture IDs map to a list of nodes
instead of a single node. Defaults to false (for backward
compatibility). This option will eventually become the
@@ -1079,13 +1079,13 @@ list_directives() *vim.treesitter.query.list_directives()*
Lists the currently available directives to use in queries.
Return: ~
- (`string[]`) List of supported directives.
+ (`string[]`) Supported directives.
list_predicates() *vim.treesitter.query.list_predicates()*
Lists the currently available predicates to use in queries.
Return: ~
- (`string[]`) List of supported predicates.
+ (`string[]`) Supported predicates.
omnifunc({findstart}, {base}) *vim.treesitter.query.omnifunc()*
Omnifunc for completing node names and predicates in treesitter queries.
@@ -1319,7 +1319,7 @@ LanguageTree:language_for_range({range})
• {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
Return: ~
- (`vim.treesitter.LanguageTree`) Managing {range}
+ (`vim.treesitter.LanguageTree`) tree Managing {range}
*LanguageTree:named_node_for_range()*
LanguageTree:named_node_for_range({range}, {opts})
@@ -1327,12 +1327,12 @@ LanguageTree:named_node_for_range({range}, {opts})
Parameters: ~
• {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
- • {opts} (`table?`) Optional keyword arguments:
- • ignore_injections boolean Ignore injected languages
- (default true)
+ • {opts} (`table?`) A table with the following fields:
+ • {ignore_injections}? (`boolean`, default: `true`) Ignore
+ injected languages
Return: ~
- (`TSNode?`) Found node
+ (`TSNode?`)
LanguageTree:parse({range}) *LanguageTree:parse()*
Recursively parse all regions in the language tree using
@@ -1359,8 +1359,9 @@ LanguageTree:register_cbs({cbs}, {recursive})
Registers callbacks for the |LanguageTree|.
Parameters: ~
- • {cbs} (`table`) An |nvim_buf_attach()|-like table argument with
- the following handlers:
+ • {cbs} (`table<TSCallbackNameOn,function>`) An
+ |nvim_buf_attach()|-like table argument with the
+ following handlers:
• `on_bytes` : see |nvim_buf_attach()|, but this will be
called after the parsers callback.
• `on_changedtree` : a callback that will be called every
@@ -1387,9 +1388,9 @@ LanguageTree:tree_for_range({range}, {opts})
Parameters: ~
• {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
- • {opts} (`table?`) Optional keyword arguments:
- • ignore_injections boolean Ignore injected languages
- (default true)
+ • {opts} (`table?`) A table with the following fields:
+ • {ignore_injections}? (`boolean`, default: `true`) Ignore
+ injected languages
Return: ~
(`TSTree?`)