[Help] How to properly configure Denon with VS Code
KirianCaumes opened this issue · 3 comments
Hello,
I'm not sure if it's a bug or just me that doesn't know how to configure properly VS Code debugger, but I'm not not able to make it works.
Here is my scripts.json
{
"$schema": "https://deno.land/x/denon/schema.json",
"allow": [
"run",
"net",
"read",
"env",
"write",
"plugin"
],
"watch": true,
"scripts": {
"start": {
"cmd": "deno run app.ts",
"desc": "run my app.ts file",
"unstable": true,
"inspect": "127.0.0.1:9229"
}
}
}
And my configuration on launch.json
{
"name": "🦕 Deno",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}/back",
"runtimeExecutable": "denon",
"runtimeArgs": [
"start"
],
"console": "internalConsole",
"outputCapture": "std",
"attachSimplePort": 9229
}
With this, when I start the debugger, my app start correctly and the debugger works well.
But, when I update any of my .ts file, the app restart correctly thanks to Denon, but the debugger seems to loose his link with the app, so I can't place a breakpoint anymore.
Well, it might be very clear as I don't know how to explain it, but if it can help, here is a screen of what is printed in the console. The first block correspond to the first start, and the second to restart:
Thanks in advance for your help!
Looks like your launch.json file might me off, here is an example from the manual: https://deno.land/manual/getting_started/debugging_your_code#vscode
I've managed to get it to work. Here's scripts.json
{
"$schema": "https://deno.land/x/denon@2.4.7/schema.json",
"scripts": {
"debug": {
"cmd": "deno run --inspect --allow-run --allow-net --allow-read --allow-env --allow-write --allow-plugin --config <relative tsconfig.json, if any> --import-map <relative import map json, if any> -A <relative app file>",
"desc": "debug by using denon and deno"
}
}
}
.vscode/launch.json
{
"name": "🦕 Denon",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}/<relative server source code directory>",
"runtimeExecutable": "denon",
"runtimeArgs": [
"debug"
],
"attachSimplePort": 9229,
"attachExistingChildren": true,
"autoAttachChildProcesses": true
}
Just for the sake of completeness, here's what i have for my vs code workspace .vscode/settings.json
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false,
"deno.importMap": "<relative import map json, if any>",
"deno.config": "<relative tsconfig.json, if any>"
Probably won't need a few of the vs code settings, but I'm fine with this as it works like a charm.
Thank you for your help!
I'm no longer working on project with Deno, so I'm closing the issue for now.
Hopefully, you're comment will help the community and me in the futur 😉