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

Support startDebugging #38

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Support startDebugging #38

wants to merge 4 commits into from

Conversation

mxsdev
Copy link
Owner

@mxsdev mxsdev commented Mar 27, 2023

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 🎉

mfussenegger and others added 4 commits February 25, 2023 14:46
Similar to the nvim-dap startDebugging support, this sets
children/parent on the session

See https://github.com/mfussenegger/nvim-dap/blob/72684a4d70f0ecd45efe5ea76e9510e0b2e4d600/lua/dap/session.lua#L1022-L1023

This will cause the session hierarchy to be visible when using something
like `:lua local w = require('dap.ui.widgets');
w.sidebar(w.sessions).open();` and should ensure the child session
receives all breakpoint changes
@JbIPS
Copy link

JbIPS commented Mar 27, 2023

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

Comment on lines +9 to +18
return function(on_config, config, parent)
local target = config["__pendingTargetId"]
if target and parent then
local adapter = parent.adapter
on_config({
type = "server",
host = "localhost",
port = adapter.port
})
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a further change in nvim-dap to automatically use the parent host+port if the adapter has both type server and an executable. See mfussenegger/nvim-dap#913. This should make it unnecessary to check for target and parent, you can instead always return the same definition.

@entropitor
Copy link
Contributor

entropitor commented May 4, 2023

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

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.

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

Successfully merging this pull request may close these issues.

Support startDebugging request
4 participants