Skip to content

Commit 01966b1

Browse files
Remove our own implementation of the match predicate (#2785)
The match predicate is built into Tree sitter and our own code was actually never running ## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet
1 parent ab072ee commit 01966b1

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,6 @@ class HasMultipleChildrenOfType extends QueryPredicateOperator<HasMultipleChildr
6262
}
6363
}
6464

65-
/**
66-
* A predicate operator that returns true if the nodes text matched the regular expression
67-
*/
68-
class Match extends QueryPredicateOperator<Match> {
69-
name = "match?" as const;
70-
schema = z.tuple([q.node, q.string]);
71-
72-
run(nodeInfo: MutableQueryCapture, pattern: string) {
73-
const { document, range } = nodeInfo;
74-
const regex = new RegExp(pattern, "ds");
75-
const text = document.getText(range);
76-
return regex.test(text);
77-
}
78-
}
79-
8065
class ChildRange extends QueryPredicateOperator<ChildRange> {
8166
name = "child-range!" as const;
8267
schema = z.union([
@@ -292,5 +277,4 @@ export const queryPredicateOperators = [
292277
new InsertionDelimiter(),
293278
new SingleOrMultilineDelimiter(),
294279
new HasMultipleChildrenOfType(),
295-
new Match(),
296280
];

0 commit comments

Comments
 (0)