From 13726c53d3b9d4abb753347e50dc6665909dc29b Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Sun, 19 Mar 2017 10:46:45 -0700 Subject: [PATCH] Fix Microsoft/vscode#22492 - BPs are lost from the response when several BP deletes are queued up at once --- src/transformers/baseSourceMapTransformer.ts | 37 +++++++++----------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/transformers/baseSourceMapTransformer.ts b/src/transformers/baseSourceMapTransformer.ts index 9fa8d6ddd..37aff5797 100644 --- a/src/transformers/baseSourceMapTransformer.ts +++ b/src/transformers/baseSourceMapTransformer.ts @@ -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); + }); } } }