Skip to content

Commit 4446871

Browse files
committed
Support condition in older tree-sitter-rust
1 parent 69cb021 commit 4446871

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/languages/rust.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
trailingMatcher,
1515
} from "../util/nodeMatchers";
1616
import {
17+
childRangeSelector,
1718
makeNodePairSelection,
1819
makeRangeFromPositions,
1920
} from "../util/nodeSelectors";
@@ -148,6 +149,12 @@ const nodeMatchers: Partial<
148149
ifStatement: ["if_expression", "if_let_expression"],
149150
condition: cascadingMatcher(
150151
patternMatcher("while_expression[condition]", "if_expression[condition]"),
152+
matcher(
153+
patternFinder("while_let_expression", "if_let_expression"),
154+
childRangeSelector(["while", "if", "block"], [], {
155+
includeUnnamedChildren: true,
156+
}),
157+
),
151158
leadingMatcher(["*.match_pattern![condition]"], ["if"]),
152159
),
153160
functionCall: ["call_expression", "macro_invocation", "struct_expression"],

0 commit comments

Comments
 (0)