aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-02-15 12:26:07 +0000
committerGitHub <noreply@github.com>2023-02-15 12:26:07 +0000
commita289e82142fdc5ff657dd30198546eeb1e115fe9 (patch)
tree8a4a7ebafa961ec8d6305e9ab415a4d840b2af0a
parent2e450efb9525308708dd9e26d6ea1d029ac781b8 (diff)
downloadrneovim-a289e82142fdc5ff657dd30198546eeb1e115fe9.tar.gz
rneovim-a289e82142fdc5ff657dd30198546eeb1e115fe9.tar.bz2
rneovim-a289e82142fdc5ff657dd30198546eeb1e115fe9.zip
fix(treesitter): make params optional
-rw-r--r--runtime/doc/treesitter.txt4
-rw-r--r--runtime/lua/vim/treesitter/query.lua4
2 files changed, 4 insertions, 4 deletions
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 693804497d..d4799053f7 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -721,7 +721,7 @@ add_directive({name}, {handler}, {force})
• predicate: list of strings containing the full directive
being called, e.g. `(node (#set! conceal "-"))` would get
the predicate `{ "#set!", "conceal", "-" }`
- • {force} (boolean)
+ • {force} (boolean|nil)
*vim.treesitter.query.add_predicate()*
add_predicate({name}, {handler}, {force})
@@ -733,7 +733,7 @@ add_predicate({name}, {handler}, {force})
bufnr:number, predicate:string[])
• see |vim.treesitter.query.add_directive()| for argument
meanings
- • {force} (boolean)
+ • {force} (boolean|nil)
*vim.treesitter.query.get_node_text()*
get_node_text({node}, {source}, {opts})
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index a0522d7cda..008e5a54d7 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -487,7 +487,7 @@ local directive_handlers = {
---@param name string Name of the predicate, without leading #
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[])
--- - see |vim.treesitter.query.add_directive()| for argument meanings
----@param force boolean
+---@param force boolean|nil
function M.add_predicate(name, handler, force)
if predicate_handlers[name] and not force then
error(string.format('Overriding %s', name))
@@ -510,7 +510,7 @@ end
--- - pattern: see |treesitter-query|
--- - predicate: list of strings containing the full directive being called, e.g.
--- `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }`
----@param force boolean
+---@param force boolean|nil
function M.add_directive(name, handler, force)
if directive_handlers[name] and not force then
error(string.format('Overriding %s', name))