microsoft / microsoft/vscode-js-debug

[DAP] Stepping messed up after restart request

Open
#2,081 2 comments 0 reactions 1 assignee View on GitHub

@connor4312 is already working on this.

Since Sep 16, 2024.

bug info-needed
Dominant language
TypeScript
Stars
2k
Forks
373
Avg merge
1d 9m
Merged PRs (30d)
6

Description

Describe the bug
Using neovim, debugging itself works all fine, unless I restart the session (using nvim-dap extension with require('dap').restart()). When I restart the session, it hits the first breakpoint and kind of detaches(?): i.e. I can click step over and it will just do nothing (although indicating that execution is not stopped at the breakpoint anymore). I have to click "terminate session" twice to see [Process terminated] in the terminal. I tried the same launch.json in vscode and restarting works fine

To Reproduce
Steps to reproduce the behavior:

  1. Have a file like test.js
const a = 1;
console.log(a);
const b = 2;
console.log(b);
  1. Add breakpoint to the second line
  2. Start the debugger with this config
      require("dap").adapters["pwa-node"] = {
        type = "server",
        host = "localhost",
        port = "${port}",
        executable = {
          command = "node",
          args = {
            vim.call("stdpath", "data") .. "/lazy/vscode-js-debug/out/src/dapDebugServer.js",
            "${port}",
          },
        }
      }

And launch config:

          {
            type = "pwa-node",
            name = "Node",
            request = "launch",
            program = "${file}",
            cwd = "${workspaceFolder}",
            console = "integratedTerminal",
          },
  1. Hit breakpoint, step over fine.
  2. Restart the session via dap.restart(), hit the breakpoint, click Step Over and observe session detaching...

Log File
Log from nvim-dap, includes: start the session, hitting breakpoint, stepping over, restarting, hitting breakpoint, stepping over, terminating, terminating again. loadedSource event and stackTrace commands removed as too lengthy

Version I built dapDebugServer from the latest commit

Additional context
Sorry if nvim-dap issue, but I use like the most basic config

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.