MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / initParser

Function initParser

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

Source from the content-addressed store, hash-verified

35const wasmLanguageCache = new Map<string, any>();
36
37async function initParser() {
38 if (parser) return;
39 if (!initPromise) {
40 initPromise = (async () => {
41 await Parser.init({
42 locateFile(scriptName: string) {
43 if (scriptName.endsWith('tree-sitter.wasm')) {
44 return treeSitterWasmUrl;
45 }
46 return `${location.origin}/wasm/${scriptName}`;
47 }
48 });
49 parser = new Parser();
50 })();
51 }
52 await initPromise;
53}
54
55async function getLanguageForFile(path: string) {
56 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