MCPcopy
hub / github.com/yamadashy/repomix / getLanguageParserSingleton

Function getLanguageParserSingleton

src/core/treeSitter/parseFile.ts:125–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123};
124
125const getLanguageParserSingleton = async () => {
126 if (!languageParserSingleton) {
127 // Assign only after init() succeeds. Otherwise a failed init would leave an
128 // uninitialized parser cached for the rest of the worker's lifetime, so
129 // every subsequent file would throw "not initialized" and silently lose
130 // compression. Keeping the singleton null lets the next call retry init.
131 const parser = new LanguageParser();
132 await parser.init();
133 languageParserSingleton = parser;
134 }
135 return languageParserSingleton;
136};
137/**
138 * Clean up the language parser singleton by deleting all loaded parsers
139 */

Callers 1

parseFileFunction · 0.85

Calls 1

initMethod · 0.95

Tested by

no test coverage detected