mxsdev / nvim-dap-vscode-js

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

Attach with pwa-node doesn't work #64

Closed akoskm closed 9 months ago

akoskm commented 9 months ago

Hi šŸ‘‹ and thanks for this plugin!

I'm starting a remix app from a terminal window and using the following attach configuration to attach to the script:

require("dap-vscode-js").setup({
  -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
  -- old: debugger_path = "(runtimedir)/site/pack/packer/opt/vscode-js-debug", -- Path to vscode-js-debug installation.
  debugger_path = "/Users/akoskm/Projects/vscode-js-debug", -- Path to vscode-js-debug installation.
  -- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
  adapters = { 'chrome', 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost', 'node', 'chrome' }, -- which adapters to register in nvim-dap
  -- log_file_path = "/Users/akoskm/dap_vscode_js.log", -- Path for file logging
  -- log_file_level = true, -- Logging level for output to file. Set to false to disable file logging.
  log_console_level = vim.log.levels.DEBUG, -- Logging level for output to console. Set to false to disable console output.
})
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
  require("dap").configurations[language] = {
      {
          type = "pwa-node",
          request = "attach",
          name = "Attach",
          processId = "${command:PickProcess}",
          cwd = "${workspaceFolder}",
      }
  }
end

When I hit F5 I see in the terminal Debugger attached. appear

> node --inspect node_modules/.bin/remix dev

Debugger listening on ws://127.0.0.1:9229/3b206db3-d948-4e0d-9a12-8718079c7fab
For help, see: https://nodejs.org/en/docs/inspector

 šŸ’æ  remix dev

 info  building...
 info  built (576ms)
[remix-serve] http://localhost:3000 (http://192.168.64.1:3000)

GET /signin 200 - - 30.542 ms
Debugger attached.
GET /signin 200 - - 8.851 ms
GET /signin 200 - - 14.794 ms
GET /signin 200 - - 16.756 ms

However, the breakpoints I set are still not being triggered. Any idea why? Thanks!

akoskm commented 9 months ago

I'm closing this because it works in different projects (Razzle, tried with Next.js but couldn't get it working it was a Next.js thing). There's something special about debugging Remix processes that I don't fully understand yet.