MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / getParsedIndexFile

Method getParsedIndexFile

src/helpViewer/packages.ts:347–371  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

345 // retrieve and parse an index file
346 // (either list of all packages, or documentation entries of a package)
347 private async getParsedIndexFile(path: string): Promise<IndexEntry[]|undefined> {
348
349 let indexItems = this.getCachedIndexFile(path);
350
351 // only read and parse file if not cached yet
352 if(!indexItems){
353 const helpFile = await this.rHelp.getHelpFileForPath(path, false);
354 if(!helpFile?.html){
355 // set missing files to null
356 indexItems = undefined;
357 } else{
358 // parse and cache file
359 indexItems = parseIndexFile(helpFile.html);
360 }
361 void this.updateCachedIndexFile(path, indexItems);
362 }
363
364 // return cache entry. make new array to avoid messing with the cache
365 let ret: IndexEntry[] | undefined = undefined;
366 if(indexItems){
367 ret = [];
368 ret.push(...indexItems);
369 }
370 return ret;
371 }
372}
373
374

Callers 2

getPackagesMethod · 0.95
getTopicsMethod · 0.95

Calls 4

getCachedIndexFileMethod · 0.95
updateCachedIndexFileMethod · 0.95
parseIndexFileFunction · 0.85
getHelpFileForPathMethod · 0.80

Tested by

no test coverage detected