Skip to content

Commit

Permalink
docs: update the debugging doc about remote mode default adapter
Browse files Browse the repository at this point in the history
From v0.41.0, we are switching the default to dlv-dap.

Fixes #2205

Change-Id: Iaef25bd94620fd74e7721ab7a55721a9f4f91355
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/562678
Commit-Queue: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
  • Loading branch information
hyangah committed Feb 10, 2024
1 parent 95d6a45 commit 5b0d6db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 30 deletions.
4 changes: 1 addition & 3 deletions docs/debugging-legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Go extension historically used a small adapter program to work with the Go debugger, [Delve].
The extension transitioned to communicate with [Delve] directly but there are still cases you may
need to use the legacy debug adapter (e.g. remote debugging). This document explains how to use the
need to use the legacy debug adapter. This document explains how to use the
***legacy*** debug adapter.


Expand Down Expand Up @@ -45,8 +45,6 @@ To opt in to use the legacy debug adapter (`legacy`) by default, add the followi
```

If you want to use the legacy mode for only a subset of your launch configurations, you can use [the `debugAdapter` attribute](#launchjson-attributes) to switch between `"dlv-dap"` and `"legacy"` mode.
For [Remote Debugging](#remote-debugging) (launch configuration with `"mode": "remote"` attribute),
the extension will use the `"legacy"` mode by default, so setting this attribute won't be necessary.

Throughout this document, we assume that you opted in to use the legacy debug adapter.
For debugging using the new debug adapter (default, `"dlv-dap"` mode), please see the documentation about [Debugging](https://github.com/golang/vscode-go/tree/master/docs/debugging-legacy.md).
Expand Down
34 changes: 7 additions & 27 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,8 @@ activities using
[VS Code’s Debugging UI](https://code.visualstudio.com/docs/editor/debugging).

These debugging features are possible by using
[Delve](https://github.com/go-delve/delve), the Go debugger.

Previously, the Go extension communicated with Delve through a custom debug
adaptor program (`legacy` mode). Since
[`Delve`'s native debug adapter implementation](https://github.com/go-delve/delve/tree/master/service/dap)
is available, the Go extension is transitioning to deprecate the legacy debug
adapter in favor of direct communication with Delve via
[DAP](https://microsoft.github.io/debug-adapter-protocol/overview).


📣 **We are happy to announce that the new _`dlv-dap`_ mode of Delve
integration is enabled for _local_ _debugging_ by default. For
[_remote_ _debugging_](#remote-debugging) it is the default in
[Go Nightly](nightly.md) and is available with stable builds on demand with
`"debugAdapter": "dlv-dap"` attribute in `launch.json` or `settings.json`!**

Many features and settings described in this document may be available only with
the new `dlv-dap` mode. For troubleshooting and configuring the legacy debug
adapter, see
[the legacy debug adapter documentation](https://github.com/golang/vscode-go/tree/master/docs/debugging-legacy.md).
[Delve](https://github.com/go-delve/delve), the Go debugger, and its
[native debug adapter implementation](https://github.com/go-delve/delve/tree/master/service/dap).

## Get started

Expand Down Expand Up @@ -82,7 +64,9 @@ from the tree head.

### Switch to legacy debug adapter

Note: The extension still uses the legacy debug adapter for remote debugging.
Previously, the Go extension communicated with Delve through a custom debug
adaptor program (aka `legacy` mode). This legacy adapter is no longer maintained
and will be removed by the end of 2024 H2.

If you need to use the legacy debug adapter for local debugging (`legacy` mode)
by default, add the following in your VSCode settings.
Expand All @@ -93,9 +77,6 @@ by default, add the following in your VSCode settings.
}
```

When `mode` is set to `remote` you must explicitly set `debugAdapter` to
`dlv-dap` to override the legacy adapter default.

If you want to switch to `legacy` for only a subset of your launch
configurations, you can use
[the `debugAdapter` attribute](#launchjson-attributes) to switch between
Expand Down Expand Up @@ -809,8 +790,8 @@ with a running target.

The
[headless dlv server](https://github.com/go-delve/delve/tree/master/Documentation/api)
can now be used with both `"debugAdapter": "legacy"` (default value) and
`"debugAdapter": "dlv-dap"` (with Delve v1.7.3 or newer) as well as Delve's
can now be used with both `"debugAdapter": "dlv-dap"` (default) and
`"debugAdapter": "legacy"` (with Delve v1.7.3 or newer) as well as Delve's
[command-line interface](https://github.com/go-delve/delve/tree/master/Documentation/cli)
via `dlv connect`. The `--accept-multiclient` flag makes this a multi-use server
that persists on `Disconnect` from a client and allows repeated connections from
Expand All @@ -837,7 +818,6 @@ Connect to it with a remote attach configuration in your `launch.json`:
{
"name": "Connect to external session",
"type": "go",
"debugAdapter": "dlv-dap", // `legacy` by default
"request": "attach",
"mode": "remote",
"port": 12345,
Expand Down

0 comments on commit 5b0d6db

Please sign in to comment.