aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-05-13 12:56:21 +0200
committerChristian Clason <c.clason@uni-graz.at>2023-05-15 14:13:42 +0200
commit9ff59517cbf309d31f979a49b7dc82b237ecfcc4 (patch)
tree68ce6e9f0b5cfe37b338a549fd2989ac08fdf37c /runtime/doc
parentc97de026e357dec0bed034af3b54abf10966200b (diff)
downloadrneovim-9ff59517cbf309d31f979a49b7dc82b237ecfcc4.tar.gz
rneovim-9ff59517cbf309d31f979a49b7dc82b237ecfcc4.tar.bz2
rneovim-9ff59517cbf309d31f979a49b7dc82b237ecfcc4.zip
fix(treesitter): update c queries
Diffstat (limited to 'runtime/doc')
-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.