You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8251e8b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/app-web-docs/src/docs/contributing/tree-sitter-query-syntax.md
+7-10Lines changed: 7 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,24 +19,21 @@ In addition to the above aspects, you can also use the following inline operator
19
19
-`@foo.start` and `@foo.end` to construct the scope using a range between two nodes (inclusive).
20
20
-`@foo.startOf` and `@foo.endOf` to refer to the start and end positions of a node. For example, you could use `@foo.start.endOf` to indicate that the scope should start at the end of the node.
21
21
22
-
## Iteration capture aliases
22
+
## Capture groups
23
23
24
-
Use these aliases when several scopes share an iteration range:
24
+
Use `@G_` followed by at least two underscore-separated scope names to give the same capture to multiple scopes. For example, `@G_value_name_namedFunction` expands to `@value`, `@name`, and `@namedFunction`. The `G_` prefix is discarded. Every scope name in the group must be valid.
25
25
26
-
-`@statementNameValue.iteration` expands to `@statement.iteration`,
27
-
`@name.iteration`, and `@value.iteration`.
28
-
-`@statementNameValueType.iteration` expands to the same captures plus
29
-
`@type.iteration`, for languages and contexts that need type iteration.
30
-
31
-
Both aliases support `.domain`, `.start.endOf`, `.end.startOf`, and `.end.endOf`. For example, a Java block can share iteration boundaries without repeating the pattern for each scope:
26
+
A dot suffix applies to every scope in the group. For example, `@G_value_name_namedFunction.start` expands to `@value.start`, `@name.start`, and `@namedFunction.start`. This also works with relationships and inline operators. A Java block can share iteration boundaries without repeating the capture for each scope:
Predicates refer to the group capture and apply their changes to every expanded capture.
36
+
40
37
## Query predicate operators
41
38
42
39
We also support a number of query predicate operators for modifying the scope. See [`queryPredicateOperators.ts`](../../../../../packages/lib-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts) for a list of available operators.
0 commit comments