You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by al...@apache.org on 2020/12/23 22:10:58 UTC
[openwhisk-wskdebug] 03/11: wskdebug does not work with new vs code
debugger #74
This is an automated email from the ASF dual-hosted git repository.
alexkli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git
commit 6ffe92e725d740b69228096f386f77f8aa28a562
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Wed Dec 23 00:00:19 2020 -0800
wskdebug does not work with new vs code debugger #74
document new VS Code launch config starting with VS Code 1.48
---
README.md | 49 ++++++++++++++++++++++++++-----------
examples/nodejs/.vscode/launch.json | 37 +++++++++++++++++++++++-----
2 files changed, 66 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
index b43f064..001e607 100644
--- a/README.md
+++ b/README.md
@@ -122,21 +122,36 @@ The action to debug (e.g. `myaction`) must already be deployed.
<a name="nodejs-visual-studio-code"></a>
### Node.js: Visual Studio Code
-> ⚠️ **VS Code June 2020 release (version 1.47) breaks wskdebug**
->
-> Breakpoints will not hit because it debugs the wskdebug process instead of the action.
->
-> Workaround: set `"debug.javascript.usePreview": false` in your VS Code `settings.json`.
->
-> A better solution will come with a new VS Code update and wskdebug 1.3.0.
->
-> More details in [issue #74](https://github.com/apache/openwhisk-wskdebug/issues/74).
-
Add the configuration below to your [launch.json](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations). Replace `MYACTION` with the name of your action and `ACTION.js` with the source file containing the action. When you run this, it will start wskdebug and should automatically connect the debugger.
```json
"configurations": [
{
+ "type": "pwa-node",
+ "request": "launch",
+ "name": "wskdebug MYACTION", // <-- adjust name for debug drop-down
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
+ "runtimeExecutable": "wskdebug",
+ "args": [
+ "MYACTION", // <-- replace with name of the action
+ "ACTION.js", // <-- replace with local path to action source file
+ "--cleanup", // remove helper actions on shutdown
+ "-l", // enable live-reload
+ "-v" // log parameters and results
+ ],
+ "localRoot": "${workspaceFolder}",
+ "remoteRoot": "/code",
+ "outputCapture": "std"
+ }
+ ]
+```
+
+In **VS Code versions <= 1.47** use the config below. If you use 1.47, you also have to set `"debug.javascript.usePreview": false` in your VS Code `settings.json`. See also [issue #74](https://github.com/apache/openwhisk-wskdebug/issues/74).
+
+```json
+ "configurations": [
+ {
"type": "node",
"request": "launch",
"name": "wskdebug MYACTION",
@@ -149,7 +164,7 @@ Add the configuration below to your [launch.json](https://code.visualstudio.com/
]
```
-Stop the debugger in VS Code to end the debugging session and `wskdebug`.
+After you are done with the debugging, stop the debugger in VS Code to end the debugging session and `wskdebug`.
This snippets enables browser LiveReloading using `-l`. For other reloading options, see [live reloading](#live-reloading).
@@ -175,9 +190,11 @@ To use custom credentials from a custom `.wskprops` and/or use a developer-speci
```json
"configurations": [
{
- "type": "node",
+ "type": "pwa-node",
"request": "launch",
"name": "wskdebug",
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
"runtimeExecutable": "wskdebug",
"args": [ "MYACTION", "ACTION.js", "-l" ],
"localRoot": "${workspaceFolder}",
@@ -200,8 +217,10 @@ Here is a `.vscode/launch.json` example that uses compounds to expose a config s
{
"configurations": [
{
- "type": "node",
+ "type": "pwa-node",
"request": "launch",
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
"name": "mypackage/action1",
"runtimeExecutable": "wskdebug",
"args": [
@@ -213,8 +232,10 @@ Here is a `.vscode/launch.json` example that uses compounds to expose a config s
"outputCapture": "std"
},
{
- "type": "node",
+ "type": "pwa-node",
"request": "launch",
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
"name": "mypackage/action2",
"runtimeExecutable": "wskdebug",
"args": [
diff --git a/examples/nodejs/.vscode/launch.json b/examples/nodejs/.vscode/launch.json
index 47501f7..50f334b 100644
--- a/examples/nodejs/.vscode/launch.json
+++ b/examples/nodejs/.vscode/launch.json
@@ -5,9 +5,27 @@
"version": "0.2.0",
"configurations": [
{
+ "type": "pwa-node",
+ "request": "launch",
+ "attachSimplePort": 0, // instead of "port", makes it auto-select a free debug port
+ "killBehavior": "polite",
+ "name": "wskdebug",
+ "runtimeExecutable": "wskdebug",
+ "args": [
+ "wskdebug-examples/webaction",
+ "${workspaceFolder}/webaction.js",
+ "--cleanup", // remove helper actions on shutdown (takes longer)
+ "-l", // enable live-reload
+ "-v" // log parameters and results
+ ],
+ "localRoot": "${workspaceFolder}",
+ "remoteRoot": "/code",
+ "outputCapture": "std"
+ },
+ {
"type": "node",
"request": "launch",
- "name": "wskdebug sample webaction",
+ "name": "wskdebug (VS Code <= 1.47)",
"runtimeExecutable": "wskdebug",
"args": [
"wskdebug-examples/webaction",
@@ -20,8 +38,10 @@
"outputCapture": "std"
},
{
- "type": "node",
+ "type": "pwa-node",
"request": "launch",
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
"name": "wskdebug ngrok",
"runtimeExecutable": "wskdebug",
"args": [
@@ -35,24 +55,29 @@
"outputCapture": "std"
},
{
- "type": "node",
+ "type": "pwa-node",
"request": "launch",
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
"name": "wskdebug with build",
"runtimeExecutable": "wskdebug",
"args": [
"wskdebug-examples/webaction",
"${workspaceFolder}/webaction.js",
"-l",
- "--on-build", "mkdir build/; cp webaction.js build/",
- "--build-path", "build/webaction.js"
+ "--on-build", "mkdir -p build/; cp webaction.js build/",
+ "--build-path", "build/webaction.js",
+ "--cleanup"
],
"localRoot": "${workspaceFolder}",
"remoteRoot": "/code",
"outputCapture": "std"
},
{
- "type": "node",
+ "type": "pwa-node",
"request": "launch",
+ "attachSimplePort": 0,
+ "killBehavior": "polite",
"name": "wskdebug with WSK_PACKAGE",
"runtimeExecutable": "wskdebug",
"args": [