mxsdev / nvim-dap-vscode-js

nvim-dap adapter for vscode-js-debug
266 stars 24 forks source link

Server not closing after terminating #61

Open ScopeSV opened 9 months ago

ScopeSV commented 9 months ago

Hi. I've finally gotten debugging working (well, almost). It works the first time, however when I debug a node server and terminate, it doesn't close the server. Im using LazyVim with nvim dap extras. I use dap-vscode-js for the setups, which is basically taken straight out of the docs:

require("dap-vscode-js").setup({
  adapters = { "pwa-node" },
})

for _, language in ipairs({ "typescript", "javascript" }) do
  require("dap").configurations[language] = {
    {
      type = "pwa-node",
      request = "launch",
      name = "ts-node",
      program = "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
      sourceMaps = true,
      args = { "${workspaceFolder}/src/index.ts" },
      cwd = vim.fn.getcwd(),
      env = {
        NODE_ENV = "dev",
      },
    },
    {
      type = "pwa-node",
      request = "launch",
      name = "ts-node-dev",
      program = "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
      sourceMaps = true,
      args = { "${workspaceFolder}/src/index.ts" },
      cwd = vim.fn.getcwd(),
    },
    {
      type = "pwa-node",
      request = "launch",
      name = "PBL",
      program = "${file}",
      cwd = "${workspaceFolder}",
    },
  }
end

So at first run, the debugger starts up the server. When I terminate everything looks fine. When I start up again, the port is in use. When I kill the port and start the debugger again, it works until next time I terminate.

The same launch scripts works perfectly in vscode.

Any suggestions? Im happy to give more information about my setup if needed, but as I have no idea what's going on I don't know what to provide :D