Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Fix microsoft/vscode#22492 - BPs are lost from the response when seve…
Browse files Browse the repository at this point in the history
…ral BP deletes are queued up at once
  • Loading branch information
roblourens committed Mar 19, 2017
1 parent e95dd18 commit 13726c5
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/transformers/baseSourceMapTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,23 @@ export class BaseSourceMapTransformer {
if (this._sourceMaps && this._requestSeqToSetBreakpointsArgs.has(requestSeq)) {
const args = this._requestSeqToSetBreakpointsArgs.get(requestSeq);
if (args.authoredPath) {
const sourceBPs = this._authoredPathsToMappedBPs.get(args.authoredPath);
if (sourceBPs) {
// authoredPath is set, so the file was mapped to source.
// Remove breakpoints from files that map to the same file, and map back to source.
response.breakpoints = response.breakpoints.filter((_, i) => i < sourceBPs.length);
response.breakpoints.forEach((bp, i) => {
const mapped = this._sourceMaps.mapToAuthored(args.generatedPath, bp.line, bp.column);
if (mapped) {
logger.log(`SourceMaps.setBP: Mapped ${args.generatedPath}:${bp.line + 1}:${bp.column + 1} to ${mapped.source}:${mapped.line + 1}`);
bp.line = mapped.line;
bp.column = mapped.column;
} else {
logger.log(`SourceMaps.setBP: Can't map ${args.generatedPath}:${bp.line + 1}:${bp.column + 1}, keeping original line numbers.`);
bp.line = args.originalBPs[i].line;
bp.column = args.originalBPs[i].column;
}

this._requestSeqToSetBreakpointsArgs.delete(requestSeq);
});
}
// authoredPath is set, so the file was mapped to source.
// Remove breakpoints from files that map to the same file, and map back to source.
response.breakpoints = response.breakpoints.filter((_, i) => i < args.originalBPs.length);
response.breakpoints.forEach((bp, i) => {
const mapped = this._sourceMaps.mapToAuthored(args.generatedPath, bp.line, bp.column);
if (mapped) {
logger.log(`SourceMaps.setBP: Mapped ${args.generatedPath}:${bp.line + 1}:${bp.column + 1} to ${mapped.source}:${mapped.line + 1}`);
bp.line = mapped.line;
bp.column = mapped.column;
} else {
logger.log(`SourceMaps.setBP: Can't map ${args.generatedPath}:${bp.line + 1}:${bp.column + 1}, keeping original line numbers.`);
bp.line = args.originalBPs[i].line;
bp.column = args.originalBPs[i].column;
}

this._requestSeqToSetBreakpointsArgs.delete(requestSeq);
});
}
}
}
Expand Down

0 comments on commit 13726c5

Please sign in to comment.