Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Attach is possible? #49

Open
andresgutgon opened this issue Jul 2, 2023 · 2 comments
Open

Auto Attach is possible? #49

andresgutgon opened this issue Jul 2, 2023 · 2 comments

Comments

@andresgutgon
Copy link

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
Copy link
Author

andresgutgon commented Jul 2, 2023

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.

@marvindore
Copy link

marvindore commented Jul 23, 2024

Hi @andresgutgon ,
I was looking over a closed issue #5 and noticed they were also using pnpm. I was able to get pnpm to run my configuration with the following configuration.

{
          type = "pwa-node",
          request = "launch",
          name = "PNPM",
          cwd = "${workspaceFolder}",
          runtimeExecutable = "pnpm",
          runtimeArgs = {
            "debug",
          }
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants