Skip to content

Commit b4cea00

Browse files
committed
added sourceBasePath, separated from workingDirectory
1 parent 2871fa7 commit b4cea00

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

DebugAdapter/DebugSession.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class DebugSession : ICDPListener, IDebuggeeListener, IRemoteControllerLi
3131
RemoteController giderosRemoteController;
3232
string giderosStdoutBuffer = "";
3333
string workingDirectory;
34+
string sourceBasePath;
3435
Tuple<string, int> fakeBreakpointMode = null;
3536
string startCommand;
3637
int startSeq;
@@ -63,7 +64,7 @@ void ICDPListener.X_FromVSCode(string command, int seq, dynamic args, string req
6364
}
6465
else if (command == "stackTrace")
6566
{
66-
var src = new Source(Path.Combine(workingDirectory, fakeBreakpointMode.Item1));
67+
var src = new Source(Path.Combine(sourceBasePath, fakeBreakpointMode.Item1));
6768
var f = new StackFrame(9999, "fake-frame", src, fakeBreakpointMode.Item2, 0);
6869
SendResponse(command, seq, new StackTraceResponseBody(
6970
new List<StackFrame>() { f }));
@@ -221,7 +222,6 @@ void Launch(string command, int seq, dynamic args)
221222
}
222223

223224
//--------------------------------
224-
// validate argument 'workingDirectory'
225225
if (!ReadBasicConfiguration(command, seq, args)) { return; }
226226

227227
//--------------------------------
@@ -374,7 +374,7 @@ bool ReadBasicConfiguration(string command, int seq, dynamic args)
374374
workingDirectory = workingDirectory.Trim();
375375
if (workingDirectory.Length == 0)
376376
{
377-
SendErrorResponse(command, seq, 3003, "Property 'cwd' is empty.");
377+
SendErrorResponse(command, seq, 3003, "Property 'workingDirectory' is empty.");
378378
return false;
379379
}
380380
if (!Directory.Exists(workingDirectory))
@@ -395,6 +395,15 @@ bool ReadBasicConfiguration(string command, int seq, dynamic args)
395395
stopGiderosWhenDebuggerStops = true;
396396
}
397397

398+
if (args.sourceBasePath != null)
399+
{
400+
sourceBasePath = (string)args.sourceBasePath;
401+
}
402+
else
403+
{
404+
sourceBasePath = workingDirectory;
405+
}
406+
398407
return true;
399408
}
400409

@@ -408,7 +417,7 @@ void IDebuggeeListener.X_DebuggeeArrived(IDebuggeeSender toDebuggee)
408417
var welcome = new
409418
{
410419
command = "welcome",
411-
sourceBasePath = workingDirectory
420+
sourceBasePath = sourceBasePath
412421
};
413422
toDebuggee.Send(JsonConvert.SerializeObject(welcome));
414423

Extension/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@
8585
"description": "Working directory",
8686
"default": "${workspaceRoot}"
8787
},
88+
"sourceBasePath": {
89+
"type": "string",
90+
"description": "Base path of lua source files",
91+
"default": "${workspaceRoot}"
92+
},
8893
"executable": {
8994
"type": "string",
9095
"description": "An exe file to launch",
@@ -147,6 +152,11 @@
147152
"description": "Working directory",
148153
"default": "${workspaceRoot}"
149154
},
155+
"sourceBasePath": {
156+
"type": "string",
157+
"description": "Base path of lua source files",
158+
"default": "${workspaceRoot}"
159+
},
150160
"listenPublicly": {
151161
"type": "boolean",
152162
"description": "Set this to true if the debuggee will run in different computer.",

0 commit comments

Comments
 (0)