Skip to content

Commit 8048899

Browse files
committed
fixed issues in remote paths of debugger
1 parent 5fff02d commit 8048899

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/client/debugger/Main.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ export class PythonDebugger extends DebugSession {
253253
this.launchArgs.debugOptions.indexOf(DebugOptions.DjangoDebugging) >= 0) {
254254
isDjangoFile = filePath.toUpperCase().endsWith(".HTML");
255255
}
256+
// Todo: Remote DJango debugging
257+
// if (this.attachArgs != null &&
258+
// Array.isArray(this.attachArgs.debugOptions) &&
259+
// this.attachArgs.debugOptions.indexOf(DebugOptions.DjangoDebugging) >= 0) {
260+
// isDjangoFile = filePath.toUpperCase().endsWith(".HTML");
261+
// }
256262

257263
condition = typeof condition === "string" ? condition : "";
258264

@@ -358,11 +364,14 @@ export class PythonDebugger extends DebugSession {
358364
let pathRelativeToSourceRoot = '';
359365
// It is possible we're dealing with cross platform debugging
360366
// If so, then path.relative won't work :(
361-
if (remotePath.toUpperCase().startsWith(this.attachArgs.remoteRoot.toUpperCase())){
362-
pathRelativeToSourceRoot = remotePath.substring(this.attachArgs.remoteRoot.length);
367+
if (remotePath.toUpperCase().startsWith(this.attachArgs.remoteRoot.toUpperCase())) {
368+
pathRelativeToSourceRoot = remotePath.substring(this.attachArgs.remoteRoot.length).trim();
363369
} else {
364370
// get the part of the path that is relative to the source root
365-
pathRelativeToSourceRoot = path.relative(this.attachArgs.remoteRoot, remotePath);
371+
pathRelativeToSourceRoot = path.relative(this.attachArgs.remoteRoot, remotePath).trim();
372+
}
373+
if (pathRelativeToSourceRoot.startsWith(path.sep)){
374+
pathRelativeToSourceRoot = pathRelativeToSourceRoot.substring(1);
366375
}
367376
// resolve from the local source root
368377
return path.resolve(this.attachArgs.localRoot, pathRelativeToSourceRoot);
@@ -584,7 +593,9 @@ export class PythonDebugger extends DebugSession {
584593
mode = enum_EXCEPTION_STATE.BREAK_MODE_ALWAYS;
585594
}
586595
let exToIgnore = null;
587-
let exceptionHandling = this.launchArgs.exceptionHandling;
596+
let exceptionHandling = this.launchArgs ? this.launchArgs.exceptionHandling : null;
597+
// Todo: exception handling for remote debugging
598+
// let exceptionHandling = this.launchArgs ? this.launchArgs.exceptionHandling : this.attachArgs.exceptionHandling;
588599
if (exceptionHandling) {
589600
exToIgnore = new Map<string, enum_EXCEPTION_STATE>();
590601
if (Array.isArray(exceptionHandling.ignore)) {

0 commit comments

Comments
 (0)