You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/goDebugFactory: support integrated/external console
Implementation is done by taking advantage of VS Code's RunInTerminal
implementation.
Upon receiving a `initializeRequest` with console=integrated/external
request, the thin debug adapter (DelveDAPOutputAdapter) starts a
temporary TCP listener and sends a RunInTerminal request to start the
`dlv dap --client-addr` command from the specified terminal.
The `dlv dap` command will connect to the TCP listener, and then
DelveDAPOutputAdapter starts to forward messages between VS Code and
the dlv dap process running in the terminal.
Strictly speaking, sending a RunInTerminal request before `initializeResponse`
is incorrect. According to DAP spec:
```
Until the debug adapter has responded to with an ‘initialize’ response, the client must not send any additional requests or events to the debug adapter.
In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an ‘initialize’ response.
```
More correct ways are either
1) do not depend on RunInTerminal, but directly manage terminals using
vscode terminal APIs, or
- we cannot utilize the RunInTerminal implementation vscode team
actively manages and keeps improving.
- there is no public vscode API for external console mode support
so we need to implement it from scratch.
2) first respond with an `initialize` response specifying a minimal
capability before sending RunInTerminal request. Once `dlv dap` starts,
forward the stashed `initialize` request to `dlv dap`. When `dlv dap`
returns an `initialize` response, compute the capability difference
and report them as an Capabilities event.
- add complexity to the DelveDAPOutputDebugAdapter, which
will no longer be a thin adapter.
- need significant changes in testing we built using DebugClient.
- what capabilities changed through Capabilities events are honored
is also unspeficied in the spec.
3) Delve DAP implements a proper Debug Adapter including reverse
requests. This is the most ideal solution that benefit other DAP-aware
editors.
- need to agree with delve devs, so may need more time and discussion.
4) ask the vscode team if debug's RunInTerminal capability can be exposed
as a vscode API. If that's possible, we even can do it before the
initialize request and set up this from the factory or tracker.
- new API. no guarantee if this can be accepted.
Will investigate the possibility of 4 or 1. If not working, we will
work harder to convince delve devs with option 3.
Updates #124
Change-Id: I3d28356a3da99832785815f8af43f7443acf8863
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/358618
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
0 commit comments