Skip to content

Commit 6cb8583

Browse files
committed
fix breakpoints for js files with no sourceMap
1 parent 8d4b3f4 commit 6cb8583

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

adapter/sourceMaps/sourceMapTransformer.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,20 @@ export class SourceMapTransformer implements IDebugTransformer {
4545
this._authoredPathsToMappedBPLines = new Map<string, number[]>();
4646
this._authoredPathsToMappedBPCols = new Map<string, number[]>();
4747
}
48+
49+
let stringProto: any = String.prototype;
50+
if (!stringProto.endsWith)
51+
{
52+
stringProto.endsWith = function(str)
53+
{
54+
var lastIndex = this.lastIndexOf(str);
55+
return (lastIndex !== -1) && (lastIndex + str.length === this.length);
56+
}
57+
}
4858
}
4959

60+
61+
5062
public clearTargetContext(): void {
5163
this._allRuntimeScriptPaths = new Set<string>();
5264
}
@@ -56,7 +68,7 @@ export class SourceMapTransformer implements IDebugTransformer {
5668
*/
5769
public setBreakpoints(args: ISetBreakpointsArgs, requestSeq: number): Promise<void> {
5870
return new Promise<void>((resolve, reject) => {
59-
if (this._sourceMaps && args.source.path) {
71+
if (this._sourceMaps && args.source.path && path.extname(args.source.path) !== ".js") {
6072
const argsPath = args.source.path;
6173
const mappedPath = this._sourceMaps.MapPathFromSource(argsPath);
6274
if (mappedPath) {

0 commit comments

Comments
 (0)