Skip to content

Commit afcf222

Browse files
fix(debugger): Fix path normalization in debugger sourcemaps handling (#279)
1 parent 6cdcc0e commit afcf222

File tree

3 files changed

+102
-532
lines changed

3 files changed

+102
-532
lines changed

debugger/vscode-dap-extension/.vscode/launch.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "Extension",
5+
"name": "Extension test (JS)",
66
"type": "extensionHost",
77
"request": "launch",
88
"args": [
@@ -15,19 +15,18 @@
1515
"preLaunchTask": "npm: watch"
1616
},
1717
{
18-
"name": "Web Extension",
18+
"name": "Extension test (TS)",
1919
"type": "extensionHost",
2020
"debugWebWorkerHost": true,
2121
"request": "launch",
2222
"args": [
2323
"--extensionDevelopmentPath=${workspaceFolder}",
24-
"--extensionDevelopmentKind=web",
2524
"${workspaceFolder}/tests/ts"
2625
],
2726
"outFiles": [
2827
"${workspaceFolder}/dist/**/*.js"
2928
],
30-
"preLaunchTask": "npm: watch web"
29+
"preLaunchTask": "npm: watch"
3130
},
3231
// TODO: enable the server configuration, once passing the required arguments is figured out
3332
// {

debugger/vscode-dap-extension/src/sourcemaps/sourceMaps.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -619,16 +619,11 @@ export class SourceMap {
619619

620620
// use source-map utilities to normalize sources entries
621621
this._sources = sm.sources.map(util.normalize).map((source: any) => {
622-
if (this._sourceRoot && util.isAbsolute(this._sourceRoot) && util.isAbsolute(source)) {
622+
if (this._sourceRoot && PathUtils.isAbsolutePath(this._sourceRoot) && PathUtils.isAbsolutePath(source)) {
623623
return util.relative(this._sourceRoot, source);
624624
} else {
625625
return source;
626626
}
627-
// return this._sourceRoot &&
628-
// util.isAbsolute(this._sourceRoot) &&
629-
// util.isAbsolute(source)
630-
// ? util.relative(this._sourceRoot, source)
631-
// : source;
632627
});
633628

634629
return new SM.SourceMapConsumer(sm).then(x => {
@@ -650,7 +645,7 @@ export class SourceMap {
650645
public allSourcePaths(): string[] {
651646
const paths = new Array<string>();
652647
for (let name of this._sources!) {
653-
if (!util.isAbsolute(name)) {
648+
if (!PathUtils.isAbsolutePath(name)) {
654649
name = util.join(this._sourceRoot, name);
655650
}
656651
paths.push(name);

0 commit comments

Comments
 (0)