MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / initParser

Function initParser

src/core/tree-sitter.ts:114–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112const grammarCache = new Map<string, TSLanguage>();
113
114async function initParser(): Promise<typeof ParserClass> {
115 if (ParserClass) return ParserClass;
116
117 const mod = await import("web-tree-sitter");
118 const Parser = mod.default ?? mod;
119 await Parser.init();
120 ParserClass = Parser;
121 return Parser;
122}
123
124async function loadGrammar(grammarName: string): Promise<TSLanguage | null> {
125 if (grammarCache.has(grammarName)) return grammarCache.get(grammarName)!;

Callers 2

loadGrammarFunction · 0.85
parseWithTreeSitterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected