mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(treesitter): make params optional
This commit is contained in:
@@ -721,7 +721,7 @@ add_directive({name}, {handler}, {force})
|
|||||||
• predicate: list of strings containing the full directive
|
• predicate: list of strings containing the full directive
|
||||||
being called, e.g. `(node (#set! conceal "-"))` would get
|
being called, e.g. `(node (#set! conceal "-"))` would get
|
||||||
the predicate `{ "#set!", "conceal", "-" }`
|
the predicate `{ "#set!", "conceal", "-" }`
|
||||||
• {force} (boolean)
|
• {force} (boolean|nil)
|
||||||
|
|
||||||
*vim.treesitter.query.add_predicate()*
|
*vim.treesitter.query.add_predicate()*
|
||||||
add_predicate({name}, {handler}, {force})
|
add_predicate({name}, {handler}, {force})
|
||||||
@@ -733,7 +733,7 @@ add_predicate({name}, {handler}, {force})
|
|||||||
bufnr:number, predicate:string[])
|
bufnr:number, predicate:string[])
|
||||||
• see |vim.treesitter.query.add_directive()| for argument
|
• see |vim.treesitter.query.add_directive()| for argument
|
||||||
meanings
|
meanings
|
||||||
• {force} (boolean)
|
• {force} (boolean|nil)
|
||||||
|
|
||||||
*vim.treesitter.query.get_node_text()*
|
*vim.treesitter.query.get_node_text()*
|
||||||
get_node_text({node}, {source}, {opts})
|
get_node_text({node}, {source}, {opts})
|
||||||
|
@@ -487,7 +487,7 @@ local directive_handlers = {
|
|||||||
---@param name string Name of the predicate, without leading #
|
---@param name string Name of the predicate, without leading #
|
||||||
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[])
|
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[])
|
||||||
--- - see |vim.treesitter.query.add_directive()| for argument meanings
|
--- - see |vim.treesitter.query.add_directive()| for argument meanings
|
||||||
---@param force boolean
|
---@param force boolean|nil
|
||||||
function M.add_predicate(name, handler, force)
|
function M.add_predicate(name, handler, force)
|
||||||
if predicate_handlers[name] and not force then
|
if predicate_handlers[name] and not force then
|
||||||
error(string.format('Overriding %s', name))
|
error(string.format('Overriding %s', name))
|
||||||
@@ -510,7 +510,7 @@ end
|
|||||||
--- - pattern: see |treesitter-query|
|
--- - pattern: see |treesitter-query|
|
||||||
--- - predicate: list of strings containing the full directive being called, e.g.
|
--- - predicate: list of strings containing the full directive being called, e.g.
|
||||||
--- `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }`
|
--- `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }`
|
||||||
---@param force boolean
|
---@param force boolean|nil
|
||||||
function M.add_directive(name, handler, force)
|
function M.add_directive(name, handler, force)
|
||||||
if directive_handlers[name] and not force then
|
if directive_handlers[name] and not force then
|
||||||
error(string.format('Overriding %s', name))
|
error(string.format('Overriding %s', name))
|
||||||
|
Reference in New Issue
Block a user