From 4a5fdc0adcce7e6d028fb64aaf9777695110341d Mon Sep 17 00:00:00 2001 From: Jens Fischer Date: Sat, 7 Sep 2019 15:20:14 +0200 Subject: [PATCH] Update to vscode-debugadapter 1.36.0 --- .travis.yml | 3 +-- README.md | 3 +-- build.hxml | 5 +++-- package-lock.json | 30 ++++++++++++++++++++++-------- package.json | 11 +++-------- src/Adapter.hx | 37 ++++++++++++++++++------------------- 6 files changed, 48 insertions(+), 41 deletions(-) diff --git a/.travis.yml b/.travis.yml index ccdad9c..f99289f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ haxe: install: - haxelib install vscode - - haxelib git vscode-debugadapter https://github.com/vshaxe/vscode-debugadapter-extern - - haxelib git hxnodejs https://github.com/HaxeFoundation/hxnodejs + - haxelib install vscode-debugadapter script: - haxe build.hxml diff --git a/README.md b/README.md index 071065a..7b703be 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,8 @@ Replace `/bin/application.exe` with the path to your executable file. ```hxml npm install - haxelib install hxnodejs haxelib install vscode - haxelib git vscode-debugadapter https://github.com/vshaxe/vscode-debugadapter-extern + haxelib install vscode-debugadapter ``` 5. Do `haxe build.hxml` diff --git a/build.hxml b/build.hxml index ed95d61..1439b46 100644 --- a/build.hxml +++ b/build.hxml @@ -1,8 +1,8 @@ --lib vscode-debugadapter --lib hxnodejs -lib vscode +-lib vscode-debugadapter -cp src -cp hxcpp-debug-server +-D js-es=6 -js bin/adapter.js -main Adapter @@ -10,5 +10,6 @@ -lib vscode -cp src +-D js-es=6 -js bin/extension.js Extension diff --git a/package-lock.json b/package-lock.json index b967c09..4efa8b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,35 @@ { "name": "hxcpp-debugger", - "version": "1.2.3", + "version": "1.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + } + }, "vscode-debugadapter": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/vscode-debugadapter/-/vscode-debugadapter-1.19.0.tgz", - "integrity": "sha1-qoLqv3oHmhdfXS1JUkWlmhVpd+U=", + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/vscode-debugadapter/-/vscode-debugadapter-1.36.0.tgz", + "integrity": "sha512-SYDoXAU4c54ZiHdz+Ib1mOZF876S1+dFrNJooa7VAg8sK4wTS0GJQGdqK52B5Hylff9bJJsPVTPIsI2+f9Zwjg==", "requires": { - "vscode-debugprotocol": "^1.19.0" + "mkdirp": "^0.5.1", + "vscode-debugprotocol": "1.36.0" } }, "vscode-debugprotocol": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.19.0.tgz", - "integrity": "sha1-sz8QluCY83WmVF4mQdg5O0rACTM=" + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.36.0.tgz", + "integrity": "sha512-F0MfcUkF88TfNf4iQbcmC+K9rA+zsrQpEz1XpTKidy5sMq8sYsJGUadYDGmmktfjRX+S/ebjHgM+YV/2qm6lVQ==" } } } diff --git a/package.json b/package.json index 47f6576..9eff105 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "name": "vshaxe" }, "engines": { - "vscode": "^1.4.0" + "vscode": "^1.36.0" }, "categories": [ "Debuggers" @@ -32,8 +32,8 @@ "url": "https://github.com/vshaxe/hxcpp-debugger/issues" }, "dependencies": { - "vscode-debugprotocol": "1.19.0", - "vscode-debugadapter": "1.19.0" + "vscode-debugprotocol": "1.36.0", + "vscode-debugadapter": "1.36.0" }, "scripts": { "vscode:prepublish": "haxe build.hxml" @@ -54,11 +54,6 @@ { "type": "hxcpp", "label": "HXCPP", - "enableBreakpointsFor": { - "languageIds": [ - "haxe" - ] - }, "program": "./bin/adapter.js", "runtime": "node", "configurationAttributes": { diff --git a/src/Adapter.hx b/src/Adapter.hx index ee33357..debcf77 100644 --- a/src/Adapter.hx +++ b/src/Adapter.hx @@ -1,7 +1,7 @@ -import haxe.Json; import js.node.net.Socket; import haxe.io.Path; -import protocol.debug.Types; +import vscode.debugAdapter.DebugSession; +import vscode.debugProtocol.DebugProtocol; import js.node.Buffer; import js.node.Net; import js.node.ChildProcess; @@ -10,25 +10,24 @@ import js.node.net.Socket.SocketEvent; import js.node.stream.Readable.ReadableEvent; import hxcpp.debug.jsonrpc.Protocol; -typedef HxppLaunchRequestArguments = { - > protocol.debug.Types.LaunchRequestArguments, +typedef HxppLaunchRequestArguments = LaunchRequestArguments & { var program:String; } @:keep -class Adapter extends adapter.DebugSession { +class Adapter extends DebugSession { function traceToOutput(value:Dynamic, ?infos:haxe.PosInfos) { var msg = value; if (infos != null && infos.customParams != null) { msg += " " + infos.customParams.join(" "); } msg += "\n"; - sendEvent(new adapter.DebugSession.OutputEvent(msg)); + sendEvent(new vscode.debugAdapter.DebugSession.OutputEvent(msg)); } override function initializeRequest(response:InitializeResponse, args:InitializeRequestArguments) { haxe.Log.trace = traceToOutput; - sendEvent(new adapter.DebugSession.InitializedEvent()); + sendEvent(new vscode.debugAdapter.DebugSession.InitializedEvent()); response.body.supportsSetVariable = true; response.body.supportsValueFormattingOptions = false; response.body.supportsCompletionsRequest = true; @@ -68,13 +67,13 @@ class Adapter extends adapter.DebugSession { } function onExit(_, _) { - sendEvent(new adapter.DebugSession.TerminatedEvent(false)); + sendEvent(new vscode.debugAdapter.DebugSession.TerminatedEvent(false)); } var server = Net.createServer(onConnected); server.listen(6972, function() { var args = []; - var haxeProcess = ChildProcess.spawn(executable, args, {stdio: Pipe, cwd: Path.directory(executable)}); + var haxeProcess = ChildProcess.spawn(executable, args, {stdio: Pipe, cwd: haxe.io.Path.directory(executable)}); haxeProcess.stdout.on(ReadableEvent.Data, onStdout); haxeProcess.stderr.on(ReadableEvent.Data, onStderr); haxeProcess.on(ChildProcessEvent.Exit, onExit); @@ -97,38 +96,38 @@ class Adapter extends adapter.DebugSession { }); function onExit() { - sendEvent(new adapter.DebugSession.TerminatedEvent(false)); + sendEvent(new vscode.debugAdapter.DebugSession.TerminatedEvent(false)); } socket.on(SocketEvent.End, onExit); } function onStdout(data:Buffer) { - sendEvent(new adapter.DebugSession.OutputEvent(data.toString("utf-8"), stdout)); + sendEvent(new vscode.debugAdapter.DebugSession.OutputEvent(data.toString("utf-8"), Stdout)); } function onStderr(data:Buffer) { - sendEvent(new adapter.DebugSession.OutputEvent(data.toString("utf-8"), stderr)); + sendEvent(new vscode.debugAdapter.DebugSession.OutputEvent(data.toString("utf-8"), Stderr)); } function onEvent

(type:NotificationMethod

, data:P) { switch (type) { case Protocol.PauseStop: - sendEvent(new adapter.DebugSession.StoppedEvent("pause", data.threadId)); + sendEvent(new vscode.debugAdapter.DebugSession.StoppedEvent("pause", data.threadId)); case Protocol.BreakpointStop: - sendEvent(new adapter.DebugSession.StoppedEvent("breakpoint", data.threadId)); + sendEvent(new vscode.debugAdapter.DebugSession.StoppedEvent("breakpoint", data.threadId)); case Protocol.ExceptionStop: - var evt = new adapter.DebugSession.StoppedEvent("exception", 0); + var evt = new vscode.debugAdapter.DebugSession.StoppedEvent("exception", 0); evt.body.text = data.text; sendEvent(evt); case Protocol.ThreadStart: - var evt = new adapter.DebugSession.ThreadEvent(ThreadEventReason.started, data.threadId); + var evt = new vscode.debugAdapter.DebugSession.ThreadEvent(ThreadEventReason.Started, data.threadId); sendEvent(evt); case Protocol.ThreadExit: - var evt = new adapter.DebugSession.ThreadEvent(ThreadEventReason.exited, data.threadId); + var evt = new vscode.debugAdapter.DebugSession.ThreadEvent(ThreadEventReason.Exited, data.threadId); sendEvent(evt); } } @@ -322,10 +321,10 @@ class Adapter extends adapter.DebugSession { } else { return null; } - return cast new adapter.DebugSession.Source(fileName, convertDebuggerPathToClient(filePath)); + return cast new vscode.debugAdapter.DebugSession.Source(fileName, convertDebuggerPathToClient(filePath)); } static function main() { - adapter.DebugSession.run(Adapter); + DebugSession.run(Adapter); } }