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

Function matcher

src/util/nodeMatchers.ts:24–39  ·  view source on GitHub ↗
(
  finder: NodeFinder,
  selector: SelectionExtractor = simpleSelectionExtractor
)

Source from the content-addressed store, hash-verified

22} from "./nodeFinders";
23
24export function matcher(
25 finder: NodeFinder,
26 selector: SelectionExtractor = simpleSelectionExtractor
27): NodeMatcher {
28 return function (selection: SelectionWithEditor, node: SyntaxNode) {
29 const targetNode = finder(node, selection.selection);
30 return targetNode != null
31 ? [
32 {
33 node: targetNode,
34 selection: selector(selection.editor, targetNode),
35 },
36 ]
37 : null;
38 };
39}
40
41/**
42 * Given a list of node finders returns a matcher which applies them in

Callers 13

valueMatcherFunction · 0.90
csharp.tsFile · 0.90
functionNameBasedMatcherFunction · 0.90
clojure.tsFile · 0.90
matcherIncludeSiblingsFunction · 0.85
typeMatcherFunction · 0.85
patternMatcherFunction · 0.85
argumentMatcherFunction · 0.85
conditionMatcherFunction · 0.85
childAtIndexMatcherFunction · 0.85
leadingMatcherFunction · 0.85
trailingMatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected