MCPcopy Index your code
hub / github.com/continuedev/continue / getParserForFile

Function getParserForFile

core/util/treeSitter.ts:121–138  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

119};
120
121export async function getParserForFile(filepath: string) {
122 try {
123 await Parser.init();
124 const parser = new Parser();
125
126 const language = await getLanguageForFile(filepath);
127 if (!language) {
128 return undefined;
129 }
130
131 parser.setLanguage(language);
132
133 return parser;
134 } catch (e) {
135 console.debug("Unable to load language for file", filepath, e);
136 return undefined;
137 }
138}
139
140// Loading the wasm files to create a Language object is an expensive operation and with
141// sufficient number of files can result in errors, instead keep a map of language name

Callers 7

getSnippetsInFileMethod · 0.90
_getFileInfoMethod · 0.90
getAstFunction · 0.90
expandSnippetFunction · 0.90
codeChunkerFunction · 0.85
getSymbolsForFileFunction · 0.85

Calls 3

getLanguageForFileFunction · 0.85
initMethod · 0.65
debugMethod · 0.45

Tested by

no test coverage detected