Skip to content

Commit 4a5fdc0

Browse files
committed
Update to vscode-debugadapter 1.36.0
1 parent 3c14bc5 commit 4a5fdc0

File tree

6 files changed

+48
-41
lines changed

6 files changed

+48
-41
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ haxe:
55

66
install:
77
- haxelib install vscode
8-
- haxelib git vscode-debugadapter https://github.com/vshaxe/vscode-debugadapter-extern
9-
- haxelib git hxnodejs https://github.com/HaxeFoundation/hxnodejs
8+
- haxelib install vscode-debugadapter
109

1110
script:
1211
- haxe build.hxml

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ Replace `/bin/application.exe` with the path to your executable file.
5050

5151
```hxml
5252
npm install
53-
haxelib install hxnodejs
5453
haxelib install vscode
55-
haxelib git vscode-debugadapter https://github.com/vshaxe/vscode-debugadapter-extern
54+
haxelib install vscode-debugadapter
5655
```
5756
5857
5. Do `haxe build.hxml`

build.hxml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
-lib vscode-debugadapter
2-
-lib hxnodejs
31
-lib vscode
2+
-lib vscode-debugadapter
43
-cp src
54
-cp hxcpp-debug-server
5+
-D js-es=6
66
-js bin/adapter.js
77
-main Adapter
88

99
--next
1010

1111
-lib vscode
1212
-cp src
13+
-D js-es=6
1314
-js bin/extension.js
1415
Extension

package-lock.json

Lines changed: 22 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "vshaxe"
1010
},
1111
"engines": {
12-
"vscode": "^1.4.0"
12+
"vscode": "^1.36.0"
1313
},
1414
"categories": [
1515
"Debuggers"
@@ -32,8 +32,8 @@
3232
"url": "https://github.com/vshaxe/hxcpp-debugger/issues"
3333
},
3434
"dependencies": {
35-
"vscode-debugprotocol": "1.19.0",
36-
"vscode-debugadapter": "1.19.0"
35+
"vscode-debugprotocol": "1.36.0",
36+
"vscode-debugadapter": "1.36.0"
3737
},
3838
"scripts": {
3939
"vscode:prepublish": "haxe build.hxml"
@@ -54,11 +54,6 @@
5454
{
5555
"type": "hxcpp",
5656
"label": "HXCPP",
57-
"enableBreakpointsFor": {
58-
"languageIds": [
59-
"haxe"
60-
]
61-
},
6257
"program": "./bin/adapter.js",
6358
"runtime": "node",
6459
"configurationAttributes": {

src/Adapter.hx

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import haxe.Json;
21
import js.node.net.Socket;
32
import haxe.io.Path;
4-
import protocol.debug.Types;
3+
import vscode.debugAdapter.DebugSession;
4+
import vscode.debugProtocol.DebugProtocol;
55
import js.node.Buffer;
66
import js.node.Net;
77
import js.node.ChildProcess;
@@ -10,25 +10,24 @@ import js.node.net.Socket.SocketEvent;
1010
import js.node.stream.Readable.ReadableEvent;
1111
import hxcpp.debug.jsonrpc.Protocol;
1212

13-
typedef HxppLaunchRequestArguments = {
14-
> protocol.debug.Types.LaunchRequestArguments,
13+
typedef HxppLaunchRequestArguments = LaunchRequestArguments & {
1514
var program:String;
1615
}
1716

1817
@:keep
19-
class Adapter extends adapter.DebugSession {
18+
class Adapter extends DebugSession {
2019
function traceToOutput(value:Dynamic, ?infos:haxe.PosInfos) {
2120
var msg = value;
2221
if (infos != null && infos.customParams != null) {
2322
msg += " " + infos.customParams.join(" ");
2423
}
2524
msg += "\n";
26-
sendEvent(new adapter.DebugSession.OutputEvent(msg));
25+
sendEvent(new vscode.debugAdapter.DebugSession.OutputEvent(msg));
2726
}
2827

2928
override function initializeRequest(response:InitializeResponse, args:InitializeRequestArguments) {
3029
haxe.Log.trace = traceToOutput;
31-
sendEvent(new adapter.DebugSession.InitializedEvent());
30+
sendEvent(new vscode.debugAdapter.DebugSession.InitializedEvent());
3231
response.body.supportsSetVariable = true;
3332
response.body.supportsValueFormattingOptions = false;
3433
response.body.supportsCompletionsRequest = true;
@@ -68,13 +67,13 @@ class Adapter extends adapter.DebugSession {
6867
}
6968

7069
function onExit(_, _) {
71-
sendEvent(new adapter.DebugSession.TerminatedEvent(false));
70+
sendEvent(new vscode.debugAdapter.DebugSession.TerminatedEvent(false));
7271
}
7372

7473
var server = Net.createServer(onConnected);
7574
server.listen(6972, function() {
7675
var args = [];
77-
var haxeProcess = ChildProcess.spawn(executable, args, {stdio: Pipe, cwd: Path.directory(executable)});
76+
var haxeProcess = ChildProcess.spawn(executable, args, {stdio: Pipe, cwd: haxe.io.Path.directory(executable)});
7877
haxeProcess.stdout.on(ReadableEvent.Data, onStdout);
7978
haxeProcess.stderr.on(ReadableEvent.Data, onStderr);
8079
haxeProcess.on(ChildProcessEvent.Exit, onExit);
@@ -97,38 +96,38 @@ class Adapter extends adapter.DebugSession {
9796
});
9897

9998
function onExit() {
100-
sendEvent(new adapter.DebugSession.TerminatedEvent(false));
99+
sendEvent(new vscode.debugAdapter.DebugSession.TerminatedEvent(false));
101100
}
102101
socket.on(SocketEvent.End, onExit);
103102
}
104103

105104
function onStdout(data:Buffer) {
106-
sendEvent(new adapter.DebugSession.OutputEvent(data.toString("utf-8"), stdout));
105+
sendEvent(new vscode.debugAdapter.DebugSession.OutputEvent(data.toString("utf-8"), Stdout));
107106
}
108107

109108
function onStderr(data:Buffer) {
110-
sendEvent(new adapter.DebugSession.OutputEvent(data.toString("utf-8"), stderr));
109+
sendEvent(new vscode.debugAdapter.DebugSession.OutputEvent(data.toString("utf-8"), Stderr));
111110
}
112111

113112
function onEvent<P>(type:NotificationMethod<P>, data:P) {
114113
switch (type) {
115114
case Protocol.PauseStop:
116-
sendEvent(new adapter.DebugSession.StoppedEvent("pause", data.threadId));
115+
sendEvent(new vscode.debugAdapter.DebugSession.StoppedEvent("pause", data.threadId));
117116

118117
case Protocol.BreakpointStop:
119-
sendEvent(new adapter.DebugSession.StoppedEvent("breakpoint", data.threadId));
118+
sendEvent(new vscode.debugAdapter.DebugSession.StoppedEvent("breakpoint", data.threadId));
120119

121120
case Protocol.ExceptionStop:
122-
var evt = new adapter.DebugSession.StoppedEvent("exception", 0);
121+
var evt = new vscode.debugAdapter.DebugSession.StoppedEvent("exception", 0);
123122
evt.body.text = data.text;
124123
sendEvent(evt);
125124

126125
case Protocol.ThreadStart:
127-
var evt = new adapter.DebugSession.ThreadEvent(ThreadEventReason.started, data.threadId);
126+
var evt = new vscode.debugAdapter.DebugSession.ThreadEvent(ThreadEventReason.Started, data.threadId);
128127
sendEvent(evt);
129128

130129
case Protocol.ThreadExit:
131-
var evt = new adapter.DebugSession.ThreadEvent(ThreadEventReason.exited, data.threadId);
130+
var evt = new vscode.debugAdapter.DebugSession.ThreadEvent(ThreadEventReason.Exited, data.threadId);
132131
sendEvent(evt);
133132
}
134133
}
@@ -322,10 +321,10 @@ class Adapter extends adapter.DebugSession {
322321
} else {
323322
return null;
324323
}
325-
return cast new adapter.DebugSession.Source(fileName, convertDebuggerPathToClient(filePath));
324+
return cast new vscode.debugAdapter.DebugSession.Source(fileName, convertDebuggerPathToClient(filePath));
326325
}
327326

328327
static function main() {
329-
adapter.DebugSession.run(Adapter);
328+
DebugSession.run(Adapter);
330329
}
331330
}

0 commit comments

Comments
 (0)