aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/treesitter.txt
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-05-15 19:46:47 +0200
committerGitHub <noreply@github.com>2023-05-15 19:46:47 +0200
commit8e3124493ce176843b9a66773d76a4422647dea9 (patch)
tree8d69ea596c19353f6584f9362b495ba5b79cee48 /runtime/doc/treesitter.txt
parent88a202a01097de029beb01f60ad98aa0b5b44b50 (diff)
parent9ff59517cbf309d31f979a49b7dc82b237ecfcc4 (diff)
downloadrneovim-8e3124493ce176843b9a66773d76a4422647dea9.tar.gz
rneovim-8e3124493ce176843b9a66773d76a4422647dea9.tar.bz2
rneovim-8e3124493ce176843b9a66773d76a4422647dea9.zip
Merge pull request #23606 from clason/bump-tree-sitter-lua
fix(treesitter): update parser and queries
Diffstat (limited to 'runtime/doc/treesitter.txt')
-rw-r--r--runtime/doc/treesitter.txt16
1 files changed, 14 insertions, 2 deletions
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 483812b7c9..64b4730eee 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -221,8 +221,7 @@ The following predicates are built in:
similar to `match?`
`contains?` *treesitter-predicate-contains?*
- Match a string against parts of the text corresponding to a node:
- >query
+ Match a string against parts of the text corresponding to a node: >query
((identifier) @foo (#contains? @foo "foo"))
((identifier) @foo-bar (#contains? @foo-bar "foo" "bar"))
<
@@ -234,6 +233,19 @@ The following predicates are built in:
This is the recommended way to check if the node matches one of many
keywords, as it has been optimized for this.
+ `has-ancestor?` *treesitter-predicate-has-ancestor?*
+ Match any of the given node types against all ancestors of a node: >query
+ ((identifier) @variable.builtin
+ (#any-of? @variable.builtin "begin" "end")
+ (#has-ancestor? @variable.builtin range_expression))
+<
+ `has-parent?` *treesitter-predicate-has-parent?*
+ Match any of the given node types against the direct ancestor of a
+ node: >query
+ (((field_expression
+ (field_identifier) @method)) @_parent
+ (#has-parent? @_parent template_method function_declarator))
+<
*lua-treesitter-not-predicate*
Each predicate has a `not-` prefixed predicate that is just the negation of
the predicate.