MCPcopy Index your code
hub / github.com/cursorless-dev/cursorless / chainedMatcher

Function chainedMatcher

src/util/nodeMatchers.ts:49–69  ·  view source on GitHub ↗
(
  finders: NodeFinder[],
  selector: SelectionExtractor = simpleSelectionExtractor
)

Source from the content-addressed store, hash-verified

47 * @returns A matcher which is a chain of the input node finders
48 */
49export function chainedMatcher(
50 finders: NodeFinder[],
51 selector: SelectionExtractor = simpleSelectionExtractor
52): NodeMatcher {
53 const nodeFinder = chainedNodeFinder(...finders);
54
55 return function (selection: SelectionWithEditor, initialNode: SyntaxNode) {
56 const returnNode = nodeFinder(initialNode);
57
58 if (returnNode == null) {
59 return null;
60 }
61
62 return [
63 {
64 node: returnNode,
65 selection: selector(selection.editor, returnNode),
66 },
67 ];
68 };
69}
70
71export function typeMatcher(...typeNames: string[]) {
72 return matcher(typedNodeFinder(...typeNames));

Callers 2

csharp.tsFile · 0.90
clojure.tsFile · 0.90

Calls 2

chainedNodeFinderFunction · 0.90
nodeFinderFunction · 0.85

Tested by

no test coverage detected