MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / getNodeMatcher

Function getNodeMatcher

src/languages/getNodeMatcher.ts:23–45  ·  view source on GitHub ↗
(
  languageId: string,
  scopeType: ScopeType,
  includeSiblings: boolean
)

Source from the content-addressed store, hash-verified

21import { SupportedLanguageId } from "./constants";
22
23export function getNodeMatcher(
24 languageId: string,
25 scopeType: ScopeType,
26 includeSiblings: boolean
27): NodeMatcher {
28 const matchers = languageMatchers[languageId as SupportedLanguageId];
29
30 if (matchers == null) {
31 throw new UnsupportedLanguageError(languageId);
32 }
33
34 const matcher = matchers[scopeType];
35
36 if (matcher == null) {
37 return notSupported;
38 }
39
40 if (includeSiblings) {
41 return matcherIncludeSiblings(matcher);
42 }
43
44 return matcher;
45}
46
47const languageMatchers: Record<
48 SupportedLanguageId,

Calls 1

matcherIncludeSiblingsFunction · 0.85

Tested by

no test coverage detected