Merge branch 'main' into delphi-support
This commit is contained in:
@@ -94,10 +94,10 @@ export async function initGrammars(): Promise<void> {
|
|||||||
|
|
||||||
await Parser.init();
|
await Parser.init();
|
||||||
|
|
||||||
// Load all grammars in parallel
|
// Load grammars sequentially to avoid web-tree-sitter WASM race condition on Node 20+
|
||||||
|
// See: https://github.com/tree-sitter/tree-sitter/issues/2338
|
||||||
const entries = Object.entries(WASM_GRAMMAR_FILES) as [GrammarLanguage, string][];
|
const entries = Object.entries(WASM_GRAMMAR_FILES) as [GrammarLanguage, string][];
|
||||||
await Promise.allSettled(
|
for (const [lang, wasmFile] of entries) {
|
||||||
entries.map(async ([lang, wasmFile]) => {
|
|
||||||
try {
|
try {
|
||||||
// Pascal ships its own WASM (not in tree-sitter-wasms)
|
// Pascal ships its own WASM (not in tree-sitter-wasms)
|
||||||
const wasmPath = lang === 'pascal'
|
const wasmPath = lang === 'pascal'
|
||||||
@@ -110,8 +110,7 @@ export async function initGrammars(): Promise<void> {
|
|||||||
console.warn(`[CodeGraph] Failed to load ${lang} grammar — parsing will be unavailable: ${message}`);
|
console.warn(`[CodeGraph] Failed to load ${lang} grammar — parsing will be unavailable: ${message}`);
|
||||||
unavailableGrammarErrors.set(lang, message);
|
unavailableGrammarErrors.set(lang, message);
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
);
|
|
||||||
|
|
||||||
grammarsInitialized = true;
|
grammarsInitialized = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user