mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
doc: group documentation of predicates and directives
This commit is contained in:
@@ -226,6 +226,18 @@ Here is a list of built-in predicates :
|
|||||||
Each predicate has a `not-` prefixed predicate that is just the negation of
|
Each predicate has a `not-` prefixed predicate that is just the negation of
|
||||||
the predicate.
|
the predicate.
|
||||||
|
|
||||||
|
*vim.treesitter.query.add_predicate()*
|
||||||
|
vim.treesitter.query.add_predicate({name}, {handler})
|
||||||
|
|
||||||
|
This adds a predicate with the name {name} to be used in queries.
|
||||||
|
{handler} should be a function whose signature will be : >
|
||||||
|
handler(match, pattern, bufnr, predicate)
|
||||||
|
<
|
||||||
|
*vim.treesitter.query.list_predicates()*
|
||||||
|
vim.treesitter.query.list_predicates()
|
||||||
|
|
||||||
|
This lists the currently available predicates to use in queries.
|
||||||
|
|
||||||
Treesitter Query Directive *lua-treesitter-directives*
|
Treesitter Query Directive *lua-treesitter-directives*
|
||||||
|
|
||||||
Treesitter queries can also contain `directives`. Directives store metadata for a node
|
Treesitter queries can also contain `directives`. Directives store metadata for a node
|
||||||
@@ -249,18 +261,6 @@ Here is a list of built-in directives:
|
|||||||
`({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})`
|
`({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})`
|
||||||
The default key is "offset".
|
The default key is "offset".
|
||||||
|
|
||||||
*vim.treesitter.query.add_predicate()*
|
|
||||||
vim.treesitter.query.add_predicate({name}, {handler})
|
|
||||||
|
|
||||||
This adds a predicate with the name {name} to be used in queries.
|
|
||||||
{handler} should be a function whose signature will be : >
|
|
||||||
handler(match, pattern, bufnr, predicate)
|
|
||||||
<
|
|
||||||
*vim.treesitter.query.list_predicates()*
|
|
||||||
vim.treesitter.query.list_predicates()
|
|
||||||
|
|
||||||
This lists the currently available predicates to use in queries.
|
|
||||||
|
|
||||||
*vim.treesitter.query.add_directive()*
|
*vim.treesitter.query.add_directive()*
|
||||||
vim.treesitter.query.add_directive({name}, {handler})
|
vim.treesitter.query.add_directive({name}, {handler})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user