90 scala support (#91)

Co-authored-by: Colby McHenry <me@colbymchenry.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
firehooper
2026-05-07 22:10:58 -05:00
committed by GitHub
co-authored by Colby McHenry Claude Opus 4.7
parent 00b298966f
commit 8506936f86
6 changed files with 425 additions and 2 deletions
+6 -2
View File
@@ -34,6 +34,7 @@ const WASM_GRAMMAR_FILES: Record<GrammarLanguage, string> = {
kotlin: 'tree-sitter-kotlin.wasm',
dart: 'tree-sitter-dart.wasm',
pascal: 'tree-sitter-pascal.wasm',
scala: 'tree-sitter-scala.wasm',
};
/**
@@ -75,6 +76,8 @@ export const EXTENSION_MAP: Record<string, Language> = {
'.lpr': 'pascal',
'.dfm': 'pascal',
'.fmx': 'pascal',
'.scala': 'scala',
'.sc': 'scala',
};
/**
@@ -122,8 +125,8 @@ export async function loadGrammarsForLanguages(languages: Language[]): Promise<v
for (const lang of toLoad) {
const wasmFile = WASM_GRAMMAR_FILES[lang];
try {
// Pascal ships its own WASM (not in tree-sitter-wasms)
const wasmPath = lang === 'pascal'
// Pascal and Scala ship their own WASMs (not in tree-sitter-wasms)
const wasmPath = (lang === 'pascal' || lang === 'scala')
? path.join(__dirname, 'wasm', wasmFile)
: require.resolve(`tree-sitter-wasms/out/${wasmFile}`);
const language = await WasmLanguage.load(wasmPath);
@@ -287,6 +290,7 @@ export function getLanguageDisplayName(language: Language): string {
vue: 'Vue',
liquid: 'Liquid',
pascal: 'Pascal / Delphi',
scala: 'Scala',
unknown: 'Unknown',
};
return names[language] || language;