MCPcopy
hub / github.com/microsoft/vscode-js-debug / tryGetCompiledFile

Method tryGetCompiledFile

src/targets/node/nodeLauncher.ts:307–334  ·  view source on GitHub ↗

* Gets the compiled version of the given target program, if it exists and * we can find it. Otherwise we fall back to evaluating it directly. * @see https://github.com/microsoft/vscode-js-debug/issues/291

(targetProgram: string)

Source from the content-addressed store, hash-verified

305 * @see https://github.com/microsoft/vscode-js-debug/issues/291
306 */
307 private async tryGetCompiledFile(targetProgram: string) {
308 targetProgram = fixDriveLetterAndSlashes(targetProgram);
309
310 const ext = extname(targetProgram);
311 if (!ext || ext === '.js') {
312 return targetProgram;
313 }
314
315 const mapped = await this.bpPredictor.getPredictionForSource(targetProgram);
316 if (!mapped || mapped.size === 0) {
317 return targetProgram;
318 }
319
320 // There can be more than one compile file per source file. Just pick
321 // whichever one in that case.
322 const entry = iteratorFirst(mapped.values());
323 if (!entry) {
324 return targetProgram;
325 }
326
327 this.logger.info(LogTag.RuntimeLaunch, 'Updating entrypoint to compiled file', {
328 from: targetProgram,
329 to: entry.compiledPath,
330 candidates: mapped.size,
331 });
332
333 return entry.compiledPath;
334 }
335}

Callers 1

launchProgramMethod · 0.95

Calls 5

fixDriveLetterAndSlashesFunction · 0.90
iteratorFirstFunction · 0.90
valuesMethod · 0.80
infoMethod · 0.65

Tested by

no test coverage detected