mxsdev / nvim-dap-vscode-js

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

Auto Attach is possible? #49

Open andresgutgon opened 1 year ago

andresgutgon commented 1 year ago

Problem Statement

Hi, I've been configuring my nvim to debug on my editor a next.js app. And it works by starting a dev server with node options for debugging like this:

NODE_OPTIONS='--inspect' pnpm dev

But I was wondering if it's possible to launch a next server from nvim like VSCode does. This is my launch.json in VSCode

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Next.js: (node-terminal)",
      "type": "node-terminal",
      "request": "launch",
      "command": "pnpm dev"
    }
  ]
}

This starts the server inside VSCode and the debugger is up and running

image

So you this would be possible use nvim-dap?

Thanks for this awesome project!

Possible Solutions

No idea.

Considered Alternatives

The alternative is to use NODE_OPTIONS in a terminal and then attach to that next server. Is fine but it would be awesome to be able to launch the server and attach within nvim.

andresgutgon commented 1 year ago

I wrongly open this issue first in nvim-lap and the maintainer kindly redirected me to this project. I hope this is the right place to ask this.

After much try and error and realize that NextJS itself was broken in terms of debugging experience I have to say that this package works great. This is my current .vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach",
      "type": "pwa-node",
      "request": "attach",
      "processId":"${command:pickProcess}",
      "cwd": "${workspaceFolder}"
    }
  ]
}

As you can see I work by attaching to current process. And it's really fine but I was wondering how hard would be to much VSCode dev experience on launching the process from the editor.