()
| 112 | const grammarCache = new Map<string, TSLanguage>(); |
| 113 | |
| 114 | async function initParser(): Promise<typeof ParserClass> { |
| 115 | if (ParserClass) return ParserClass; |
| 116 | |
| 117 | const mod = await import("web-tree-sitter"); |
| 118 | const Parser = mod.default ?? mod; |
| 119 | await Parser.init(); |
| 120 | ParserClass = Parser; |
| 121 | return Parser; |
| 122 | } |
| 123 | |
| 124 | async function loadGrammar(grammarName: string): Promise<TSLanguage | null> { |
| 125 | if (grammarCache.has(grammarName)) return grammarCache.get(grammarName)!; |
no outgoing calls
no test coverage detected