2

I am a reccent deno user. Been using node for a long time, switched to deno and am very happy with it. It's really good

However, I have an issue.
Whenever I try to debug a deno file, the vscode debugger starts running for like half a second and then stops, and nothing happens. It doesnt freeze or anything, it just starts for a moment and stops.

I am using this as launch configuration

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Deno1",
            "type": "node",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "deno",
            "outputCapture": "std",
            "runtimeArgs": ["run", "--inspect-brk", "-A", "${fileName}"],
            "port": 9229,

        }
    ]
}

I took it from this post

I should add that I was able to debug this file already, but one day it just started showing this issue i just described without (to my knowledge) any change on my part.

I am trying to debug this file

How can I fix this issue?

1 Answers1

1

To make it work you need to add a "program" field to launch.json and move the path of the file there, which is briefly mentioned in this answer from the post you linked to. But also you need to change "port" to "attachSimplePort":

{
    "version": "0.2.0",
    "configurations": [
        {
            "request": "launch",
            "name": "Launch Program",
            "type": "node",
            "program": "${workspaceFolder}/tests/grammar.test.ts", 
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "deno",
            "runtimeArgs": [
                "run",
                "--inspect-brk",
                "--allow-all"
            ],
            "attachSimplePort": 9229,
            "outputCapture": "std",
        }
    ]
}

To debug another part of the application just change the path in program, for example to an entrypoint file like main.ts. With --inspect-brk the debugger will first break at the first line of the program and then you can for example continue to a breakpoint with F5 or the continue button in the debugger panel.

(Deno v1.14)

Zwiers
  • 3,040
  • 2
  • 12
  • 18