( fileExtension: string, )
| 198 | } |
| 199 | |
| 200 | async function loadLanguageForFileExt( |
| 201 | fileExtension: string, |
| 202 | ): Promise<Language> { |
| 203 | const wasmPath = path.join( |
| 204 | process.env.NODE_ENV === "test" ? process.cwd() : __dirname, |
| 205 | ...(process.env.NODE_ENV === "test" |
| 206 | ? ["node_modules", "tree-sitter-wasms", "out"] |
| 207 | : ["tree-sitter-wasms"]), |
| 208 | `tree-sitter-${supportedLanguages[fileExtension]}.wasm`, |
| 209 | ); |
| 210 | return await Parser.Language.load(wasmPath); |
| 211 | } |
| 212 | |
| 213 | // See https://tree-sitter.github.io/tree-sitter/using-parsers |
| 214 | const GET_SYMBOLS_FOR_NODE_TYPES: Parser.SyntaxNode["type"][] = [ |
no test coverage detected