Search code examples
visual-studio-codedeno

How to debug Deno in VSCode


How do we configure .vscode/launch.json to debug Deno projects?

The IntelliSense the VSCode provides when I was in configurations didn't offer an option for Deno. Or is there an extension for this?


Solution

  • You need to attach the debugger, as per the deno manual.

    Create .vscode/launch.json replacing <entry_point> with your actual script and then F5.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Deno",
                "type": "node",
                "request": "launch",
                "cwd": "${workspaceFolder}",
                "runtimeExecutable": "deno",
                "runtimeArgs": ["run", "--inspect-brk", "-A", "<entry_point>"],
                "port": 9229
            }
        ]
    }
    

    It will stop at the breakpoints you set on VS Code, tried here and it worked fine.

    About the VS Code plugin:

    Official support in plugin is being worked on - https://github.com/denoland/vscode_deno/issues/12