mxsdev / nvim-dap-vscode-js

nvim-dap adapter for vscode-js-debug
276 stars 30 forks source link

DAP quits without stopping on breakpoint when running on typescript code #26

Open dlukegordon opened 1 year ago

dlukegordon commented 1 year ago

Hello, I am trying to debug a typescript file, test.ts:

const x = 1;
const y = 2;
const z: number = 3;
console.log(x, y, z);
console.log('Test');

When I try to run the debugger on the above file, with a breakpoint on the last line, it starts and then quits immediately, without any sort of error. I have tried looking in dap-vscode-js logs, and dap logs, but can't find anything.

Interestingly, when I run the below code, almost the same as above except without type information, it works fine and stops on the breakpoint:

const x = 1;
const y = 2;
const z = 3;
console.log(x, y, z);
console.log('Test');

Here are my relevant neovim config lines:

require("dap-vscode-js").setup({
  adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap
  log_file_path = "/tmp/dap_vscode_js.log",
  log_file_level = vim.log.levels.DEBUG,
  log_console_level = vim.log.levels.DEBUG,
})

...

use { "mxsdev/nvim-dap-vscode-js", requires = {"mfussenegger/nvim-dap"} }
use {
  "microsoft/vscode-js-debug",
  opt = true,
  run = "npm install --legacy-peer-deps && npm run compile",
}

...

for _, language in ipairs({ "typescript", "javascript" }) do
  require("dap").configurations[language] = {
    {
      type = "pwa-node",
      request = "launch",
      name = "Launch file",
      program = "${file}",
      cwd = "${workspaceFolder}",
    },
  }
end

Can someone please help?