MCPcopy Index your code
hub / github.com/CodeGraphContext/CodeGraphContext / initParser

Function initParser

website/src/lib/parser.worker.ts:9–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7const wasmLanguageCache = new Map<string, any>();
8
9async function initParser() {
10 if (parser) return;
11 if (!initPromise) {
12 initPromise = (async () => {
13 await Parser.init({
14 locateFile(scriptName: string) {
15 if (scriptName.endsWith('tree-sitter.wasm')) {
16 return treeSitterWasmUrl;
17 }
18 return `${location.origin}/wasm/${scriptName}`;
19 }
20 });
21 parser = new Parser();
22 })();
23 }
24 await initPromise;
25}
26
27async function getLanguageForFile(path: string) {
28 if (!parser) await initParser();

Callers 2

getLanguageForFileFunction · 0.85
parser.worker.tsFile · 0.85

Calls 1

initMethod · 0.45

Tested by

no test coverage detected