Skip to content

Commit fc7e717

Browse files
Фикс разбора объекта pathsMapper из launch.json
1 parent 7f659e9 commit fc7e717

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

src/VSCode.DebugAdapter/DebugeeProcess.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ public void Init(JObject args)
110110
InitInternal(args);
111111
}
112112

113+
public void InitPathsMapper(JObject args)
114+
{
115+
116+
try
117+
{
118+
PathsMapper = args.ToObject<WorkspaceMapper>();
119+
}
120+
catch
121+
{
122+
PathsMapper = new WorkspaceMapper("", "");
123+
}
124+
125+
}
126+
113127
protected abstract Process CreateProcess();
114128

115129
protected abstract void InitInternal(JObject args);

src/VSCode.DebugAdapter/OscriptDebugSession.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,7 @@ public override void Initialize(Response response, dynamic args)
3636
AdapterID = (string) args.adapterID;
3737

3838
_debuggee = DebugeeFactory.CreateProcess(AdapterID, PathStrategy);
39-
40-
dynamic pathsMappingObj = GetFromContainer<dynamic>(args, "pathsMapping", null);
41-
42-
if (pathsMappingObj != null)
43-
{
44-
string localPath = GetFromContainer(pathsMappingObj, "localPath", "");
45-
string remotePath = GetFromContainer(pathsMappingObj, "remotePath", "");
46-
47-
_debuggee.PathsMapper = new WorkspaceMapper(localPath, remotePath);
48-
}
49-
else
50-
{
51-
_debuggee.PathsMapper = new WorkspaceMapper("", "");
52-
}
39+
_debuggee.InitPathsMapper(args);
5340

5441
SendResponse(response, new Capabilities
5542
{

src/VSCode.DebugAdapter/WorkspaceMapper.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This Source Code Form is subject to the terms of the
66
----------------------------------------------------------*/
77
using System;
88
using System.Runtime.InteropServices;
9+
using Newtonsoft.Json;
910

1011
namespace VSCode.DebugAdapter
1112
{
@@ -15,6 +16,20 @@ public class WorkspaceMapper
1516
private Workspace _localWorkspace;
1617
private Workspace _remoteWorkspace;
1718

19+
[JsonProperty("localPath")]
20+
private string LocalPathForDeserialization
21+
{
22+
set { _localWorkspace = new Workspace(value ?? ""); }
23+
}
24+
25+
[JsonProperty("remotePath")]
26+
private string RemotePathForDeserialization
27+
{
28+
set { _remoteWorkspace = new Workspace(value ?? ""); }
29+
}
30+
31+
public WorkspaceMapper(){}
32+
1833
public WorkspaceMapper(string localPath, string remotePath) {
1934

2035
this._localWorkspace = new Workspace(localPath);

0 commit comments

Comments
 (0)