debug your Deno programs with VS Code Part III โ RETURN OF THE FUCKERY ๐
UPDATE: Since this was posted, in the course of filing a bug report for this issue, I learned of a better workaround and included it as #0 below.
Further good news is that a fix is coming โ this issue is already fixed in the nightly builds of vs-code-js-debugger. If you are OK with using a nightly build, you can follow the instructions in this comment by vs-code-js-debugger maintainer conor4312 to solve the problem until an updated version of the debugger is officially released.
VS Code 1.47 (June 2020) breaks the convenient Deno debugging that was previously described here, in "debug your Deno programs with VS Code โ NOW WITH LESS FUCKERY!!!"
The technique described therein works with VS Code 1.46 (and previous), but no longer works in 1.47.
Workaround 0: Disable the debug.javascript.usePreview
setting in VS Code. This will re-enable the old debugger which doesn't exhibit this problem.
Workaround 1: Use the shitty-but-working debugging technique described in this newspaper's original Deno debugging article from April 2020, "debug your Deno programs with VS Code". That requires two steps: launch the debugger, then quickly start your Deno program manually on the command line (with the --inspect-brk
argument) before the debugger times out.
Workaround 2: Install the last working version of VS Code, from the VS Code May 2020 (version 1.46) release page. (Note that you can name this version "VS Code โ Dope Deno Debug 'Dition" and install it along side the latest release โ although it does seem that multiple different versions of VS Code cannot run simultaneously without waging horrific and total war against each other.)
more details
Given an identical debug configuration entry like this:
{
"version": "0.2.0",
"configurations": [
{
"console": "integratedTerminal",
"name": "Debug Deno (Allow All)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "${file}"],
"port": 9229
}
]
}
...VS Code 1.46 emits a command like this in the terminal when you hit F5:
cd /Users/mason/Documents/Syncthing/CODE/deno-fuckery ; /Users/mason/.local/bin/deno run --inspect-brk -A /Users/mason/Documents/Syncthing/CODE/deno-fuckery/main.ts
That looks right, and does work.
But in VS Code 1.47 the emitted command is:
env 'NODE_OPTIONS=--require "/Applications/Visual Studio Code-LATEST.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" ' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"/var/folders/_m/p_1dc3dj3mv12hr0nl1s1chh0000gn/T/node-cdp.13593-1.sock","deferredMode":false,"waitForDebugger":"","execPath":"/Users/mason/.nodenv/shims/node","onlyEntrypoint":false,"fileCallback":"/var/folders/_m/p_1dc3dj3mv12hr0nl1s1chh0000gn/T/node-debug-callback-b6731a1c153c29aa"}' /Users/mason/.local/bin/deno run -A /Users/mason/Documents/Syncthing/CODE/deno-fuckery/main.ts
Now that decidedly does not look right. Not for the purposes of debugging a Deno program, anyway. Where did our magic incantation --inspect-brk
go? The --inspect-brk
is getting somehow swallowed and not passed on to Deno. Without that, Deno isn't going to pause for us and engage the debugger.
I suspect, but haven't yet proved, that this is related to the "new JS debugger" feature of VS Code 1.47.
KEYWORDS: Deno, VS Code, VS Code 1.47 breaks debugging, debug, debugger, TypeScript, --inspect, --inspect-brk, lack of childcare can and does make good people insane, Trump is a traitorous pedo-adjacent mentally-diseased racist incest-fantasist and malevolent lardassed idiot who didn't cause but merely exacerbated and perfectly exemplifies the decline and fall of the USA and even if the county does somehow recover against all odds from the present degenerate era and redeem itself as a high-functioning democracy the hole is so deep that every person on earth who is alive right now will already be dead by the time that happens