Skip to content

Commit 7168f8b

Browse files
committed
Resolve localSourceRoot relative to args.cwd, not process.cwd()
1 parent c5ed449 commit 7168f8b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
"localSourceRoot": {
8585
"type": "string",
8686
"description": "The source root on this machine that is the equivalent to the serverSourceRoot on the server. May be relative to the project root."
87+
},
88+
"cwd": {
89+
"type": "string",
90+
"description": "The current working directory, by default the project root"
8791
}
8892
}
8993
}

src/phpDebug.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ interface LaunchRequestArguments extends VSCodeDebugProtocol.LaunchRequestArgume
4444
stopOnEntry?: boolean;
4545
/** The source root on the server when doing remote debugging on a different host */
4646
serverSourceRoot?: string;
47-
/** The path to the source root on this machine that is the equivalent to the serverSourceRoot on the server. May be relative to the project root. */
47+
/** The path to the source root on this machine that is the equivalent to the serverSourceRoot on the server. May be relative to cwd. */
4848
localSourceRoot?: string;
49+
/** The current working directory, by default the project root */
50+
cwd?: string;
4951
}
5052

5153
class PhpDebugSession extends vscode.DebugSession {
@@ -93,7 +95,7 @@ class PhpDebugSession extends vscode.DebugSession {
9395
args.localSourceRoot = '.';
9496
}
9597
// resolve localSourceRoot relative to the project root
96-
args.localSourceRoot = path.resolve(process.cwd(), args.localSourceRoot);
98+
args.localSourceRoot = path.resolve(args.cwd, args.localSourceRoot);
9799
}
98100
this._args = args;
99101
const server = this._server = net.createServer();

0 commit comments

Comments
 (0)