We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If the same field is used for multiple child nodes, a query will only match the first node
test.elm
f x y = x
Its parse tree is as follows:
(file [0, 0] - [0, 9] (value_declaration [0, 0] - [0, 9] functionDeclarationLeft: (function_declaration_left [0, 0] - [0, 5] (lower_case_identifier [0, 0] - [0, 1]) pattern: (lower_pattern [0, 2] - [0, 3] (lower_case_identifier [0, 2] - [0, 3])) pattern: (lower_pattern [0, 4] - [0, 5] (lower_case_identifier [0, 4] - [0, 5]))) (eq [0, 6] - [0, 7]) body: (value_expr [0, 8] - [0, 9] name: (value_qid [0, 8] - [0, 9] (lower_case_identifier [0, 8] - [0, 9])))))
Note how there are two nodes with field pattern
pattern
test.scm
(function_declaration_left pattern: (_) @argumentOrParameter)
➜ npx tree-sitter query test.scm test.elm ../../../test.elm pattern: 0 capture: 0 - argumentOrParameter, start: (0, 2), end: (0, 3), text: `x`
I'd expect matches for both x and y:
x
y
➜ npx tree-sitter query test.scm test.elm ../../../test.elm pattern: 0 capture: 0 - argumentOrParameter, start: (0, 2), end: (0, 3), text: `x` pattern: 0 capture: 0 - argumentOrParameter, start: (0, 4), end: (0, 5), text: `y`
tree-sitter 0.20.6 (ccd6bf5)
macOS 14.3 (23D56)
The text was updated successfully, but these errors were encountered:
Please try the latest version (0.20.9).
Sorry, something went wrong.
can reproduce on 0.20.9 & master
No branches or pull requests
Problem
If the same field is used for multiple child nodes, a query will only match the first node
Steps to reproduce
Inputs
test.elm
Its parse tree is as follows:
Note how there are two nodes with field
pattern
test.scm
Actual output
➜ npx tree-sitter query test.scm test.elm ../../../test.elm pattern: 0 capture: 0 - argumentOrParameter, start: (0, 2), end: (0, 3), text: `x`
Expected behavior
I'd expect matches for both
x
andy
:Tree-sitter version (tree-sitter --version)
tree-sitter 0.20.6 (ccd6bf5)
Operating system/version
macOS 14.3 (23D56)
The text was updated successfully, but these errors were encountered: