Why any-of predicate doesn't work ? #3226
-
Language: tree-sitter-rust (call_expression
[
(field_expression
(field_identifier) @method_name
)
(identifier) @method_name
(#any-of? @method_name "render_jinja" "get_template")
]
(arguments
(string_literal)+ @template_name
)
)
Source: jinja.render_jinja("template");
jinja.get_template("template");
jinja.hello_world("template"); QueryCursor should capture only two methods here, but it captures three. Here is repository. Of course I can update query: (call_expression
[
(field_expression
(field_identifier) @method_name
)
(identifier) @method_name
(#match? @method_name "(render_jinja|get_template)")
]
(arguments
(string_literal)+ @template_name
)
)
TreeSitter Playground doesn't highlight last method: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I tried running this with your repo as is and saw the reported behavior. After that I also ran it with the [package]
name = "any-of-tree-sitter"
version = "0.1.0"
edition = "2021"
[build-dependencies]
cc="*"
[dependencies]
tree-sitter = "0.22.2"
tree-sitter-rust = {path = "/home/lillis/projects/tree-sitter-rust"} In order for this to compile I also had to depend on a local clone of |
Beta Was this translation helpful? Give feedback.
I tried running this with your repo as is and saw the reported behavior. After that I also ran it with the
tree-sitter
dependency bumped up to the latest release. Here's the modified version of yourCargo.toml
file to better illustrate what I mean:In order for this to compile I also had to depend on a local clone of
tree-sitter-rust
(note the specified path fortree-sitter-rust
) with thetree-sitter
dependency bumped up in itsCargo.toml
file. (The maintainers are aware of this, see …