|
1 |
| -import { Selection } from "@cursorless/common"; |
| 1 | +import { Selection, SimpleScopeTypeType } from "@cursorless/common"; |
2 | 2 | import type { SyntaxNode } from "web-tree-sitter";
|
3 |
| -import { SimpleScopeTypeType } from "@cursorless/common"; |
4 | 3 | import { NodeFinder, NodeMatcherAlternative } from "../typings/Types";
|
5 | 4 | import { argumentNodeFinder, patternFinder } from "../util/nodeFinders";
|
6 | 5 | import {
|
7 | 6 | argumentMatcher,
|
8 | 7 | cascadingMatcher,
|
9 |
| - conditionMatcher, |
10 | 8 | createPatternMatchers,
|
11 |
| - leadingMatcher, |
12 | 9 | matcher,
|
13 |
| - patternMatcher, |
14 |
| - trailingMatcher, |
15 | 10 | } from "../util/nodeMatchers";
|
16 | 11 | import {
|
17 | 12 | argumentSelectionExtractor,
|
18 | 13 | childRangeSelector,
|
19 | 14 | } from "../util/nodeSelectors";
|
20 |
| -import { branchMatcher } from "./branchMatcher"; |
21 |
| -import { ternaryBranchMatcher } from "./ternaryBranchMatcher"; |
22 | 15 |
|
23 | 16 | export const getTypeNode = (node: SyntaxNode) =>
|
24 | 17 | node.children.find((child) => child.type === "type") ?? null;
|
@@ -55,38 +48,10 @@ const nodeMatchers: Partial<
|
55 | 48 | argumentSelectionExtractor(),
|
56 | 49 | ),
|
57 | 50 | ),
|
58 |
| - collectionKey: trailingMatcher(["pair[key]"], [":"]), |
59 |
| - ifStatement: "if_statement", |
60 |
| - anonymousFunction: "lambda?.lambda", |
61 |
| - functionCall: "call", |
62 |
| - functionCallee: "call[function]", |
63 |
| - condition: cascadingMatcher( |
64 |
| - conditionMatcher("*[condition]"), |
65 |
| - |
66 |
| - // Comprehensions and match statements |
67 |
| - leadingMatcher(["*.if_clause![0]"], ["if"]), |
68 |
| - |
69 |
| - // Ternaries |
70 |
| - patternMatcher("conditional_expression[1]"), |
71 |
| - ), |
72 | 51 | argumentOrParameter: cascadingMatcher(
|
73 | 52 | argumentMatcher("parameters", "argument_list"),
|
74 | 53 | matcher(patternFinder("call.generator_expression!"), childRangeSelector()),
|
75 | 54 | ),
|
76 |
| - branch: cascadingMatcher( |
77 |
| - patternMatcher("case_clause"), |
78 |
| - branchMatcher("if_statement", ["else_clause", "elif_clause"]), |
79 |
| - branchMatcher("while_statement", ["else_clause"]), |
80 |
| - branchMatcher("for_statement", ["else_clause"]), |
81 |
| - branchMatcher("try_statement", [ |
82 |
| - "except_clause", |
83 |
| - "finally_clause", |
84 |
| - "else_clause", |
85 |
| - "except_group_clause", |
86 |
| - ]), |
87 |
| - ternaryBranchMatcher("conditional_expression", [0, 2]), |
88 |
| - ), |
89 |
| - ["private.switchStatementSubject"]: "match_statement[subject]", |
90 | 55 | };
|
91 | 56 |
|
92 | 57 | export default createPatternMatchers(nodeMatchers);
|
0 commit comments