nvim-dap-vscode-js icon indicating copy to clipboard operation
nvim-dap-vscode-js copied to clipboard

Support `startDebugging`

Open mxsdev opened this issue 2 years ago β€’ 3 comments

Closes #15

A lot of the old configuration is now deprecated/legacy. Check out the docs/README for new configuration options.

A new compile command is also needed for vscode-js-debug:

npm install --legacy-peer-deps && npx gulp dapDebugServer

@JbIPS @igorlfs if you two would be willing to test this out locally and let me know if you have any issues, that would be super helpful πŸŽ‰

mxsdev avatar Mar 27 '23 00:03 mxsdev

Great work @mxsdev ! I just tried it after a clean install, following the new Readme and got this:

Debugger attached.

  βœ” Set progress (166ms)
  ─

  1 test passed
Waiting for the debugger to disconnect...

[Process exited 0]

Seems great but the breakpoint didn't stop anything. Actually, it transformed into a red ΓΈ, maybe to indicate it couldn't connect ?

Here's my DAP setting:

{
    type = "pwa-node",
    request = "launch",
    name = "Debug AVA Test file",
    program = "node_modules/ava/entrypoints/cli.mjs",
    args = {
      '--serial',
      '${file}'
    },
    sourceMaps = true,
    skipFiles = {'<node_internals>/**/*.js'},
    outFiles = {
      "${workspaceFolder}/dist/**/*.js",
      "!**/node_modules/**"
    },
    outputCapture = "std",
    console = "integratedTerminal",
  }

I copied a working launch.json from VSCode (following AVA config) for this but I could have missed something.

For the record, my source file is in TS and build into dist

JbIPS avatar Mar 27 '23 13:03 JbIPS

I seem to be getting notify.error DAP Couldn't connect to localhost:${port}: ECONNREFUSED whenever I use it in combination with neotest-jest. ~It seems it's nor replacing "${port}" or something~

entropitor avatar May 04 '23 15:05 entropitor

It seems on MacOS, there are problems with localhost <> ipv4, ipv6. dapDebugServer by default uses localhost which for node means 127.0.0.1 (i.e. ipv4 localhost) while this / dap uses ::1 as localhost (i.e. ipv6 localhost) and thus we get a ECONNREFUSED.

The solution is to either pass explicitly 127.0.0.1 to both or ::1 to both instead of using localhost.

entropitor avatar May 05 '23 08:05 entropitor