Skip to content

Conversation

@mfussenegger
Copy link
Owner

With this change startDebugging should work out of the box for debug
adapters configured with type=server and an executable.

For example, for vscode-js-debug, instead of a custom adapter factory
like:

require("dap").adapters["pwa-node"] = function(on_config, config, parent)
  local target = config["__pendingTargetId"]
  if target and parent then
    local adapter = parent.adapter --[[@as ServerAdapter]]
    on_config({
      type = "server",
      host = "localhost",
      port = adapter.port
    })
  else
    on_config({
      type = "server",
      host = "localhost",
      port = "${port}",
      executable = {
        command = "node",
        args = {"/path/to/js-debug/src/dapDebugServer.js", "${port}"},
      }
    })
  end
end

It will be possible to use the simpler definition:

require("dap").adapters["pwa-node"] = {
  type = "server",
  host = "localhost",
  port = "${port}",
  executable = {
    command = "node",
    args = {"/path/to/js-debug/src/dapDebugServer.js", "${port}"},
  }
}

…h executable

With this change `startDebugging` should work out of the box for debug
adapters configured with type=server and an executable.

For example, for vscode-js-debug, instead of a custom adapter factory
like:

```lua
require("dap").adapters["pwa-node"] = function(on_config, config, parent)
  local target = config["__pendingTargetId"]
  if target and parent then
    local adapter = parent.adapter --[[@as ServerAdapter]]
    on_config({
      type = "server",
      host = "localhost",
      port = adapter.port
    })
  else
    on_config({
      type = "server",
      host = "localhost",
      port = "${port}",
      executable = {
        command = "node",
        args = {"/path/to/js-debug/src/dapDebugServer.js", "${port}"},
      }
    })
  end
end
```

It will be possible to use the simpler definition:

```lua
require("dap").adapters["pwa-node"] = {
  type = "server",
  host = "localhost",
  port = "${port}",
  executable = {
    command = "node",
    args = {"/path/to/js-debug/src/dapDebugServer.js", "${port}"},
  }
}
```
@mfussenegger mfussenegger merged commit da439b2 into master Mar 31, 2023
@mfussenegger mfussenegger deleted the start-debugging-server branch March 31, 2023 06:04
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.

2 participants