docs: move dlv-dap to debugging, debugging to debugging-legacy

Updated code that referenced dlv-dap.md.
Updated default values in package.json.
Updated tools/generate.go to use docs/debugging.md.

Updates golang/vscode-go#1657

Change-Id: I2f8dc6e1a465514a9f0db273cfce6910447ccc9e
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/339098
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
diff --git a/README.md b/README.md
index af4b4f6..f77ecae 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,7 @@
 [Go programming language](https://golang.org/).
 
 
-> 📣 Debugging using [`Delve`'s native DAP implementation](https://github.com/golang/vscode-go/blob/master/docs/dlv-dap.md) is now available for use.<br>
-> Please test it by following [the instruction to enable this new feature](https://github.com/golang/vscode-go/blob/master/docs/dlv-dap.md#getting-started) and share your feedback!
+> 📣 Debugging using [`Delve`'s native DAP implementation](https://github.com/golang/vscode-go/blob/master/docs/debugging.md) is enabled by default in v0.27.0.<br>
 
 ## Quick Start
 
diff --git a/docs/debugging-legacy.md b/docs/debugging-legacy.md
new file mode 100644
index 0000000..f196221
--- /dev/null
+++ b/docs/debugging-legacy.md
@@ -0,0 +1,458 @@
+# Debugging with Legacy Debug Adapter
+
+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
+***legacy*** debug adapter.
+
+
+* [Set up](#set-up)
+  * [Installation](#installation)
+  * [Configuration](#configuration)
+* [Launch Configurations](#launch-configurations)
+  * [Specifying build tags](#specifying-build-tags)
+  * [Specifying other build flags](#specifying-other-build-flags)
+  * [Using VS Code Variables](#using-vs-code-variables)
+  * [Snippets](#snippets)
+* [Debugging on Windows Subsystem for Linux (WSL)](#debugging-on-windows-subsystem-for-linux-wsl)
+* [Remote Debugging](#remote-debugging)
+* [Troubleshooting](#troubleshooting)
+  * [Read documentation and common issues](#read-documentation-and-common-issues)
+  * [Update Delve](#update-delve)
+  * [Check for multiple versions of Delve](#check-for-multiple-versions-of-delve)
+  * [Check your launch configuration](#check-your-launch-configuration)
+  * [Check your GOPATH](#check-your-gopath)
+  * [Enable logging](#enable-logging)
+  * [Optional: Debug the debugger](#optional-debug-the-debugger)
+  * [Ask for help](#ask-for-help)
+* [Common issues](#common-issues)
+
+## Set up
+
+[Delve] (`dlv`) should be installed by default when you install this extension.
+You may need to update `dlv` to the latest version to support the latest version
+of Go. To install or update `dlv`, open the [Command Palette][]
+(Windows/Linux: Ctrl+Shift+P; OSX: Shift+Command+P), select [`Go: Install/Update Tools`](settings.md#go-installupdate-tools), and select [`dlv`](tools.md#dlv).
+
+## Selecting `legacy` debug adapter
+
+To opt in to use the legacy debug adapter (`legacy`) by default, add the following in your VSCode settings.json.
+
+```
+    "go.delveConfig": {
+        "debugAdapter": "legacy",
+    }
+```
+
+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).
+
+### Configuration
+
+You may not need to configure any settings to start debugging your programs, but you should be aware that the debugger looks at the following settings.
+
+* Related to [`GOPATH`](gopath.md):
+  * [`go.gopath`](settings.md#go.gopath)
+  * [`go.inferGopath`](settings.md#go.inferGopath)
+* [`go.delveConfig`](settings.md#go.delveConfig)
+  * `apiVersion`: Controls the version of the Delve API used (default: `2`).
+  * `dlvLoadConfig`: The configuration passed to Delve, which controls how variables are shown in the Debug pane. Not applicable when `apiVersion` is 1.
+    * `maxStringLen`: Maximum number of bytes read from a string (default: `64`).
+    * `maxArrayValues`: Maximum number of elements read from an array, slice, or map (default: `64`).
+    * `maxStructFields`: Maximum number of fields read from a struct. A setting of `-1` indicates that all fields should be read (default: `-1`).
+    * `maxVariableRecurse`: How far to recurse when evaluating nested types (default: `1`).
+    * `followPointers`: Automatically dereference pointers (default: `true`).
+  * `showGlobalVariables`: Show global variables in the Debug view (default: `false`).
+  * `debugAdapter`: Controls which debug adapter to use (default: `legacy`).
+  * `substitutePath`: Path mappings to apply to get from a path in the editor to a path in the compiled program (default: `[]`).
+
+There are some common cases when you might want to tweak the Delve configurations.
+
+* To change the default cap of 64 on string and array length when inspecting variables in the Debug view, set `maxStringLen`. (See a related known issue: [golang/vscode-go#126](https://github.com/golang/vscode-go/issues/126)).
+* To evaluate nested variables in the Run view, set `maxVariableRecurse`.
+
+## Launch Configurations
+
+To get started debugging, run the command `Debug: Open launch.json`. If you did not already have a `launch.json` file for your project, this will create one for you. It will contain this default configuration, which can be used to debug the current package. With mode `auto`, the file that is currently open will determine whether to debug the program as a test. If `program` is instead set to a Go file, that file will determine which mode to run in.
+
+```json5
+{
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Launch",
+            "type": "go",
+            "request": "launch",
+            "mode": "auto",
+            "program": "${fileDirname}",
+            "debugAdapter": "legacy",
+            "env": {},
+            "args": []
+        }
+    ]
+}
+```
+
+There are some more properties that you can adjust in the debug configuration:
+
+Property   | Description
+--------   | -----------
+name       | The name for your configuration as it appears in the drop-down in the Run view.
+type       | Always leave this set to `"go"`. VS Code uses this setting to determine which extension should be used for debugging.
+request    | One of `launch` or `attach`. Use `attach` when you want to attach to a running process.
+mode       | For `launch` requests, one of `auto`, `debug`, `remote`, `test`, or `exec`. For `attach` requests, use `local` or `remote`.
+program    | In `test` or `debug` mode, this refers to the absolute path to the package or file to debug. In `exec` mode, this is the existing binary file to debug. Not applicable to `attach` requests.
+env        | Environment variables to use when debugging. Use the format: `{ "NAME": "VALUE" }`. Not applicable to `attach` requests.
+envFile    | Absolute path to a file containing environment variable definitions. The environment variables passed in via the `env` property override the ones in this file.
+args       | Array of command-line arguments to pass to the program being debugged.
+showLog    | If `true` and `logDest` is not set, Delve logs will be printed in the Debug Console panel. If `true` and `logDest` is set, logs will be written to the `logDest` file. This corresponds to `dlv`'s `--log` flag.
+logOutput  | Comma-separated list of Delve components (`debugger`, `gdbwire`, `lldbout`, `debuglineerr`, `rpc`) that should produce debug output when `showLog` is `true`. This corresponds to `dlv`'s `--log-output` flag.
+logDest    | Absolute path to the delve log output file. This corresponds to `dlv`'s `--log-dest` flag, but number (used for file descriptor) is disallowed. Supported only in dlv-dap mode on Linux and Mac.
+buildFlags | Build flags to pass to the Go compiler. This corresponds to `dlv`'s `--build-flags` flag.
+dlvFlags   | Extra flags passed to `dlv`. See `dlv help` for the full list of supported flags. This is useful when users need to pass less commonly used or new flags such as `--only-same-user`, `--check-go-version`. Note that some flags such as `--log-output`, `--log`, `--log-dest`, `--api-version` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.
+remotePath | If remote debugging (`mode`: `remote`), this should be the absolute path to the package being debugged on the remote machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant. Becomes the first mapping in substitutePath.
+substitutePath | An array of mappings from an absolute local path to an absolute remote path that is used by the debuggee. The debug adapter will replace the local path with the remote path in all of the calls. The mappings are applied in order, and the first matching mapping is used. This can be used to map files that have moved since the program was built, different remote paths, and symlinked files or directories. This is intended to be equivalent to the [substitute-path](https://github.com/go-delve/delve/tree/master/Documentation/cli#config) configuration, and will eventually configure substitute-path in Delve directly.
+cwd | The working directory to be used in running the program. If remote debugging (`mode`: `remote`), this should be the absolute path to the working directory being debugged on the local machine. The extension defaults to the workspace folder, or the workspace folder of the open file in multi root workspaces. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant.
+processId  | This is the process ID of the executable you want to debug. Applicable only when using the `attach` request in `local` mode. By setting this to the command name of the process, `${command:pickProcess}`, or`${command:pickGoProcess}` a quick pick menu will show a list of processes to choose from.
+
+### Specifying [build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints)
+
+If your program contains [build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints), you can use the `buildFlags` property. For example, if you build your code with:
+
+```bash
+go build -tags=whatever
+```
+
+Then, set:
+
+```json5
+"buildFlags": "-tags=whatever"
+```
+
+in your launch configuration. This property supports multiple tags, which you can set by using single quotes. For example:
+
+```json5
+"buildFlags": "-tags='first,second,third'"
+```
+
+<!--TODO(rstambler): Confirm that the extension works with a comma (not space) separated list.-->
+
+### Specifying other build flags
+
+The flags specified in `buildFlags` and `env.GOFLAGS` are passed to the Go compiler when building your program for debugging. Delve adds `-gcflags='all=-N -l'` to the list of build flags to disable optimizations. User specified buildFlags conflict with this setting, so the extension removes them ([Issue #117](https://github.com/golang/vscode-go/issues/117)). If you wish to debug a program using custom `-gcflags`, build the program using `go build` and launch using `exec` mode:
+
+```json
+{
+    "name": "Launch executable",
+    "type": "go",
+    "request": "launch",
+    "mode": "exec",
+    "program": "/absolute/path/to/executable"
+}
+```
+
+Note that it is not recommended to debug optimized executables as Delve may not have the information necessary to properly debug your program.
+
+### Using [VS Code variables]
+
+Any property in the launch configuration that requires a file path can be specified in terms of [VS Code variables]. Here are some useful ones to know:
+
+* `${workspaceFolder}` refers to the root of the workspace opened in VS Code. If using a multi root workspace, you must specify the folder name `${workspaceFolder:folderName}`
+* `${fileWorkspaceFolder}` refers to the the current opened file's workspace folder.
+* `${file}` refers to the currently opened file.
+* `${fileDirname}` refers to the directory containing the currently opened file. This is typically also the name of the Go package containing this file, and as such, can be used to debug the currently opened package.
+
+### Snippets
+
+In addition to [VS Code variables], you can make use of [snippets] when editing the launch configuration in `launch.json`.
+
+When you type `go` in the `launch.json` file, you will see snippet suggestions for debugging the current file or package or a given test function.
+
+Below are the available sample configurations:
+
+#### Debug the current file (`Go: Launch file`)
+
+Recall that `${file}` refers to the currently opened file (see [Using VS Code Variables](#using-vs-code-variables)). For debugging a package that consists with multiple files, use `${fileDirname}` instead.
+
+```json5
+{
+    "name": "Launch file",
+    "type": "go",
+    "request": "launch",
+    "mode": "auto",
+    "program": "${file}"
+}
+```
+
+#### Debug a single test function (`Go: Launch test function`)
+
+Recall that `${workspaceFolder}` refers to the current workspace (see [Using VS Code Variables](#using-vs-code-variables)). You will need to manually specify the function name instead of `"MyTestFunction"`.
+
+```json5
+{
+    "name": "Launch test function",
+    "type": "go",
+    "request": "launch",
+    "mode": "test",
+    "program": "${workspaceFolder}",
+    "args": [
+        "-test.run",
+        "MyTestFunction"
+    ]
+}
+```
+
+#### Debug all tests in the given package (`Go: Launch test package`)
+
+A package is a collection of source files in the same directory that are compiled together.
+Recall that `${fileDirname}` refers to the directory of the open file (see [Using VS Code Variables](#using-vs-code-variables)).
+
+```json5
+{
+    "name": "Launch test package",
+    "type": "go",
+    "request": "launch",
+    "mode": "test",
+    "program": "${workspaceFolder}"
+}
+```
+
+#### Attach to a running local process via its process ID (`Go: Attach to local process`)
+
+Substitute `processName` with the name of the local process.
+
+```json5
+{
+    "name": "Attach to local process",
+    "type": "go",
+    "request": "attach",
+    "mode": "local",
+    "processId": "processName"
+}
+```
+
+#### Attach to a running server (`Go: Connect to Server`)
+
+```json5
+{
+    "name": "Connect to server",
+    "type": "go",
+    "request": "attach",
+    "mode": "remote",
+    "remotePath": "${workspaceFolder}",
+    "port": 2345,
+    "host": "127.0.0.1"
+}
+```
+
+#### Debug an existing binary
+
+There is no snippet suggestion for this configuration.
+
+```json
+{
+    "name": "Launch executable",
+    "type": "go",
+    "request": "launch",
+    "mode": "exec",
+    "program": "/absolute/path/to/executable"
+}
+```
+
+If passing arguments to or calling subcommands and flags from a binary, the `args` property can be used.
+
+```json
+{
+    "name": "Launch executable",
+    "type": "go",
+    "request": "launch",
+    "mode": "exec",
+    "program": "/absolute/path/to/executable",
+    "args": ["subcommand", "arg", "--flag"],
+}
+```
+
+## Debugging on [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/)
+
+If you are using using WSL, you will need the WSL 2 Linux kernel.  See [WSL 2 Installation](https://docs.microsoft.com/en-us/windows/wsl/wsl2-install) and note the Window 10 build version requirements.
+
+## Remote Debugging
+
+<!--TODO(quoctruong): We use "remote" and "target", as well as "local" here. We should define these terms more clearly and be consistent about which we use.-->
+
+To debug on a remote machine, you must first run a headless Delve server on the target machine. The examples below assume that you are in the same folder as the package you want to debug. If not, please refer to the [`dlv debug` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_debug.md).
+
+To start the headless Delve server:
+
+```bash
+dlv debug --headless --listen=:2345 --log --api-version=2
+```
+
+Any arguments that you want to pass to the program you are debugging must also be passed to this Delve server. For example:
+
+```bash
+dlv debug --headless --listen=:2345 --log -- -myArg=123
+```
+
+Then, create a remote debug configuration in your `launch.json`.
+
+```json5
+{
+    "name": "Launch remote",
+    "type": "go",
+    "request": "attach",
+    "mode": "remote",
+    "remotePath": "/absolute/path/dir/on/remote/machine",
+    "port": 2345,
+    "host": "127.0.0.1",
+    "cwd": "/absolute/path/dir/on/local/machine",
+}
+```
+
+In the example, the VS Code debugger will run on the same machine as the headless `dlv` server. Make sure to update the `port` and `host` settings to point to your remote machine.
+
+`remotePath` should point to the absolute path of the program being debugged in the remote machine. `cwd` should point to the absolute path of the working directory of the program being debugged on your local machine. This should be the counterpart of the folder in `remotePath`. See [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) for updates regarding `remotePath` and `cwd`. You can also use the equivalent `substitutePath` configuration.
+
+```json5
+{
+    "name": "Launch remote",
+    "type": "go",
+    "request": "attach",
+    "mode": "remote",
+    "substitutePath": [
+		{
+			"from": "/absolute/path/dir/on/local/machine",
+			"to": "/absolute/path/dir/on/remote/machine",
+		},
+	],
+    "port": 2345,
+    "host": "127.0.0.1",
+    "cwd": "/absolute/path/dir/on/local/machine",
+}
+```
+
+If you do not set, `remotePath` or `substitutePath`, then the debug adapter will attempt to infer the path mappings. See [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) for more information.
+
+When you run the `Launch remote` target, VS Code will send debugging commands to the `dlv` server you started, instead of launching it's own `dlv` instance against your program.
+
+For further examples, see [this launch configuration for a process running in a Docker host](https://github.com/lukehoban/webapp-go/tree/debugging).
+
+## Troubleshooting
+
+Debugging is one of the most complex features offered by this extension. The features are not complete, and a new implementation is currently being developed (see [golang/vscode-go#23](https://github.com/golang/vscode-go/issues/23)).
+
+The suggestions below are intended to help you troubleshoot any problems you encounter. If you are unable to resolve the issue, please take a look at the [current known debugging issues](https://github.com/golang/vscode-go/issues?q=is%3Aissue+is%3Aopen+label%3Adebug) or [file a new issue](https://github.com/golang/vscode-go/issues/new/choose).
+
+### Read documentation and [common issues](#common-issues)
+
+Start by taking a quick glance at the [common issues](#common-issues) described below. You can also check the [Delve FAQ](https://github.com/go-delve/delve/blob/master/Documentation/faq.md) in case the problem is mentioned there.
+
+### Update Delve
+
+If the problem persists, it's time to start troubleshooting. A good first step is to make sure that you are working with the latest version of Delve. You can do this by running the [`Go: Install/Update Tools`](settings.md#go-installupdate-tools) command and selecting [`dlv`](tools.md#dlv).
+
+### Check your [launch configuration](#launch-configurations)
+
+Next, confirm that your [launch configuration](#launch-configurations) is correct.
+
+One common error is `could not launch process: stat ***/debug.test: no such file or directory`. You may see this while running in the `test` mode. This happens when the `program` attribute points to a folder with no test files, so ensure that the `program` attribute points to a directory containing the test files you wish to debug.
+
+Also, check the version of the Delve API used in your [launch configuration](#launch-configurations). This is handled by the `–api-version` flag, `2` is the default. If you are debugging on a remote machine, this is particularly important, as the versions on the local and remote machines much match. You can change the API version by editing the [`launch.json` file](#launch-configurations).
+
+### Check for multiple versions of Delve
+
+You might have multiple different versions of [`dlv`](tools.md#dlv) installed, and VS Code Go could be using a wrong or old version. Run the [`Go: Locate Configured Go Tools`](settings.md#go-locate-configured-go-tools) command and see where VS Code Go has found `dlv` on your machine. You can try running `which dlv` to see which version of `dlv` you are using on the [command-line](https://github.com/go-delve/delve/tree/master/Documentation/cli).
+
+To fix the issue, simply delete the version of `dlv` used by the Go extension. Note that the extension first searches for binaries in your `$GOPATH/bin` and then looks on your `$PATH`.
+
+If you see the error message `Failed to continue: "Error: spawn EACCES"`, the issue is probably multiple versions of `dlv`.
+
+### Try building your binary **without** compiler optimizations
+
+If you notice `Unverified breakpoints` or missing variables, ensure that your binary was built **without** compiler optimizations. Try building the binary with `-gcflags="all=-N -l"`.
+
+### Check your `GOPATH`
+
+Make sure that the debugger is using the right [`GOPATH`](gopath.md). This is probably the issue if you see `Cannot find package ".." in any of ...` errors. Read more about configuring your [GOPATH](gopath.md) or [file an issue report](https://github.com/golang/vscode-go/issues/new/choose).
+
+**As a work-around**, add the correct `GOPATH` as an environment variable in the `env` property in the `launch.json` file.
+
+### Enable logging
+
+Next, check the logs produced by Delve. These will need to be manually enabled. Follow these steps:
+
+* Set `"showLog": true` in your launch configuration. This will show Delve logs in the Debug Console pane (Ctrl+Shift+Y).
+* Set `"trace": "log"` in your launch configuration. Again, you will see logs in the Debug Console pane (Ctrl+Shift+Y). These logs will also be saved to a file and the path to this file will be printed at the top of the Debug Console.
+* Set `"logOutput": "rpc"` in your launch configuration. You will see logs of the RPC messages going between VS Code and Delve. Note that for this to work, you must also have set `"showLog": true`.
+  * The `logOutput` attribute corresponds to the `--log-output` flag used by Delve. It is a comma-separated list of components that should produce debug output.
+
+See [common issues](#common-issues) below to decipher error messages you may find in your logs.
+
+With `"trace": "log"`, you will see the actual call being made to `dlv`. To aid in your investigation, you can copy that and run it in your terminal.
+
+### **Optional**: Debug the debugger
+
+This is not a required step, but if you want to continue digging deeper, you can, in fact, debug the debugger. The code for the debugger can be found in the [debug adapter module](../src/debugAdapter). See our [contribution guide](contributing.md) to learn how to [run](contributing.md#run) and [sideload](contributing.md#sideload) the Go extension.
+
+### Ask for help
+
+At this point, it's time to look at the [common issues](#common-issues) below or the [existing debugging issues](https://github.com/golang/vscode-go/issues?q=is%3Aissue+is%3Aopen+label%3Adebug) on the [issue tracker](https://github.com/golang/vscode-go/issues). If that still doesn't solve your problem, [file a new issue](https://github.com/golang/vscode-go/issues/new/choose).
+
+## Common Issues
+
+### delve/launch hangs with no messages on WSL
+
+Try running ```delve debug ./main``` in the WSL command line and see if you get a prompt.
+
+**_Solution_**: Ensure you are running the WSL 2 Kernel, which (as of 4/15/2020) requires an early release of the Windows 10 OS. This is available to anyone via the Windows Insider program. See [Debugging on WSL](#debugging-on-windows-subsystem-for-linux-wsl).
+
+### could not launch process: could not fork/exec
+
+The solution this issue differs based on your OS.
+
+#### OSX
+
+This usually happens on OSX due to signing issues. See the discussions in [Microsoft/vscode-go#717](https://github.com/Microsoft/vscode-go/issues/717), [Microsoft/vscode-go#269](https://github.com/Microsoft/vscode-go/issues/269) and [go-delve/delve#357](https://github.com/go-delve/delve/issues/357).
+
+**_Solution_**: You may have to uninstall dlv and install it manually as described in the [Delve instructions](https://github.com/go-delve/delve/blob/master/Documentation/installation/osx/install.md#manual-install).
+
+#### Linux/Docker
+
+Docker has security settings preventing `ptrace(2)` operations by default within the container.
+
+**_Solution_**: To run your container insecurely, pass `--security-opt=seccomp:unconfined` to `docker run`. See [go-delve/delve#515](https://github.com/go-delve/delve/issues/515) for references.
+
+#### could not launch process: exec: "lldb-server": executable file not found in $PATH
+
+This error can show up for Mac users using Delve versions 0.12.2 and above. `xcode-select --install` has solved the problem for a number of users.
+
+### Debugging symlink directories
+
+Since the debugger and go compiler use the actual filenames, extra configuration is required to debug symlinked directories. Use the `substitutePath` property to tell the debugAdapter how to properly translate the paths. For example, if your project lives in `/path/to/actual/helloWorld`, but the project is open in vscode under the linked folder `/path/to/hello`, you can add the following to your config to set breakpoints in the files in `/path/to/hello`:
+
+```json5
+{
+    "name": "Launch remote",
+    "type": "go",
+    "request": "launch",
+    "mode": "debug",
+    "program": "/path/to/hello",
+    "substitutePath": [
+		{
+			"from": "/path/to/hello",
+			"to": "/path/to/actual/helloWorld",
+		},
+	],
+}
+```
+
+This extension does not provide general support for debugging projects containing symlinks. If `substitutePath` does not meet your needs, please consider commenting on this issue that contains updates to symlink support reference [golang/vscode-go#622](https://github.com/golang/vscode-go/issues/622).
+
+[Delve]: https://github.com/go-delve/delve
+[VS Code variables]: https://code.visualstudio.com/docs/editor/variables-reference
+[snippets]: https://code.visualstudio.com/docs/editor/userdefinedsnippets
+[Command Palette]: https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette
diff --git a/docs/debugging.md b/docs/debugging.md
index ae6dab5..3027b2d 100644
--- a/docs/debugging.md
+++ b/docs/debugging.md
@@ -1,448 +1,280 @@
 # Debugging
 
-This document explains how to debug your Go programs in VS Code. The Go debugger is [Delve]. You can read more about it in the [Delve documentation](https://github.com/go-delve/delve/tree/master/Documentation).
+The Go extension allows you to launch or attach to Go programs for debugging. You can inspect variables and stacks, setting breakpoints, and do other debugging activities using [VS Code’s Debugging UI](https://code.visualstudio.com/docs/editor/debugging).
 
-📣 Integration with the [Delve's native DAP implementation](https://github.com/golang/vscode-go/tree/master/docs/dlv-dap.md) is available for preview. Please give it a try and provide feedback!
+These debugging features are possible by using [Delve](https://github.com/go-delve/delve), the Go debugger.
+The Go extension has been communicating with Delve through a custom debug adapter program (`legacy` mode).
+As the new [`Delve`'s native DAP implementation](https://github.com/go-delve/delve/tree/master/service/dap) becomes available,
+the Go extension is transitioning to skip the legacy debug adapter and directly communicate with Delve for local debugging.
 
-## Overview
+** 📣 We are happy to announce that now this new mode of Delve integration (_`dlv-dap`_ mode) is enabled for _local_ _debugging_ by default! **
 
-* [Set up](#set-up)
-  * [Installation](#installation)
-  * [Configuration](#configuration)
-* [Launch Configurations](#launch-configurations)
-  * [Specifying build tags](#specifying-build-tags)
-  * [Specifying other build flags](#specifying-other-build-flags)
-  * [Using VS Code Variables](#using-vs-code-variables)
-  * [Snippets](#snippets)
-* [Debugging on Windows Subsystem for Linux (WSL)](#debugging-on-windows-subsystem-for-linux-wsl)
-* [Remote Debugging](#remote-debugging)
-* [Troubleshooting](#troubleshooting)
-  * [Read documentation and common issues](#read-documentation-and-common-issues)
-  * [Update Delve](#update-delve)
-  * [Check for multiple versions of Delve](#check-for-multiple-versions-of-delve)
-  * [Check your launch configuration](#check-your-launch-configuration)
-  * [Check your GOPATH](#check-your-gopath)
-  * [Enable logging](#enable-logging)
-  * [Optional: Debug the debugger](#optional-debug-the-debugger)
-  * [Ask for help](#ask-for-help)
-* [Common issues](#common-issues)
+Delve DAP implementation's support for remote debugging is still a work in progress and the Go extension still uses
+the legacy debug adapter for the debug configuration with the `"remote"` mode.
 
-## Set up
+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] should be installed by default when you install this extension.
+## Getting Started
 
-You may need to update `dlv` to the latest version to support the latest version
-of Go&mdash;see [Installation](#installation) below.
+Open a file to debug (either `package main` source file or the test file) in the editor, and select the `Run and Debug` button from [the Run view](https://code.visualstudio.com/docs/editor/debugging#_run-view). Alternatively, you can start debugging using `Start Debugging (F5)` command from [the Run menu](https://code.visualstudio.com/docs/editor/debugging#_run-menu) or from [the Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (Linux/Windows: Ctrl+Shift+P, Mac: ⇧+⌘+P).
 
-### Installation
+When no configuration is configured yet (no `.vscode/launch.json` file), the extension will choose a default configuration based on the file open in the editor.
 
-You can also install Delve manually in one of two ways:
+If you already have launch configurations for the project (`.vscode/launch.json`), the Run view will display the configuration list to choose from.
 
-1. Open the [Command Palette][] (Windows/Linux: Ctrl+Shift+P; OSX: Shift+Command+P), select [`Go: Install/Update Tools`](settings.md#go-installupdate-tools), and select [`dlv`](tools.md#dlv).
-2. Follow the [Delve installation instructions](https://github.com/go-delve/delve/tree/master/Documentation/installation).
+<p align="center">
+<img src="images/dlvdap-install.gif" alt="Delve DAP Install" width="75%">
+<br/>
+<em>❗ When you start debugging in `dlv-dap` mode for the first time, the extension will ask to install  Delve built from head (`dlv-dap`). Please follow the instructions to install, and then start the debugging session again (i.e. selecting the source file, pressing F5 or click the codelens).</em>
+</p>
 
-### Start debugging
+<div style="text-align: center;"></div>
 
-1. Open the `package main` source file or the test file you want to debug.
-2. Start debugging using one of the following options:
-   * Open the [Command Palette][], select
-     `Debug: Start Debugging`, then select `Go`.
-   * Open the debug window (Windows/Linux: Ctrl+Shift+D; OSX: Shift+Command+D) and click
-     `Run and Debug`, then select `Go`.
-   * Select **Run > Start Debugging** from the main menu.
+Watch ["Go: Writing and debugging fast, reliable, and efficient software"](https://www.youtube.com/watch?v=6r08zGi38Tk&list=PLj6YeMhvp2S40Q-TEPEKOeypLvTVd5uME&index=1) to learn more about debugging features.
 
-   See [the VS Code Debugging documentation](https://code.visualstudio.com/docs/editor/debugging)
-   for more information.
+Please review [the Features section](#features) that provides an overview of the debug UI and available features.
+### Staying Up-To-Date
 
-### Configuration
+[Delve’s native DAP implementation](https://github.com/go-delve/delve/tree/master/service/dap) is under active development, so take advantage of the most recent features and bug fixes by using Delve built from its master branch. The Go extension maintains this newest version of Delve separately from the officially released version of `dlv` and installs it with the name `dlv-dap`.
 
-You may not need to configure any settings to start debugging your programs, but you should be aware that the debugger looks at the following settings.
+The easiest way to update `dlv-dap` on demand is to use the `"Go: Install/Update Tools"` command from the Command Palette (Linux/Windows: Ctrl+Shift+P, Mac: ⇧+⌘+P). The command will show `dlv-dap` in the tool list. Select `dlv-dap`, and the extension will build the tool at master.
 
-* Related to [`GOPATH`](gopath.md):
-  * [`go.gopath`](settings.md#go.gopath)
-  * [`go.inferGopath`](settings.md#go.inferGopath)
-* [`go.delveConfig`](settings.md#go.delveConfig)
-  * `apiVersion`: Controls the version of the Delve API used (default: `2`).
-  * `dlvLoadConfig`: The configuration passed to Delve, which controls how variables are shown in the Debug pane. Not applicable when `apiVersion` is 1.
-    * `maxStringLen`: Maximum number of bytes read from a string (default: `64`).
-    * `maxArrayValues`: Maximum number of elements read from an array, slice, or map (default: `64`).
-    * `maxStructFields`: Maximum number of fields read from a struct. A setting of `-1` indicates that all fields should be read (default: `-1`).
-    * `maxVariableRecurse`: How far to recurse when evaluating nested types (default: `1`).
-    * `followPointers`: Automatically dereference pointers (default: `true`).
-  * `showGlobalVariables`: Show global variables in the Debug view (default: `false`).
-  * `debugAdapter`: Controls which debug adapter to use (default: `legacy`).
-  * `substitutePath`: Path mappings to apply to get from a path in the editor to a path in the compiled program (default: `[]`).
+Once `dlv-dap` is installed on your system, the extension will prompt you for update whenever installing a newer version is necessary (usually after the Go extension upgrade). You can set the `go.toolsManagement.autoUpdate` setting so the extension can update `dlv-dap` automatically for you.
 
-There are some common cases when you might want to tweak the Delve configurations.
+If you need to install `dlv-dap` manually outside of VS Code (for example, you are building a dev container with necessary tools preinstalled), please see the [Manual Installation](#bookmark=id.xuaxofprncd5) section.
 
-* To change the default cap of 64 on string and array length when inspecting variables in the Debug view, set `maxStringLen`. (See a related known issue: [golang/vscode-go#126](https://github.com/golang/vscode-go/issues/126)).
-* To evaluate nested variables in the Run view, set `maxVariableRecurse`.
+### Switching to legacy debug adapter
 
-## Launch Configurations
+If you need to use the legacy debug adapter (`legacy` mode) by default,
+add the following in your VSCode settings.
 
-To get started debugging, run the command `Debug: Open launch.json`. If you did not already have a `launch.json` file for your project, this will create one for you. It will contain this default configuration, which can be used to debug the current package. With mode `auto`, the file that is currently open will determine whether to debug the program as a test. If `program` is instead set to a Go file, that file will determine which mode to run in.
+Note that the extension still uses the legacy debug adapter for remote debugging.
 
-```json5
-{
-    "version": "0.2.0",
-    "configurations": [
-        {
-            "name": "Launch",
-            "type": "go",
-            "request": "launch",
-            "mode": "auto",
-            "program": "${fileDirname}",
-            "env": {},
-            "args": []
-        }
-    ]
-}
+```
+    "go.delveConfig": {
+        "debugAdapter": "legacy",
+    }
 ```
 
-There are some more properties that you can adjust in the debug configuration:
+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 `"dlv-dap"` and `"legacy"` mode.
 
-Property   | Description
---------   | -----------
-name       | The name for your configuration as it appears in the drop-down in the Run view.
-type       | Always leave this set to `"go"`. VS Code uses this setting to determine which extension should be used for debugging.
-request    | One of `launch` or `attach`. Use `attach` when you want to attach to a running process.
-mode       | For `launch` requests, one of `auto`, `debug`, `remote`, `test`, or `exec`. For `attach` requests, use `local` or `remote`.
-program    | In `test` or `debug` mode, this refers to the absolute path to the package or file to debug. In `exec` mode, this is the existing binary file to debug. Not applicable to `attach` requests.
-env        | Environment variables to use when debugging. Use the format: `{ "NAME": "VALUE" }`. Not applicable to `attach` requests.
-envFile    | Absolute path to a file containing environment variable definitions. The environment variables passed in via the `env` property override the ones in this file.
-args       | Array of command-line arguments to pass to the program being debugged.
-showLog    | If `true` and `logDest` is not set, Delve logs will be printed in the Debug Console panel. If `true` and `logDest` is set, logs will be written to the `logDest` file. This corresponds to `dlv`'s `--log` flag.
-logOutput  | Comma-separated list of Delve components (`debugger`, `gdbwire`, `lldbout`, `debuglineerr`, `rpc`) that should produce debug output when `showLog` is `true`. This corresponds to `dlv`'s `--log-output` flag.
-logDest    | Absolute path to the delve log output file. This corresponds to `dlv`'s `--log-dest` flag, but number (used for file descriptor) is disallowed. Supported only in dlv-dap mode on Linux and Mac.
-buildFlags | Build flags to pass to the Go compiler. This corresponds to `dlv`'s `--build-flags` flag.
-dlvFlags   | Extra flags passed to `dlv`. See `dlv help` for the full list of supported flags. This is useful when users need to pass less commonly used or new flags such as `--only-same-user`, `--check-go-version`. Note that some flags such as `--log-output`, `--log`, `--log-dest`, `--api-version` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.
-remotePath | If remote debugging (`mode`: `remote`), this should be the absolute path to the package being debugged on the remote machine. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant. Becomes the first mapping in substitutePath.
-substitutePath | An array of mappings from an absolute local path to an absolute remote path that is used by the debuggee. The debug adapter will replace the local path with the remote path in all of the calls. The mappings are applied in order, and the first matching mapping is used. This can be used to map files that have moved since the program was built, different remote paths, and symlinked files or directories. This is intended to be equivalent to the [substitute-path](https://github.com/go-delve/delve/tree/master/Documentation/cli#config) configuration, and will eventually configure substitute-path in Delve directly.
-cwd | The working directory to be used in running the program. If remote debugging (`mode`: `remote`), this should be the absolute path to the working directory being debugged on the local machine. The extension defaults to the workspace folder, or the workspace folder of the open file in multi root workspaces. See the section on [Remote Debugging](#remote-debugging) for further details. [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) is also relevant.
-processId  | This is the process ID of the executable you want to debug. Applicable only when using the `attach` request in `local` mode. By setting this to the command name of the process, `${command:pickProcess}`, or`${command:pickGoProcess}` a quick pick menu will show a list of processes to choose from.
+If you chose to switch to legacy because of bugs in the new debug adapter,
+please [open an issue](https://github.com/golang/vscode-go/issues/new)
+to help us improve the new debug adapter.
+## Features
 
-### Specifying [build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints)
+For general debugging features such as inspecting variables, setting breakpoints, and other activities that aren't language-dependent, review [VS Code debugging](https://code.visualstudio.com/docs/editor/debugging).
 
-If your program contains [build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints), you can use the `buildFlags` property. For example, if you build your code with:
+### Configure
 
-```bash
-go build -tags=whatever
+When you need more than the default debugging setup, you can create a launch configuration file for the project by clicking the "create a launch.json file" link in [the Run view](https://code.visualstudio.com/docs/editor/debugging#_run-view). Then, choose from the debug configuration drop-down menu. VS Code will create a `launch.json` file in a .vscode folder in your workspace (project root folder) or in your [user settings](https://code.visualstudio.com/docs/editor/debugging#_global-launch-configuration) or [workspace settings](https://code.visualstudio.com/docs/editor/multi-root-workspaces#_workspace-launch-configurations).
+
+If you already have a `launch.json` for your project, you can open it using `Open launch.json`.
+
+To add a new configuration to an existing `launch.json`, choose the "Add Configuration…" button to invoke the snippet IntelliSense.
+
+<p align="center">
+<img src="images/create-launch-json.gif" alt="Create launch.json" width="75%">
+</p>
+
+There are many configuration attributes (see [the Launch.json attributes](#launchjson-attributes) section). IntelliSense in VS Code’s launch.json editor will help you navigate available options and documentation.
+
+### Launch
+
+You can choose "Start Debugging (F5)" and "Run Without Debugging (^F5)" a.k.a the `noDebug` mode. This feature uses a `launch` request type configuration. Its `program` attribute needs to be either the go file or folder of the main package or test file. In this mode, the Go extension will start the debug session by building and launching the program. The launched program will be terminated when the debug session ends.
+
+*   Supported modes
+    *   `debug`: build and debug a main package
+    *   `test`: build and debug a test
+    *   `exec`: debug a precompiled binary. The binary needs to be built with `-gcflags=all="-N -l"` flags to avoid stripping debugging information.
+    *   `auto`: automatically choose between `debug` and `test` depending on the open file.
+
+### Attach
+
+You can debug an already running program using the `attach` request type configuration. With the `attach` request, the Go extension starts `dlv-dap` and configures it to attach to the specified process. Users can select the process to debug with one of the following options:
+
+
+*   Specifying the numeric process id (PID) with the `processId` attribute.
+*   Specifying the target program name in the `processId` attribute. If there are multiple processes matching the specified program name, the extension will show the list of matching processes at the start of the debug session.
+*   Specifying `0` in the `processId` attribute and selecting the process from the drop-down menu at the start of the debug session.
+
+<p align="center">
+<img src="images/attach.gif" alt="Attach to a running process" width="75%">
+</p>
+
+When you end the debug session, the debug UI allows you to choose to either
+
+*   Disconnect: detach and leave the process running. (default)
+*   Terminate: terminate the attached process.
+
+<p align="center">
+<img src="images/attach-terminate.gif" alt="Terminate Debugging started with Attach" style="width: 30%">
+</p>
+
+<!-- TODO:[SupportSuspendDebuggee](https://code.visualstudio.com/updates/v1_56#_disconnect-debugger-and-keep-debuggee-suspended) -->
+
+###  Debug Actions
+
+Once a debug session starts, the Debug toolbar will appear on the top of the editor.
+
+<p align="center">
+<img src="images/debug-toolbar.png" alt="Debug Tool Bar" width="30%">
+</p>
+
+*   Continue / Pause F5
+*   Step Over (aka `next` in Delve) F10
+*   Step Into (aka `step` in Delve) F11
+*   Step Out (aka `stepout` in Delve) Shift+F11 or ⇧F11
+*   Restart (currently this is "Stop + Start")  Ctrl+Shift+F5 or ⇧⌘F5
+*   Stop (terminate the debugee. Available in Launch request)  Shift+F5 or ⇧F5
+*   Disconnect (detach from the debugee. Available only in Attach request) Shift+F5 or ⇧F5
+*   Terminate (terminate the debugee. Available only in Attach request) Alt+Shift+F5 or ⌥⇧F5
+
+### Breakpoints
+
+See [VS Code’s Debug Documentation on Breakpoints](https://code.visualstudio.com/docs/editor/debugging#_breakpoints) to get familiar with VS Code’s UI. The Go debugger supports multiple ways to configure breakpoints.
+
+*   **Breakpoints**: you can set breakpoints by clicking on the editor margin or using F9 on the current line. If the breakpoints can’t be set by Delve, VS Code will show the failure reason and grey out the dot.
+
+<p align="center">
+<img src="images/invalid-breakpoint.png" alt="Invalid breakpoint" width="75%">
+</p>
+
+*   **Conditional breakpoints**: you can specify breakpoint conditions (similar to Delve’s [`condition` command](https://github.com/go-delve/delve/tree/master/Documentation/cli#condition)).
+    *   Expression condition: takes a boolean expression.
+    *   Hit count: supports comparison operators (`>`, `>=`, `<`, `<=`, `==`, `!=`) with an integer value. `% n` form means we should stop at the breakpoint when the hitcount is a multiple of `n`.
+
+<p align="center">
+<img src="images/conditional-breakpoint.gif" alt="Conditional Breakpoint" width="50%">
+</p>
+
+*   **Function Breakpoints**: breakpoints can be set based on function names.  Press the + button in the BREAKPOINTS section header and enter the location in the form of `<function>[:<line>]`. This sets the breakpoint in the `line` inside the `function`. The full syntax for `function` is `<package>.(*<receiver type>).<function_name>` as specified in [Delve’s location spec](https://github.com/go-delve/delve/blob/master/Documentation/cli/locspec.md#location-specifiers). Function breakpoints are shown with a red triangle in the BREAKPOINTS section.
+
+<p align="center">
+<img src="images/function-breakpoint.gif" alt="Function breakpoint" width="75%">
+</p>
+
+*   Logpoint (WIP)
+
+### Data Inspection
+
+You can inspect variables in the VARIABLES section of the Run view or by hovering over their source in the editor. Variable values and expression evaluation are relative to the selected stack frame in the CALL section.
+
+By default, the VARIABLES section hides global variables, and shows only local variables and function arguments. However, you can still inspect global variables from the DEBUG CONSOLE panel. If you prefer to have the VARIABLES section show global variables, set the `showGlobalVariables` attribute in the `launch.json` configuration, or set it in the `go.delveConfig` setting.
+
+When you select a variable and right click from the VARIABLES section, the context menu will  present shortcuts to features such as:
+
+*   Set Value: you can set/modify simple string, numeric, pointer values. Using composite literals, or memory allocation is not supported.
+*   Copy Value: this copies the value in clipboard.
+*   Copy as Expression: this is useful when you need to query from the REPL in the DEBUG CONSOLE panel.
+*   Add to Watch: this will automatically add the expression to the WATCH section.
+
+Shadowed variables will be marked with `()`.
+
+<p align="center">
+<img src="images/shadowed-variables.png" alt="Shadowed Variables" style="width: 50%">
+</p>
+
+⚠️ Delve debugger imposes variable loading limits to prevent loading too many variables at once and negatively impacting debugging latency. The `dlv-dap` mode uses a different approach. It takes advantage of the interactive UI features to provide on-demand loading of individual variables, paging of arrays, slices and maps and increased string limits depending on the context. We continue to explore additional interactive features to balance performance and usability of variable loading and look forward to your feedback.
+
+You can inspect variables and evaluate expressions from the DEBUG CONSOLE panel too. Acceptable expressions are either
+
+*   A valid [Delve expression](https://github.com/go-delve/delve/blob/master/Documentation/cli/expr.md), or
+*   `call <function_call_expression>` to call functions.
+
+<p align="center">
+<img src="images/debug-console.png" alt="Debug Console" width="50%">
+</p>
+
+Variables and expressions accepted in DEBUG CONSOLE can be also registered in the Run view’s WATCH section, so they can be evaluated automatically as you debug. The "Add to Watch" feature from the VARIABLES section is convenient when you want to register interesting variables.
+
+⚠️ Function call feature is highly EXPERIMENTAL due to the limitation in Go runtime. Registering function calls in the WATCH section can often be problematic. Pause, stop, and disconnect will not work while a function call is running.
+
+Hover over variables in editors during debugging shows the value of the variable. For this feature, VS Code extracts the variable expression and makes a request to the debugger to evaluate the expression. Delve evaluates the expression relative to the highlighted stack frame chosen in the CALL STACK. By default, that is the current top-most frame.
+
+<p align="center"><img src="images/variable-hover.png" alt="Hover over Variable in Source Code" width="50%">
+ </p>
+
+⚠️ Limitation
+
+*   VS Code heuristically determines the variable expression without full understanding of the scope & the currently selected frame. Delve tries to evaluate the provided expression in the selected frame. As a result, hover over variables outside the selected frame’s function may present incorrect information.
+
+### Call Stack
+
+You can inspect all goroutines and their stacks in the CALL STACK section. The CALL STACK section UI allows switching between goroutines or selecting a different stack frame. As a different stack frame or different goroutine is selected, the scope shown in the VARIABLE section will be updated for the newly selected stack frame, and the expressions in the WATCH section will be automatically reevaluated relative to the newly selected stack frame.
+
+<p align="center"><img src="images/callstack-section-annotated.gif" alt="Call Stack Section Overview" width="75%"> </p>
+
+1. Goroutine stacks are annotated with their internal goroutine IDs.
+2. The current goroutine is marked with `*`. If multiple goroutines stop (e.g. hit breakpoints) concurrently, Delve will pick one randomly. There also might not be a current goroutine (e.g. deadlock, pause or internal breakpoint hit by a system thread not running a goroutine).
+3. If you click a goroutine call stack from the CALL STACK section, the goroutine is _selected_.
+4. You can select a frame of the selected goroutine. The VARIABLE and WATCH sections will be updated accordingly and the cursor in the editor will be moved to the corresponding location in the source code.
+5. Runtime stack frames are deemphasized (greyed out or collapsed).
+6. Thread IDs are shown for scheduled goroutines.
+7. Stop reason. It’s possible that there are multiple reasons goroutines were stopped, but currently only one reason is presented.
+8. File name and line number of the frame.
+9. You can trigger a debug action with the selected goroutine. Note: Resuming or stopping only a single goroutine (Go Issue [25578](https://github.com/golang/go/issues/25578), [31132](https://github.com/golang/go/issues/31132)) is currently not supported, so the action will cause all the goroutines to get activated or paused.
+10. Function name of the frame.
+
+When the program stops due to exception, panic, or bad access error, the CALL STACK shows the stop reason and the editor highlights the source location with more details.
+
+<p align="center"><img src="images/panicinfo.png" alt="Panic" width="75%"></p>
+
+## Configuration
+
+### Launch.json Attributes
+
+There are many attributes that you can adjust in the launch and attach debug configuration. The following general attributes are mandatory for all launch configurations.
+
+*   `name`: the name of your configuration as it appears in the drop-down in the Run view.
+*   `type`: the debugging type VS Code uses to decide which debugging extension should be used. Always leave this set to `"go"`.
+*   `request`: `launch` or `attach`.
+
+Here is the list of attributes specific to Go debugging.
+
+<!-- DO NOT EDIT: Auto-generated by go run tools/generate -->
+<!-- SETTINGS BEGIN -->
+| Property | Launch | Attach |
+| --- | --- | --- |
+| `args` | Command line arguments passed to the debugged program.<br/> | <center>_n/a_</center> |
+| `backend` | Backend used by delve. Maps to `dlv`'s `--backend` flag.<br/><p>Allowed Values: `"default"`, `"native"`, `"lldb"`<br/> | <center>_same as Launch_</center>|
+| `buildFlags` | Build flags, to be passed to the Go compiler. Maps to dlv's `--build-flags` flag.<br/>(Default: `""`)<br/> | <center>_n/a_</center> |
+| `cwd` | Workspace relative or absolute path to the working directory of the program being debugged if a non-empty value is specified. The `program` folder is used as the working directory if `cwd` is omitted or empty.<br/>(Default: `""`)<br/> | Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.<br/>(Default: `"${workspaceFolder}"`)<br/> |
+| `debugAdapter` | Select which debug adapter to use with this launch configuration.<br/><p>Allowed Values: `"legacy"`, `"dlv-dap"`<br/>(Default: `dlv-dap`)<br/> | <center>_same as Launch_</center>|
+| `dlvFlags` | Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.<br/> | <center>_same as Launch_</center>|
+| `env` | Environment variables passed to the program.<br/> | <center>_n/a_</center> |
+| `envFile` | Absolute path to a file containing environment variable definitions. Multiple files can be specified by provided an array of absolute paths<br/>(Default: `${workspaceFolder}/.env`)<br/> | <center>_n/a_</center> |
+| `host` | The host name of the machine the delve debugger will be listening on. In `dlv-dap` mode, the extension will look for a delve DAP server running on the specified host:port so users are responsible for starting the server.<br/>(Default: `"127.0.0.1"`)<br/> | <center>_same as Launch_</center>|
+| `logDest` | dlv's `--log-dest` flag. See `dlv log` for details. Number argument is not allowed. Supported only in `dlv-dap` mode, and on Linux and Mac OS.<br/> | dlv's `--log-dest` flag. See `dlv log` for details. Number argument is not allowed. Supported only in `dlv-dap` mode and on Linux and Mac OS.<br/> |
+| `logOutput` | Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag. Check `dlv log` for details.<br/><p>Allowed Values: `"debugger"`, `"gdbwire"`, `"lldbout"`, `"debuglineerr"`, `"rpc"`, `"dap"`<br/>(Default: `"debugger"`)<br/> | <center>_same as Launch_</center>|
+| `mode` | One of `auto`, `debug`, `test`, `exec`. In `auto` mode, the extension will choose either `debug` or `test` depending on active editor window.<br/><p>Allowed Values: `"auto"`, `"debug"`, `"test"`, `"exec"`<br/>(Default: `auto`)<br/> | Indicates local or remote debugging. Local maps to the `dlv attach` command, remote maps to `connect`. `remote` is not supported in `dlv-dap` mode currently. Use `host` and `port` instead.<br/><p>Allowed Values: `"local"`, `"remote"`<br/>(Default: `local`)<br/> |
+| `output` | Output path for the binary of the debugee.<br/>(Default: `"debug"`)<br/> | <center>_n/a_</center> |
+| `port` | The port that the delve debugger will be listening on. In `dlv-dap` mode, the extension will look for a delve DAP server running on the specified host:port so users are responsible for starting the server.<br/>(Default: `2345`)<br/> | <center>_same as Launch_</center>|
+| `processId` | <center>_n/a_</center> | <br/><p><b>Option 1:</b> Use process picker to select a process to attach, or Process ID as integer.<br/><p>Allowed Values: `"${command:pickProcess}"`, `"${command:pickGoProcess}"`<br/><br/><p><b>Option 2:</b> Attach to a process by name. If more than one process matches the name, use the process picker to select a process.<br/><br/><p><b>Option 3:</b> The numeric ID of the process to be debugged. If 0, use the process picker to select a process.<br/><br/>(Default: `0`)<br/> |
+| `program` | Path to the program folder (or any go file within that folder) when in `debug` or `test` mode, and to the pre-built binary file to debug in `exec` mode. If it is not an absolute path, the extension interpretes it as a workspace relative path.<br/>(Default: `"${workspaceFolder}"`)<br/> | <center>_n/a_</center> |
+| `remotePath` | <center>_n/a_</center> | (Deprecated) *Use `substitutePath` instead.*<br/>The path to the source code on the remote machine, when the remote path is different from the local machine. If specified, becomes the first entry in substitutePath.<br/>(Default: `""`)<br/> |
+| `showGlobalVariables` | Boolean value to indicate whether global package variables should be shown in the variables pane or not.<br/>(Default: `false`)<br/> | <center>_same as Launch_</center>|
+| `showLog` | Show log output from the delve debugger. Maps to dlv's `--log` flag.<br/>(Default: `false`)<br/> | <center>_same as Launch_</center>|
+| `stackTraceDepth` | Maximum depth of stack trace collected from Delve.<br/>(Default: `50`)<br/> | <center>_same as Launch_</center>|
+| `stopOnEntry` | Automatically stop program after launch.<br/>(Default: `false`)<br/> | Automatically stop program after attach.<br/>(Default: `false`)<br/> |
+| `substitutePath` | An array of mappings from a local path (editor) to the remote path (debugee). This setting is useful when working in a file system with symbolic links, running remote debugging, or debugging an executable compiled externally. The debug adapter will replace the local path with the remote path in all of the calls.<br/><p><br/><ul><li>`"from"`: The absolute local path to be replaced when passing paths to the debugger.<br/>(Default: `""`)<br/></li><li>`"to"`: The absolute remote path to be replaced when passing paths back to the client.<br/>(Default: `""`)<br/></li></ul><br/> | An array of mappings from a local path (editor) to the remote path (debugee). This setting is useful when working in a file system with symbolic links, running remote debugging, or debugging an executable compiled externally. The debug adapter will replace the local path with the remote path in all of the calls.  Overriden by `remotePath`.<br/><p><br/><ul><li>`"from"`: The absolute local path to be replaced when passing paths to the debugger.<br/>(Default: `""`)<br/></li><li>`"to"`: The absolute remote path to be replaced when passing paths back to the client.<br/>(Default: `""`)<br/></li></ul><br/> |
+| `trace` | Various levels of logging shown in the debug console & 'Go Debug' output channel. When using the `legacy` debug adapter, the logs will also be written to a file if it is set to a value other than `error`.<br/><p>Allowed Values: `"verbose"`, `"trace"`, `"log"`, `"info"`, `"warn"`, `"error"`<br/>(Default: `"error"`)<br/> | <center>_same as Launch_</center>|
+<!-- SETTINGS END -->
+
+⚠️ `dlv-dap` needs file or directory values in the launch configuration to be absolute paths. When configuring those values, use [the VS Code variables substitution](https://code.visualstudio.com/docs/editor/variables-reference) - VS Code will resolve the variables inside strings in `launch.json` before passing the configuration to the Go extension and `dlv-dap`. For example, `${workspaceFolder}` will be replaced with the absolute path to the workspace root folder. When appropriate, the Go extension will resolve relative paths or home directory (~) before sending the configuration to `dlv-dap`.
+
+### **Debugging symlink directories**
+
+Since the debugger and go compiler use the actual filenames, extra configuration is required to debug symlinked directories. Use the substitutePath property to tell the `debugAdapter` how to properly translate the paths. For example, if your project lives in `/path/to/actual/helloWorld`, but the project is open in vscode under the linked folder `/path/to/hello`, you can add the following to your config to set breakpoints in the files in `/path/to/hello`:
+
 ```
-
-Then, set:
-
-```json5
-"buildFlags": "-tags=whatever"
-```
-
-in your launch configuration. This property supports multiple tags, which you can set by using single quotes. For example:
-
-```json5
-"buildFlags": "-tags='first,second,third'"
-```
-
-<!--TODO(rstambler): Confirm that the extension works with a comma (not space) separated list.-->
-
-### Specifying other build flags
-
-The flags specified in `buildFlags` and `env.GOFLAGS` are passed to the Go compiler when building your program for debugging. Delve adds `-gcflags='all=-N -l'` to the list of build flags to disable optimizations. User specified buildFlags conflict with this setting, so the extension removes them ([Issue #117](https://github.com/golang/vscode-go/issues/117)). If you wish to debug a program using custom `-gcflags`, build the program using `go build` and launch using `exec` mode:
-
-```json
-{
-    "name": "Launch executable",
-    "type": "go",
-    "request": "launch",
-    "mode": "exec",
-    "program": "/absolute/path/to/executable"
-}
-```
-
-Note that it is not recommended to debug optimized executables as Delve may not have the information necessary to properly debug your program.
-
-### Using [VS Code variables]
-
-Any property in the launch configuration that requires a file path can be specified in terms of [VS Code variables]. Here are some useful ones to know:
-
-* `${workspaceFolder}` refers to the root of the workspace opened in VS Code. If using a multi root workspace, you must specify the folder name `${workspaceFolder:folderName}`
-* `${fileWorkspaceFolder}` refers to the the current opened file's workspace folder.
-* `${file}` refers to the currently opened file.
-* `${fileDirname}` refers to the directory containing the currently opened file. This is typically also the name of the Go package containing this file, and as such, can be used to debug the currently opened package.
-
-### Snippets
-
-In addition to [VS Code variables], you can make use of [snippets] when editing the launch configuration in `launch.json`.
-
-When you type `go` in the `launch.json` file, you will see snippet suggestions for debugging the current file or package or a given test function.
-
-Below are the available sample configurations:
-
-#### Debug the current file (`Go: Launch file`)
-
-Recall that `${file}` refers to the currently opened file (see [Using VS Code Variables](#using-vs-code-variables)). For debugging a package that consists with multiple files, use `${fileDirname}` instead.
-
-```json5
-{
-    "name": "Launch file",
-    "type": "go",
-    "request": "launch",
-    "mode": "auto",
-    "program": "${file}"
-}
-```
-
-#### Debug a single test function (`Go: Launch test function`)
-
-Recall that `${workspaceFolder}` refers to the current workspace (see [Using VS Code Variables](#using-vs-code-variables)). You will need to manually specify the function name instead of `"MyTestFunction"`.
-
-```json5
-{
-    "name": "Launch test function",
-    "type": "go",
-    "request": "launch",
-    "mode": "test",
-    "program": "${workspaceFolder}",
-    "args": [
-        "-test.run",
-        "MyTestFunction"
-    ]
-}
-```
-
-#### Debug all tests in the given package (`Go: Launch test package`)
-
-A package is a collection of source files in the same directory that are compiled together.
-Recall that `${fileDirname}` refers to the directory of the open file (see [Using VS Code Variables](#using-vs-code-variables)).
-
-```json5
-{
-    "name": "Launch test package",
-    "type": "go",
-    "request": "launch",
-    "mode": "test",
-    "program": "${workspaceFolder}"
-}
-```
-
-#### Attach to a running local process via its process ID (`Go: Attach to local process`)
-
-Substitute `processName` with the name of the local process.
-
-```json5
-{
-    "name": "Attach to local process",
-    "type": "go",
-    "request": "attach",
-    "mode": "local",
-    "processId": "processName"
-}
-```
-
-#### Attach to a running server (`Go: Connect to Server`)
-
-```json5
-{
-    "name": "Connect to server",
-    "type": "go",
-    "request": "attach",
-    "mode": "remote",
-    "remotePath": "${workspaceFolder}",
-    "port": 2345,
-    "host": "127.0.0.1"
-}
-```
-
-#### Debug an existing binary
-
-There is no snippet suggestion for this configuration.
-
-```json
-{
-    "name": "Launch executable",
-    "type": "go",
-    "request": "launch",
-    "mode": "exec",
-    "program": "/absolute/path/to/executable"
-}
-```
-
-If passing arguments to or calling subcommands and flags from a binary, the `args` property can be used.
-
-```json
-{
-    "name": "Launch executable",
-    "type": "go",
-    "request": "launch",
-    "mode": "exec",
-    "program": "/absolute/path/to/executable",
-    "args": ["subcommand", "arg", "--flag"],
-}
-```
-
-## Debugging on [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/)
-
-If you are using using WSL, you will need the WSL 2 Linux kernel.  See [WSL 2 Installation](https://docs.microsoft.com/en-us/windows/wsl/wsl2-install) and note the Window 10 build version requirements.
-
-## Remote Debugging
-
-<!--TODO(quoctruong): We use "remote" and "target", as well as "local" here. We should define these terms more clearly and be consistent about which we use.-->
-
-To debug on a remote machine, you must first run a headless Delve server on the target machine. The examples below assume that you are in the same folder as the package you want to debug. If not, please refer to the [`dlv debug` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_debug.md).
-
-To start the headless Delve server:
-
-```bash
-dlv debug --headless --listen=:2345 --log --api-version=2
-```
-
-Any arguments that you want to pass to the program you are debugging must also be passed to this Delve server. For example:
-
-```bash
-dlv debug --headless --listen=:2345 --log -- -myArg=123
-```
-
-Then, create a remote debug configuration in your `launch.json`.
-
-```json5
-{
-    "name": "Launch remote",
-    "type": "go",
-    "request": "attach",
-    "mode": "remote",
-    "remotePath": "/absolute/path/dir/on/remote/machine",
-    "port": 2345,
-    "host": "127.0.0.1",
-    "cwd": "/absolute/path/dir/on/local/machine",
-}
-```
-
-In the example, the VS Code debugger will run on the same machine as the headless `dlv` server. Make sure to update the `port` and `host` settings to point to your remote machine.
-
-`remotePath` should point to the absolute path of the program being debugged in the remote machine. `cwd` should point to the absolute path of the working directory of the program being debugged on your local machine. This should be the counterpart of the folder in `remotePath`. See [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) for updates regarding `remotePath` and `cwd`. You can also use the equivalent `substitutePath` configuration.
-
-```json5
-{
-    "name": "Launch remote",
-    "type": "go",
-    "request": "attach",
-    "mode": "remote",
-    "substitutePath": [
-		{
-			"from": "/absolute/path/dir/on/local/machine",
-			"to": "/absolute/path/dir/on/remote/machine",
-		},
-	],
-    "port": 2345,
-    "host": "127.0.0.1",
-    "cwd": "/absolute/path/dir/on/local/machine",
-}
-```
-
-If you do not set, `remotePath` or `substitutePath`, then the debug adapter will attempt to infer the path mappings. See [golang/vscode-go#45](https://github.com/golang/vscode-go/issues/45) for more information.
-
-When you run the `Launch remote` target, VS Code will send debugging commands to the `dlv` server you started, instead of launching it's own `dlv` instance against your program.
-
-For further examples, see [this launch configuration for a process running in a Docker host](https://github.com/lukehoban/webapp-go/tree/debugging).
-
-## Troubleshooting
-
-Debugging is one of the most complex features offered by this extension. The features are not complete, and a new implementation is currently being developed (see [golang/vscode-go#23](https://github.com/golang/vscode-go/issues/23)).
-
-The suggestions below are intended to help you troubleshoot any problems you encounter. If you are unable to resolve the issue, please take a look at the [current known debugging issues](https://github.com/golang/vscode-go/issues?q=is%3Aissue+is%3Aopen+label%3Adebug) or [file a new issue](https://github.com/golang/vscode-go/issues/new/choose).
-
-### Read documentation and [common issues](#common-issues)
-
-Start by taking a quick glance at the [common issues](#common-issues) described below. You can also check the [Delve FAQ](https://github.com/go-delve/delve/blob/master/Documentation/faq.md) in case the problem is mentioned there.
-
-### Update Delve
-
-If the problem persists, it's time to start troubleshooting. A good first step is to make sure that you are working with the latest version of Delve. You can do this by running the [`Go: Install/Update Tools`](settings.md#go-installupdate-tools) command and selecting [`dlv`](tools.md#dlv).
-
-### Check your [launch configuration](#launch-configurations)
-
-Next, confirm that your [launch configuration](#launch-configurations) is correct.
-
-One common error is `could not launch process: stat ***/debug.test: no such file or directory`. You may see this while running in the `test` mode. This happens when the `program` attribute points to a folder with no test files, so ensure that the `program` attribute points to a directory containing the test files you wish to debug.
-
-Also, check the version of the Delve API used in your [launch configuration](#launch-configurations). This is handled by the `–api-version` flag, `2` is the default. If you are debugging on a remote machine, this is particularly important, as the versions on the local and remote machines much match. You can change the API version by editing the [`launch.json` file](#launch-configurations).
-
-### Check for multiple versions of Delve
-
-You might have multiple different versions of [`dlv`](tools.md#dlv) installed, and VS Code Go could be using a wrong or old version. Run the [`Go: Locate Configured Go Tools`](settings.md#go-locate-configured-go-tools) command and see where VS Code Go has found `dlv` on your machine. You can try running `which dlv` to see which version of `dlv` you are using on the [command-line](https://github.com/go-delve/delve/tree/master/Documentation/cli).
-
-To fix the issue, simply delete the version of `dlv` used by the Go extension. Note that the extension first searches for binaries in your `$GOPATH/bin` and then looks on your `$PATH`.
-
-If you see the error message `Failed to continue: "Error: spawn EACCES"`, the issue is probably multiple versions of `dlv`.
-
-### Try building your binary **without** compiler optimizations
-
-If you notice `Unverified breakpoints` or missing variables, ensure that your binary was built **without** compiler optimizations. Try building the binary with `-gcflags="all=-N -l"`.
-
-### Check your `GOPATH`
-
-Make sure that the debugger is using the right [`GOPATH`](gopath.md). This is probably the issue if you see `Cannot find package ".." in any of ...` errors. Read more about configuring your [GOPATH](gopath.md) or [file an issue report](https://github.com/golang/vscode-go/issues/new/choose).
-
-**As a work-around**, add the correct `GOPATH` as an environment variable in the `env` property in the `launch.json` file.
-
-### Enable logging
-
-Next, check the logs produced by Delve. These will need to be manually enabled. Follow these steps:
-
-* Set `"showLog": true` in your launch configuration. This will show Delve logs in the Debug Console pane (Ctrl+Shift+Y).
-* Set `"trace": "log"` in your launch configuration. Again, you will see logs in the Debug Console pane (Ctrl+Shift+Y). These logs will also be saved to a file and the path to this file will be printed at the top of the Debug Console.
-* Set `"logOutput": "rpc"` in your launch configuration. You will see logs of the RPC messages going between VS Code and Delve. Note that for this to work, you must also have set `"showLog": true`.
-  * The `logOutput` attribute corresponds to the `--log-output` flag used by Delve. It is a comma-separated list of components that should produce debug output.
-
-See [common issues](#common-issues) below to decipher error messages you may find in your logs.
-
-With `"trace": "log"`, you will see the actual call being made to `dlv`. To aid in your investigation, you can copy that and run it in your terminal.
-
-### **Optional**: Debug the debugger
-
-This is not a required step, but if you want to continue digging deeper, you can, in fact, debug the debugger. The code for the debugger can be found in the [debug adapter module](../src/debugAdapter). See our [contribution guide](contributing.md) to learn how to [run](contributing.md#run) and [sideload](contributing.md#sideload) the Go extension.
-
-### Ask for help
-
-At this point, it's time to look at the [common issues](#common-issues) below or the [existing debugging issues](https://github.com/golang/vscode-go/issues?q=is%3Aissue+is%3Aopen+label%3Adebug) on the [issue tracker](https://github.com/golang/vscode-go/issues). If that still doesn't solve your problem, [file a new issue](https://github.com/golang/vscode-go/issues/new/choose).
-
-## Common Issues
-
-### delve/launch hangs with no messages on WSL
-
-Try running ```delve debug ./main``` in the WSL command line and see if you get a prompt.
-
-**_Solution_**: Ensure you are running the WSL 2 Kernel, which (as of 4/15/2020) requires an early release of the Windows 10 OS. This is available to anyone via the Windows Insider program. See [Debugging on WSL](#debugging-on-windows-subsystem-for-linux-wsl).
-
-### could not launch process: could not fork/exec
-
-The solution this issue differs based on your OS.
-
-#### OSX
-
-This usually happens on OSX due to signing issues. See the discussions in [Microsoft/vscode-go#717](https://github.com/Microsoft/vscode-go/issues/717), [Microsoft/vscode-go#269](https://github.com/Microsoft/vscode-go/issues/269) and [go-delve/delve#357](https://github.com/go-delve/delve/issues/357).
-
-**_Solution_**: You may have to uninstall dlv and install it manually as described in the [Delve instructions](https://github.com/go-delve/delve/blob/master/Documentation/installation/osx/install.md#manual-install).
-
-#### Linux/Docker
-
-Docker has security settings preventing `ptrace(2)` operations by default within the container.
-
-**_Solution_**: To run your container insecurely, pass `--security-opt=seccomp:unconfined` to `docker run`. See [go-delve/delve#515](https://github.com/go-delve/delve/issues/515) for references.
-
-#### could not launch process: exec: "lldb-server": executable file not found in $PATH
-
-This error can show up for Mac users using Delve versions 0.12.2 and above. `xcode-select --install` has solved the problem for a number of users.
-
-### Debugging symlink directories
-
-Since the debugger and go compiler use the actual filenames, extra configuration is required to debug symlinked directories. Use the `substitutePath` property to tell the debugAdapter how to properly translate the paths. For example, if your project lives in `/path/to/actual/helloWorld`, but the project is open in vscode under the linked folder `/path/to/hello`, you can add the following to your config to set breakpoints in the files in `/path/to/hello`:
-
-```json5
 {
     "name": "Launch remote",
     "type": "go",
     "request": "launch",
     "mode": "debug",
-    "program": "/path/to/hello",
+    "program": "/path/to/actual/helloWorld",
     "substitutePath": [
 		{
 			"from": "/path/to/hello",
@@ -452,7 +284,188 @@
 }
 ```
 
-This extension does not provide general support for debugging projects containing symlinks. If `substitutePath` does not meet your needs, please consider commenting on this issue that contains updates to symlink support reference [golang/vscode-go#622](https://github.com/golang/vscode-go/issues/622).
+<!--### Options for "Add Configuration"
+
+TODO: clean up the snippets in package.json
+
+TODO: auto-generate from package.json. -->
+
+### Settings
+
+You can adjust the default value of the following configuration properties using `go.delveConfig` settings. These default values are useful when you choose to run a debug session without the launch configuration set in `launch.json`. For example, debug sessions started using the `Debug Test` code lenses use the adjusted values from these settings.
+
+*   [`go.delveConfig`](settings.md#go.delveConfig)
+    *   `debugAdapter`: Controls which debug adapter to use (default: `legacy`). Select ‘dlv-dap’.
+    *   `showGlobalVariables`: Show global variables in the Debug view (default: `false`).
+    *   `substitutePath`: Path mappings to apply to get from a path in the editor to a path in the compiled program (default: `[]`).
+
+⚠️ Where is the `dlvLoadConfig` setting? Delve debugger imposes variable loading limits to avoid loading too many variables at once and negatively impacting debugging latency. The legacy adapter supported `dlvLoadConfig` to adjust these limits for the duration of the session. The user therefore had to come up with a one-size-fits-all limit if the default behavior was not satisfactory. `dlv-dap` mode uses a different approach as described in [the Data Inspection section](#data-inspection). If this setting is configured and `dlv-dap` mode is used, the extension will show a warning prompt now. If the current variable loading behavior and internal limits are not working for you, please open an issue and share your feedback.
+
+<p align="center"><img src="images/dlv-load-config-warning.png" alt="dlvLoadConfig is invalid" width="50%"> </p>
+
+## Advanced Topics
+
+
+### Go Debug Extension Architecture Overview
+
+VS Code implements a generic, language-agnostic debugger UI based on [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/) (DAP), an abstract protocol for communicating with debugger backend. Previously, the Go extension used an intermediary typescript program (legacy debug adapter) to launch Delve and adapt Delve to DAP. With [the new, native DAP implementation in Delve](https://github.com/go-delve/delve/tree/master/service/dap), the intermediary program is no longer necessary, and efficient and tight integration with Delve becomes possible.
+
+<p align="center"><img src="images/vscode-go-debug-arch.png" alt="vscode-go debug architecture"> </p>
+
+For information on debugging using the legacy debug adapter, please see the old [Debugging Documentation](https://github.com/golang/vscode-go/blob/master/docs/debugging.md). Note that many new or enhanced features discussed in this document may not be available with the legacy debug adapter.
+
+### Manually installing `dlv-dap`
+
+On rare occasions, you may want to install `dlv-dap` by yourself instead of letting the extension handle its installation.
+
+First, find where the Go extension finds tools. Like [other tools the extension uses](https://github.com/golang/vscode-go/blob/master/docs/tools.md#tools), the Go extension searches the `dlv-dap` executable from `${GOPATH}/bin`, `${GOBIN}` and `${PATH}`  (or `Path` in Windows). So, install `dlv-dap` in the directory. The easiest way to check the tool installation location the Go extension uses is currently by running the `Go: Locate Configured Go Tools` command from the command palette (⇧+⌘+P or Ctrl+Shift+P).
+
+The following commands download the source of Delve from the master branch, build & store as `dlv-dap` in `~/go/bin/` directory assuming the directory is the place you found from the first step.
+
+If your Go version is 1.16 or newer:
+
+```
+$ GOBIN=/tmp/ go install github.com/go-delve/delve/cmd/dlv@master
+$ mv /tmp/dlv $GOPATH/bin/dlv-dap
+```
+
+If your Go version is older than 1.16:
+
+```
+$ cd $(mktemp -d)
+$ GO111MODULE=on GOBIN=/tmp/ go get github.com/go-delve/delve/cmd/dlv@master
+$ mv /tmp/dlv $GOPATH/bin/dlv-dap
+```
+
+If you want to explicitly specify the location of the delve binary, use the `go.alternateTools` setting:
+```json5
+"go.alternateTools": {
+    "dlv-dap": "<absolute path to your dlv binary>"
+}
+```
+
+### Remote Debugging
+
+
+> If you are able to use the [Remote Development](https://aka.ms/vscode-remote/download/extension) extensions and VS Code’s  universal [remote development capabilities](https://code.visualstudio.com/docs/remote/remote-overview), that is the recommended way to debug Go programs remotely. Check out [Getting started](https://code.visualstudio.com/docs/remote/remote-overview#_getting-started) section and [Remote tutorials](https://code.visualstudio.com/docs/remote/remote-overview#_remote-tutorials) to learn more.
+
+Remote debugging is the debug mode intended to work with a debugger and target running on a different machine or a container. Support for remote debugging using Delve’s native DAP implementation is still a work-in-progress. This section describes a current temporary workaround and its limitations. If the following workaround is not working for your case, please file an issue and help us understand remote debugging use cases better.
+
+<p align="center"><img src="images/remote-debugging.png" alt="Remote Debugging"> </p>
+
+When using the dlv-dap mode, the delve instance running remotely needs to be able to process DAP requests, instead of the traditional JSON-RPC, used with an external `dlv --headless` server. The following command starts a Delve DAP server on port 12345 that is ready to accept a request from an editor such as VS Code for launching or attaching to a target.
+
+```
+$ dlv-dap dap --listen=:12345
+```
+
+Use the following `launch` configuration to tell `dlv-dap` to execute a binary precompiled with `-gcflags='all=-N -l'`:
+
+```json5
+{
+  "name": "Connect to server (DAP)",
+  "type": "go",
+  "debugAdapter": "dlv-dap",
+  "request": "launch",
+  "port": 12345,
+  "host": "127.0.0.1",
+  "mode": "exec",
+  "program": "/absolute/path/to/remote/workspace/program/executable",
+  "substitutePath": [
+      { "from": ${workspaceFolder}, "to": "/path/to/remote/workspace" },
+      ...
+  ]
+}
+```
+
+Or have the binary compiled by dlv-dap by modifying the above configuration to use:
+
+```json5
+  "mode": "debug",
+  "program": "/absolute/path/to/remote/workspace/package",
+```
+
+When seeing the `"port"` attribute being used in the launch request, Go extension will assume a Delve DAP server is started externally and accessible through the specified `host:port` and tell VS Code to connect to it directly. The `program` attribute must point to the absolute path to the package or binary to debug in the remote host’s file system even when `substitutePath` is specified.
+
+⚠️ Limitations
+*   Unlike `dlv <debug|exec|attach> --headless` commands traditionally used for remote debugging scenarios, Delve’s new `dap` sub command does not launch or attach to the debuggee process until it receives a Launch/Attach request. We understand this limitation, and we are currently working on addressing this limitation.
+*   Anyone who can connect to the Delve DAP server’s host:port can exploit it to run arbitrary programs.
+*   When using `"attach"` requests, you will need to specify the `processId` since
+[the processId resolution feature](#attach) cannot gather process information running remotely.
+*   Delve DAP does not support `--allow-multiclient` or `--continue` flags yet, which means after a debug session ends, the dlv-dap process will exit.
+*   If you use `debug` or `test` mode `launch` requests, Delve builds the target binary. Delve tries to build the target from the directory where the `dlv` (or `dlv-dap`) process is running, so make sure to run the `dlv-dap` command from the directory you’d run the `go build` or `go test` command.
+
+### Running Debugee Externally
+
+Sometimes you’d like to launch the program for debugging outside VS Code (e.g., as a workaround of the missing `console` support), there are currently two options.
+
+*   Compile and run the program from the external terminal and use [the "attach" configuration](#attach).
+*   Use ["Remote Debugging"](#remote-debugging); run `dlv-dap dap --listen=:<port>` from the external terminal, and set the `"port"` attribute in your launch configuration.
+
+## Reporting Issues
+
+When you are having issues in `dlv-dap` mode, first check if the problems are reproducible after updating `dlv-dap`. It's possible that the problems are already fixed. Follow the instruction for [updating dlv-dap](#updating-dlv-dap)) and [updating extension](https://code.visualstudio.com/docs/editor/extension-gallery#\_extension-autoupdate).
+
+Please report issues in [our issue tracker](https://github.com/golang/vscode-go/issues) with the following information.
+
+*   `go version`
+*   `go version -m <path/to/dlv-dap>`
+*   VS Code and VS Code Go version (e.g. `code --version`)
+*   Instructions to reproduce the issue (code snippets, your `launch.json`, screenshot)
+*   DAP trace (See [the instruction](#collecting-logs))
+
+### Collecting Logs
+
+```json5
+{
+    "name": "Launch file",
+    "type": "go",
+    "trace": "verbose",
+    "showLog": true,
+    "logOutput": "dap",
+    ...
+}
+```
+
+The `logOutput` and `showLog` attributes in `launch.json` enable Delve-side logging (server-side) and DAP message tracing. The `trace` attribute controls the verbosity of Go extension's side logging (client-side).
+
+The logging will appear in the `Go Debug` output channel (Command Palette -> "View: Toggle Output" -> Select "Go Debug" from the dropdown menu). By nature, debug logs may contain sensitive information. Please review the logs carefully before sharing debug logs.
+
+## Developing
+
+### Code location
+
+The core part of Delve DAP implementation is in the [`service/dap`](https://github.com/go-delve/delve/tree/master/service/dap) package. Follow Delve project's [contribution guideline](https://github.com/go-delve/delve/blob/master/CONTRIBUTING.md#contributing-code) to send PRs.
+
+Code for integration with the Go extension is mostly in [`src/goDebugFactory.ts`](https://github.com/golang/vscode-go/blob/master/src/goDebugFactory.ts) and tests are in [`test/integration/goDebug.test.ts`](https://github.com/golang/vscode-go/blob/master/test/integration/goDebug.test.ts). Please take a look at VS Code Go project's [contribution guideline](https://github.com/golang/vscode-go/blob/master/docs/contributing.md) to learn about how to prepare a change and send it for review.
+
+### Testing
+
+For simple launch cases, build the delve binary, and configure `"go.alternateTools"` setting.
+
+```json5
+"go.alternateTools": {
+    "dlv-dap": <path_to_your_delve>
+}
+```
+
+<p align="center"><img src="images/debug-output.png" alt="Go Debug output channel" width="100%"></p>
+If you are having issues with seeing logs and/or suspect problems in the extension's integration, you can start the Delve DAP server from a separate terminal and configure the extension to directly connect to it. Please remember to file an issue if you encounter any logging-related issues.
+
+```
+$ dlv-dap dap --listen=:12345 --log --log-output=dap
+```
+
+```json5
+{
+    "name": "Launch file",
+    "type": "go",
+    "request": "launch",
+    "debugAdapter": "dlv-dap",
+    ...
+    "port": 12345
+}
+```
 
 [Delve]: https://github.com/go-delve/delve
 [VS Code variables]: https://code.visualstudio.com/docs/editor/variables-reference
diff --git a/docs/dlv-dap.md b/docs/dlv-dap.md
index 9e41344..e2d2667 100644
--- a/docs/dlv-dap.md
+++ b/docs/dlv-dap.md
@@ -1,467 +1,4 @@
-# Debugging using Delve DAP (aka `dlv-dap`)
-
-The Go extension allows you to launch or attach to Go programs for debugging. You can inspect variables and stacks, setting breakpoints, and do other debugging 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. The Go extension has been communicating with Delve through a custom debug adapter program. As the new [`Delve`'s native DAP implementation](https://github.com/go-delve/delve/tree/master/service/dap) becomes available, the Go extension is now transitioning to skip the legacy debug adapter and directly communicate with Delve.
-
-> 📣 We are happy to announce that now this new mode of Delve integration (`dlv-dap` mode) is ready for use in local debugging! We plan to make it default sometime in 2021 H2.
-
-In this document, we assume you are using the new Delve's native debug adapter implementation (`dlv-dap`).
-
-<!-- TOC -->
-
-## **Getting Started**
-
-To opt in to use this new adapter (`dlv-dap`), add the following in your VSCode settings.json.
-
-```
-    "go.delveConfig": {
-        "debugAdapter": "dlv-dap",
-    }
-```
-
-If you want to use `dlv-dap` for only a subset of your launch configurations, you can use [the `debugAdapter` attribute](#launchjson-attributes) to switch between `"dlv-dap"` and `"legacy"` mode. If you are using [the Nightly version of this extension](https://github.com/golang/vscode-go/blob/master/docs/nightly.md#go-nightly), `dlv-dap` is already the default debug adapter for local debugging scenarios, so the above setting is unnecessary.
-
-### Start Debugging
-
-Open a file to debug (either `package main` source file or the test file) in the editor, and select the `Run and Debug` button from [the Run view](https://code.visualstudio.com/docs/editor/debugging#_run-view). Alternatively, you can start debugging using `Start Debugging (F5)` command from [the Run menu](https://code.visualstudio.com/docs/editor/debugging#_run-menu) or from [the Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (Linux/Windows: Ctrl+Shift+P, Mac: ⇧+⌘+P).
-
-When no configuration is configured yet (no `.vscode/launch.json` file), the extension will choose a default configuration based on the file open in the editor.
-
-If you already have launch configurations for the project (`.vscode/launch.json`), the Run view will display the configuration list to choose from.
-
-<p align="center">
-<img src="images/dlvdap-install.gif" alt="Delve DAP Install" width="75%">
-<br/>
-<em>❗ When you start debugging in `dlv-dap` mode for the first time, the extension will ask to install  Delve built from head (`dlv-dap`). Please follow the instructions to install, and then start the debugging session again (i.e. selecting the source file, pressing F5 or click the codelens).</em>
-</p>
-
-<div style="text-align: center;"></div>
-
-Watch ["Go: Writing and debugging fast, reliable, and efficient software"](https://www.youtube.com/watch?v=6r08zGi38Tk&list=PLj6YeMhvp2S40Q-TEPEKOeypLvTVd5uME&index=1) to learn more about debugging features.
-
-Please review [the Features section](#features) that provides an overview of the debug UI and available features.
-
-### Staying Up-To-Date
-
-[Delve’s native DAP implementation](https://github.com/go-delve/delve/tree/master/service/dap) is under active development, so take advantage of the most recent features and bug fixes by using Delve built from its master branch. The Go extension maintains this newest version of Delve separately from the officially released version of `dlv` and installs it with the name `dlv-dap`.
-
-The easiest way to update `dlv-dap` on demand is to use the `"Go: Install/Update Tools"` command from the Command Palette (Linux/Windows: Ctrl+Shift+P, Mac: ⇧+⌘+P). The command will show `dlv-dap` in the tool list. Select `dlv-dap`, and the extension will build the tool at master.
-
-Once `dlv-dap` is installed on your system, the extension will prompt you for update whenever installing a newer version is necessary (usually after the Go extension upgrade). You can set the `go.toolsManagement.autoUpdate` setting so the extension can update `dlv-dap` automatically for you.
-
-If you need to install `dlv-dap` manually outside of VS Code (for example, you are building a dev container with necessary tools preinstalled), please see the [Manual Installation](#bookmark=id.xuaxofprncd5) section.
-
-## Features
-
-For general debugging features such as inspecting variables, setting breakpoints, and other activities that aren't language-dependent, review [VS Code debugging](https://code.visualstudio.com/docs/editor/debugging).
-
-### Configure
-
-When you need more than the default debugging setup, you can create a launch configuration file for the project by clicking the "create a launch.json file" link in [the Run view](https://code.visualstudio.com/docs/editor/debugging#_run-view). Then, choose from the debug configuration drop-down menu. VS Code will create a `launch.json` file in a .vscode folder in your workspace (project root folder) or in your [user settings](https://code.visualstudio.com/docs/editor/debugging#_global-launch-configuration) or [workspace settings](https://code.visualstudio.com/docs/editor/multi-root-workspaces#_workspace-launch-configurations).
-
-If you already have a `launch.json` for your project, you can open it using `Open launch.json`.
-
-To add a new configuration to an existing `launch.json`, choose the "Add Configuration…" button to invoke the snippet IntelliSense.
-
-<p align="center">
-<img src="images/create-launch-json.gif" alt="Create launch.json" width="75%">
-</p>
-
-There are many configuration attributes (see [the Launch.json attributes](#launchjson-attributes) section). IntelliSense in VS Code’s launch.json editor will help you navigate available options and documentation.
-
-### Launch
-
-You can choose "Start Debugging (F5)" and "Run Without Debugging (^F5)" a.k.a the `noDebug` mode. This feature uses a `launch` request type configuration. Its `program` attribute needs to be either the go file or folder of the main package or test file. In this mode, the Go extension will start the debug session by building and launching the program. The launched program will be terminated when the debug session ends.
-
-*   Supported modes
-    *   `debug`: build and debug a main package
-    *   `test`: build and debug a test
-    *   `exec`: debug a precompiled binary. The binary needs to be built with `-gcflags=all="-N -l"` flags to avoid stripping debugging information.
-    *   `auto`: automatically choose between `debug` and `test` depending on the open file.
-
-### Attach
-
-You can debug an already running program using the `attach` request type configuration. With the `attach` request, the Go extension starts `dlv-dap` and configures it to attach to the specified process. Users can select the process to debug with one of the following options:
-
-
-*   Specifying the numeric process id (PID) with the `processId` attribute.
-*   Specifying the target program name in the `processId` attribute. If there are multiple processes matching the specified program name, the extension will show the list of matching processes at the start of the debug session.
-*   Specifying `0` in the `processId` attribute and selecting the process from the drop-down menu at the start of the debug session.
-
-<p align="center">
-<img src="images/attach.gif" alt="Attach to a running process" width="75%">
-</p>
-
-When you end the debug session, the debug UI allows you to choose to either
-
-*   Disconnect: detach and leave the process running. (default)
-*   Terminate: terminate the attached process.
-
-<p align="center">
-<img src="images/attach-terminate.gif" alt="Terminate Debugging started with Attach" style="width: 30%">
-</p>
-
-<!-- TODO:[SupportSuspendDebuggee](https://code.visualstudio.com/updates/v1_56#_disconnect-debugger-and-keep-debuggee-suspended) -->
-
-###  Debug Actions
-
-Once a debug session starts, the Debug toolbar will appear on the top of the editor.
-
-<p align="center">
-<img src="images/debug-toolbar.png" alt="Debug Tool Bar" width="30%">
-</p>
-
-*   Continue / Pause F5
-*   Step Over (aka `next` in Delve) F10
-*   Step Into (aka `step` in Delve) F11
-*   Step Out (aka `stepout` in Delve) Shift+F11 or ⇧F11
-*   Restart (currently this is "Stop + Start")  Ctrl+Shift+F5 or ⇧⌘F5
-*   Stop (terminate the debugee. Available in Launch request)  Shift+F5 or ⇧F5
-*   Disconnect (detach from the debugee. Available only in Attach request) Shift+F5 or ⇧F5
-*   Terminate (terminate the debugee. Available only in Attach request) Alt+Shift+F5 or ⌥⇧F5
-
-### Breakpoints
-
-See [VS Code’s Debug Documentation on Breakpoints](https://code.visualstudio.com/docs/editor/debugging#_breakpoints) to get familiar with VS Code’s UI. The Go debugger supports multiple ways to configure breakpoints.
-
-*   **Breakpoints**: you can set breakpoints by clicking on the editor margin or using F9 on the current line. If the breakpoints can’t be set by Delve, VS Code will show the failure reason and grey out the dot.
-
-<p align="center">
-<img src="images/invalid-breakpoint.png" alt="Invalid breakpoint" width="75%">
-</p>
-
-*   **Conditional breakpoints**: you can specify breakpoint conditions (similar to Delve’s [`condition` command](https://github.com/go-delve/delve/tree/master/Documentation/cli#condition)).
-    *   Expression condition: takes a boolean expression.
-    *   Hit count: supports comparison operators (`>`, `>=`, `<`, `<=`, `==`, `!=`) with an integer value. `% n` form means we should stop at the breakpoint when the hitcount is a multiple of `n`.
-
-<p align="center">
-<img src="images/conditional-breakpoint.gif" alt="Conditional Breakpoint" width="50%">
-</p>
-
-*   **Function Breakpoints**: breakpoints can be set based on function names.  Press the + button in the BREAKPOINTS section header and enter the location in the form of `<function>[:<line>]`. This sets the breakpoint in the `line` inside the `function`. The full syntax for `function` is `<package>.(*<receiver type>).<function_name>` as specified in [Delve’s location spec](https://github.com/go-delve/delve/blob/master/Documentation/cli/locspec.md#location-specifiers). Function breakpoints are shown with a red triangle in the BREAKPOINTS section.
-
-<p align="center">
-<img src="images/function-breakpoint.gif" alt="Function breakpoint" width="75%">
-</p>
-
-*   Logpoint (WIP)
-
-### Data Inspection
-
-You can inspect variables in the VARIABLES section of the Run view or by hovering over their source in the editor. Variable values and expression evaluation are relative to the selected stack frame in the CALL section.
-
-By default, the VARIABLES section hides global variables, and shows only local variables and function arguments. However, you can still inspect global variables from the DEBUG CONSOLE panel. If you prefer to have the VARIABLES section show global variables, set the `showGlobalVariables` attribute in the `launch.json` configuration, or set it in the `go.delveConfig` setting.
-
-When you select a variable and right click from the VARIABLES section, the context menu will  present shortcuts to features such as:
-
-*   Set Value: you can set/modify simple string, numeric, pointer values. Using composite literals, or memory allocation is not supported.
-*   Copy Value: this copies the value in clipboard.
-*   Copy as Expression: this is useful when you need to query from the REPL in the DEBUG CONSOLE panel.
-*   Add to Watch: this will automatically add the expression to the WATCH section.
-
-Shadowed variables will be marked with `()`.
-
-<p align="center">
-<img src="images/shadowed-variables.png" alt="Shadowed Variables" style="width: 50%">
-</p>
-
-⚠️ Delve debugger imposes variable loading limits to prevent loading too many variables at once and negatively impacting debugging latency. The `dlv-dap` mode uses a different approach. It takes advantage of the interactive UI features to provide on-demand loading of individual variables, paging of arrays, slices and maps and increased string limits depending on the context. We continue to explore additional interactive features to balance performance and usability of variable loading and look forward to your feedback.
-
-You can inspect variables and evaluate expressions from the DEBUG CONSOLE panel too. Acceptable expressions are either
-
-*   A valid [Delve expression](https://github.com/go-delve/delve/blob/master/Documentation/cli/expr.md), or
-*   `call <function_call_expression>` to call functions.
-
-<p align="center">
-<img src="images/debug-console.png" alt="Debug Console" width="50%">
-</p>
-
-Variables and expressions accepted in DEBUG CONSOLE can be also registered in the Run view’s WATCH section, so they can be evaluated automatically as you debug. The "Add to Watch" feature from the VARIABLES section is convenient when you want to register interesting variables.
-
-⚠️ Function call feature is highly EXPERIMENTAL due to the limitation in Go runtime. Registering function calls in the WATCH section can often be problematic. Pause, stop, and disconnect will not work while a function call is running.
-
-Hover over variables in editors during debugging shows the value of the variable. For this feature, VS Code extracts the variable expression and makes a request to the debugger to evaluate the expression. Delve evaluates the expression relative to the highlighted stack frame chosen in the CALL STACK. By default, that is the current top-most frame.
-
-<p align="center"><img src="images/variable-hover.png" alt="Hover over Variable in Source Code" width="50%">
- </p>
-
-⚠️ Limitation
-
-*   VS Code heuristically determines the variable expression without full understanding of the scope & the currently selected frame. Delve tries to evaluate the provided expression in the selected frame. As a result, hover over variables outside the selected frame’s function may present incorrect information.
-
-### Call Stack
-
-You can inspect all goroutines and their stacks in the CALL STACK section. The CALL STACK section UI allows switching between goroutines or selecting a different stack frame. As a different stack frame or different goroutine is selected, the scope shown in the VARIABLE section will be updated for the newly selected stack frame, and the expressions in the WATCH section will be automatically reevaluated relative to the newly selected stack frame.
-
-<p align="center"><img src="images/callstack-section-annotated.gif" alt="Call Stack Section Overview" width="75%"> </p>
-
-1. Goroutine stacks are annotated with their internal goroutine IDs.
-2. The current goroutine is marked with `*`. If multiple goroutines stop (e.g. hit breakpoints) concurrently, Delve will pick one randomly. There also might not be a current goroutine (e.g. deadlock, pause or internal breakpoint hit by a system thread not running a goroutine).
-3. If you click a goroutine call stack from the CALL STACK section, the goroutine is _selected_.
-4. You can select a frame of the selected goroutine. The VARIABLE and WATCH sections will be updated accordingly and the cursor in the editor will be moved to the corresponding location in the source code.
-5. Runtime stack frames are deemphasized (greyed out or collapsed).
-6. Thread IDs are shown for scheduled goroutines.
-7. Stop reason. It’s possible that there are multiple reasons goroutines were stopped, but currently only one reason is presented.
-8. File name and line number of the frame.
-9. You can trigger a debug action with the selected goroutine. Note: Resuming or stopping only a single goroutine (Go Issue [25578](https://github.com/golang/go/issues/25578), [31132](https://github.com/golang/go/issues/31132)) is currently not supported, so the action will cause all the goroutines to get activated or paused.
-10. Function name of the frame.
-
-When the program stops due to exception, panic, or bad access error, the CALL STACK shows the stop reason and the editor highlights the source location with more details.
-
-<p align="center"><img src="images/panicinfo.png" alt="Panic" width="75%"></p>
-
-## Configuration
-
-### Launch.json Attributes
-
-There are many attributes that you can adjust in the launch and attach debug configuration. The following general attributes are mandatory for all launch configurations.
-
-*   `name`: the name of your configuration as it appears in the drop-down in the Run view.
-*   `type`: the debugging type VS Code uses to decide which debugging extension should be used. Always leave this set to `"go"`.
-*   `request`: `launch` or `attach`.
-
-Here is the list of attributes specific to Go debugging.
-
-<!-- DO NOT EDIT: Auto-generated by go run tools/generate -->
-<!-- SETTINGS BEGIN -->
-| Property | Launch | Attach |
-| --- | --- | --- |
-| `args` | Command line arguments passed to the debugged program.<br/> | <center>_n/a_</center> |
-| `backend` | Backend used by delve. Maps to `dlv`'s `--backend` flag.<br/><p>Allowed Values: `"default"`, `"native"`, `"lldb"`<br/> | <center>_same as Launch_</center>|
-| `buildFlags` | Build flags, to be passed to the Go compiler. Maps to dlv's `--build-flags` flag.<br/>(Default: `""`)<br/> | <center>_n/a_</center> |
-| `cwd` | Workspace relative or absolute path to the working directory of the program being debugged if a non-empty value is specified. The `program` folder is used as the working directory if `cwd` is omitted or empty.<br/>(Default: `""`)<br/> | Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.<br/>(Default: `"${workspaceFolder}"`)<br/> |
-| `debugAdapter` | Select which debug adapter to use with this launch configuration.<br/><p>Allowed Values: `"legacy"`, `"dlv-dap"`<br/>(Default: `legacy`)<br/> | <center>_same as Launch_</center>|
-| `dlvFlags` | Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.<br/> | <center>_same as Launch_</center>|
-| `env` | Environment variables passed to the program.<br/> | <center>_n/a_</center> |
-| `envFile` | Absolute path to a file containing environment variable definitions. Multiple files can be specified by provided an array of absolute paths<br/>(Default: `${workspaceFolder}/.env`)<br/> | <center>_n/a_</center> |
-| `host` | The host name of the machine the delve debugger will be listening on. In `dlv-dap` mode, the extension will look for a delve DAP server running on the specified host:port so users are responsible for starting the server.<br/>(Default: `"127.0.0.1"`)<br/> | <center>_same as Launch_</center>|
-| `logDest` | dlv's `--log-dest` flag. See `dlv log` for details. Number argument is not allowed. Supported only in `dlv-dap` mode, and on Linux and Mac OS.<br/> | dlv's `--log-dest` flag. See `dlv log` for details. Number argument is not allowed. Supported only in `dlv-dap` mode and on Linux and Mac OS.<br/> |
-| `logOutput` | Comma separated list of components that should produce debug output. Maps to dlv's `--log-output` flag. Check `dlv log` for details.<br/><p>Allowed Values: `"debugger"`, `"gdbwire"`, `"lldbout"`, `"debuglineerr"`, `"rpc"`, `"dap"`<br/>(Default: `"debugger"`)<br/> | <center>_same as Launch_</center>|
-| `mode` | One of `auto`, `debug`, `test`, `exec`. In `auto` mode, the extension will choose either `debug` or `test` depending on active editor window.<br/><p>Allowed Values: `"auto"`, `"debug"`, `"test"`, `"exec"`<br/>(Default: `auto`)<br/> | Indicates local or remote debugging. Local maps to the `dlv attach` command, remote maps to `connect`. `remote` is not supported in `dlv-dap` mode currently. Use `host` and `port` instead.<br/><p>Allowed Values: `"local"`, `"remote"`<br/>(Default: `local`)<br/> |
-| `output` | Output path for the binary of the debugee.<br/>(Default: `"debug"`)<br/> | <center>_n/a_</center> |
-| `port` | The port that the delve debugger will be listening on. In `dlv-dap` mode, the extension will look for a delve DAP server running on the specified host:port so users are responsible for starting the server.<br/>(Default: `2345`)<br/> | <center>_same as Launch_</center>|
-| `processId` | <center>_n/a_</center> | <br/><p><b>Option 1:</b> Use process picker to select a process to attach, or Process ID as integer.<br/><p>Allowed Values: `"${command:pickProcess}"`, `"${command:pickGoProcess}"`<br/><br/><p><b>Option 2:</b> Attach to a process by name. If more than one process matches the name, use the process picker to select a process.<br/><br/><p><b>Option 3:</b> The numeric ID of the process to be debugged. If 0, use the process picker to select a process.<br/><br/>(Default: `0`)<br/> |
-| `program` | Path to the program folder (or any go file within that folder) when in `debug` or `test` mode, and to the pre-built binary file to debug in `exec` mode. If it is not an absolute path, the extension interpretes it as a workspace relative path.<br/>(Default: `"${workspaceFolder}"`)<br/> | <center>_n/a_</center> |
-| `remotePath` | <center>_n/a_</center> | (Deprecated) *Use `substitutePath` instead.*<br/>The path to the source code on the remote machine, when the remote path is different from the local machine. If specified, becomes the first entry in substitutePath.<br/>(Default: `""`)<br/> |
-| `showGlobalVariables` | Boolean value to indicate whether global package variables should be shown in the variables pane or not.<br/>(Default: `false`)<br/> | <center>_same as Launch_</center>|
-| `showLog` | Show log output from the delve debugger. Maps to dlv's `--log` flag.<br/>(Default: `false`)<br/> | <center>_same as Launch_</center>|
-| `stackTraceDepth` | Maximum depth of stack trace collected from Delve.<br/>(Default: `50`)<br/> | <center>_same as Launch_</center>|
-| `stopOnEntry` | Automatically stop program after launch.<br/>(Default: `false`)<br/> | Automatically stop program after attach.<br/>(Default: `false`)<br/> |
-| `substitutePath` | An array of mappings from a local path (editor) to the remote path (debugee). This setting is useful when working in a file system with symbolic links, running remote debugging, or debugging an executable compiled externally. The debug adapter will replace the local path with the remote path in all of the calls.<br/><p><br/><ul><li>`"from"`: The absolute local path to be replaced when passing paths to the debugger.<br/>(Default: `""`)<br/></li><li>`"to"`: The absolute remote path to be replaced when passing paths back to the client.<br/>(Default: `""`)<br/></li></ul><br/> | An array of mappings from a local path (editor) to the remote path (debugee). This setting is useful when working in a file system with symbolic links, running remote debugging, or debugging an executable compiled externally. The debug adapter will replace the local path with the remote path in all of the calls.  Overriden by `remotePath`.<br/><p><br/><ul><li>`"from"`: The absolute local path to be replaced when passing paths to the debugger.<br/>(Default: `""`)<br/></li><li>`"to"`: The absolute remote path to be replaced when passing paths back to the client.<br/>(Default: `""`)<br/></li></ul><br/> |
-| `trace` | Various levels of logging shown in the debug console & 'Go Debug' output channel. When using the `legacy` debug adapter, the logs will also be written to a file if it is set to a value other than `error`.<br/><p>Allowed Values: `"verbose"`, `"trace"`, `"log"`, `"info"`, `"warn"`, `"error"`<br/>(Default: `"error"`)<br/> | <center>_same as Launch_</center>|
-<!-- SETTINGS END -->
-
-⚠️ `dlv-dap` needs file or directory values in the launch configuration to be absolute paths. When configuring those values, use [the VS Code variables substitution](https://code.visualstudio.com/docs/editor/variables-reference) - VS Code will resolve the variables inside strings in `launch.json` before passing the configuration to the Go extension and `dlv-dap`. For example, `${workspaceFolder}` will be replaced with the absolute path to the workspace root folder. When appropriate, the Go extension will resolve relative paths or home directory (~) before sending the configuration to `dlv-dap`.
-
-### **Debugging symlink directories**
-
-Since the debugger and go compiler use the actual filenames, extra configuration is required to debug symlinked directories. Use the substitutePath property to tell the `debugAdapter` how to properly translate the paths. For example, if your project lives in `/path/to/actual/helloWorld`, but the project is open in vscode under the linked folder `/path/to/hello`, you can add the following to your config to set breakpoints in the files in `/path/to/hello`:
-
-```
-{
-    "name": "Launch remote",
-    "type": "go",
-    "request": "launch",
-    "mode": "debug",
-    "program": "/path/to/actual/helloWorld",
-    "substitutePath": [
-		{
-			"from": "/path/to/hello",
-			"to": "/path/to/actual/helloWorld",
-		},
-	],
-}
-```
-
-<!--### Options for "Add Configuration"
-
-TODO: clean up the snippets in package.json
-
-TODO: auto-generate from package.json. -->
-
-### Settings
-
-You can adjust the default value of the following configuration properties using `go.delveConfig` settings. These default values are useful when you choose to run a debug session without the launch configuration set in `launch.json`. For example, debug sessions started using the `Debug Test` code lenses use the adjusted values from these settings.
-
-*   [`go.delveConfig`](settings.md#go.delveConfig)
-    *   `debugAdapter`: Controls which debug adapter to use (default: `legacy`). Select ‘dlv-dap’.
-    *   `showGlobalVariables`: Show global variables in the Debug view (default: `false`).
-    *   `substitutePath`: Path mappings to apply to get from a path in the editor to a path in the compiled program (default: `[]`).
-
-⚠️ Where is the `dlvLoadConfig` setting? Delve debugger imposes variable loading limits to avoid loading too many variables at once and negatively impacting debugging latency. The legacy adapter supported `dlvLoadConfig` to adjust these limits for the duration of the session. The user therefore had to come up with a one-size-fits-all limit if the default behavior was not satisfactory. `dlv-dap` mode uses a different approach as described in [the Data Inspection section](#data-inspection). If this setting is configured and `dlv-dap` mode is used, the extension will show a warning prompt now. If the current variable loading behavior and internal limits are not working for you, please open an issue and share your feedback.
-
-<p align="center"><img src="images/dlv-load-config-warning.png" alt="dlvLoadConfig is invalid" width="50%"> </p>
-
-## Advanced Topics
-
-
-### Go Debug Extension Architecture Overview
-
-VS Code implements a generic, language-agnostic debugger UI based on [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/) (DAP), an abstract protocol for communicating with debugger backend. Previously, the Go extension used an intermediary typescript program (legacy debug adapter) to launch Delve and adapt Delve to DAP. With [the new, native DAP implementation in Delve](https://github.com/go-delve/delve/tree/master/service/dap), the intermediary program is no longer necessary, and efficient and tight integration with Delve becomes possible.
-
-<p align="center"><img src="images/vscode-go-debug-arch.png" alt="vscode-go debug architecture"> </p>
-
-For information on debugging using the legacy debug adapter, please see the old [Debugging Documentation](https://github.com/golang/vscode-go/blob/master/docs/debugging.md). Note that many new or enhanced features discussed in this document may not be available with the legacy debug adapter.
-
-### Manually installing `dlv-dap`
-
-On rare occasions, you may want to install `dlv-dap` by yourself instead of letting the extension handle its installation.
-
-First, find where the Go extension finds tools. Like [other tools the extension uses](https://github.com/golang/vscode-go/blob/master/docs/tools.md#tools), the Go extension searches the `dlv-dap` executable from `${GOPATH}/bin`, `${GOBIN}` and `${PATH}`  (or `Path` in Windows). So, install `dlv-dap` in the directory. The easiest way to check the tool installation location the Go extension uses is currently by running the `Go: Locate Configured Go Tools` command from the command palette (⇧+⌘+P or Ctrl+Shift+P).
-
-The following commands download the source of Delve from the master branch, build & store as `dlv-dap` in `~/go/bin/` directory assuming the directory is the place you found from the first step.
-
-If your Go version is 1.16 or newer:
-
-```
-$ GOBIN=/tmp/ go install github.com/go-delve/delve/cmd/dlv@master
-$ mv /tmp/dlv $GOPATH/bin/dlv-dap
-```
-
-If your Go version is older than 1.16:
-
-```
-$ cd $(mktemp -d)
-$ GO111MODULE=on GOBIN=/tmp/ go get github.com/go-delve/delve/cmd/dlv@master
-$ mv /tmp/dlv $GOPATH/bin/dlv-dap
-```
-
-If you want to explicitly specify the location of the delve binary, use the `go.alternateTools` setting:
-```json5
-"go.alternateTools": {
-    "dlv-dap": "<absolute path to your dlv binary>"
-}
-```
-
-### Remote Debugging
-
-
-> If you are able to use the [Remote Development](https://aka.ms/vscode-remote/download/extension) extensions and VS Code’s  universal [remote development capabilities](https://code.visualstudio.com/docs/remote/remote-overview), that is the recommended way to debug Go programs remotely. Check out [Getting started](https://code.visualstudio.com/docs/remote/remote-overview#_getting-started) section and [Remote tutorials](https://code.visualstudio.com/docs/remote/remote-overview#_remote-tutorials) to learn more.
-
-Remote debugging is the debug mode intended to work with a debugger and target running on a different machine or a container. Support for remote debugging using Delve’s native DAP implementation is still a work-in-progress. This section describes a current temporary workaround and its limitations. If the following workaround is not working for your case, please file an issue and help us understand remote debugging use cases better.
-
-<p align="center"><img src="images/remote-debugging.png" alt="Remote Debugging"> </p>
-
-When using the dlv-dap mode, the delve instance running remotely needs to be able to process DAP requests, instead of the traditional JSON-RPC, used with an external `dlv --headless` server. The following command starts a Delve DAP server on port 12345 that is ready to accept a request from an editor such as VS Code for launching or attaching to a target.
-
-```
-$ dlv-dap dap --listen=:12345
-```
-
-Use the following `launch` configuration to tell `dlv-dap` to execute a binary precompiled with `-gcflags='all=-N -l'`:
-
-```json5
-{
-  "name": "Connect to server (DAP)",
-  "type": "go",
-  "debugAdapter": "dlv-dap",
-  "request": "launch",
-  "port": 12345,
-  "host": "127.0.0.1",
-  "mode": "exec",
-  "program": "/absolute/path/to/remote/workspace/program/executable",
-  "substitutePath": [
-      { "from": ${workspaceFolder}, "to": "/path/to/remote/workspace" },
-      ...
-  ]
-}
-```
-
-Or have the binary compiled by dlv-dap by modifying the above configuration to use:
-
-```json5
-  "mode": "debug",
-  "program": "/absolute/path/to/remote/workspace/package",
-```
-
-When seeing the `"port"` attribute being used in the launch request, Go extension will assume a Delve DAP server is started externally and accessible through the specified `host:port` and tell VS Code to connect to it directly. The `program` attribute must point to the absolute path to the package or binary to debug in the remote host’s file system even when `substitutePath` is specified.
-
-⚠️ Limitations
-*   Unlike `dlv <debug|exec|attach> --headless` commands traditionally used for remote debugging scenarios, Delve’s new `dap` sub command does not launch or attach to the debuggee process until it receives a Launch/Attach request. We understand this limitation, and we are currently working on addressing this limitation.
-*   Anyone who can connect to the Delve DAP server’s host:port can exploit it to run arbitrary programs.
-*   When using `"attach"` requests, you will need to specify the `processId` since
-[the processId resolution feature](#attach) cannot gather process information running remotely.
-*   Delve DAP does not support `--allow-multiclient` or `--continue` flags yet, which means after a debug session ends, the dlv-dap process will exit.
-*   If you use `debug` or `test` mode `launch` requests, Delve builds the target binary. Delve tries to build the target from the directory where the `dlv` (or `dlv-dap`) process is running, so make sure to run the `dlv-dap` command from the directory you’d run the `go build` or `go test` command.
-
-### Running Debugee Externally
-
-Sometimes you’d like to launch the program for debugging outside VS Code (e.g., as a workaround of the missing `console` support), there are currently two options.
-
-*   Compile and run the program from the external terminal and use [the "attach" configuration](#attach).
-*   Use ["Remote Debugging"](#remote-debugging); run `dlv-dap dap --listen=:<port>` from the external terminal, and set the `"port"` attribute in your launch configuration.
-
-## Reporting issues
-
-When you are having issues in `dlv-dap` mode, first check if the problems are reproducible after updating `dlv-dap`. It's possible that the problems are already fixed. Follow the instruction for [updating dlv-dap](#updating-dlv-dap)) and [updating extension](https://code.visualstudio.com/docs/editor/extension-gallery#\_extension-autoupdate).
-
-Please report issues in [our issue tracker](https://github.com/golang/vscode-go/issues) with the following information.
-
-*   `go version`
-*   `go version -m <path/to/dlv-dap>`
-*   VS Code and VS Code Go version.
-*   Instructions to reproduce the issue (code snippets, your `launch.json`, screenshot)
-
-## Developing
-
-### Code location
-
-The core part of Delve DAP implementation is in the [`service/dap`](https://github.com/go-delve/delve/tree/master/service/dap) package. Follow Delve project's [contribution guideline](https://github.com/go-delve/delve/blob/master/CONTRIBUTING.md#contributing-code) to send PRs.
-
-Code for integration with the Go extension is mostly in [`src/goDebugFactory.ts`](https://github.com/golang/vscode-go/blob/master/src/goDebugFactory.ts) and tests are in [`test/integration/goDebug.test.ts`](https://github.com/golang/vscode-go/blob/master/test/integration/goDebug.test.ts). Please take a look at VS Code Go project's [contribution guideline](https://github.com/golang/vscode-go/blob/master/docs/contributing.md) to learn about how to prepare a change and send it for review.
-
-### Testing
-
-For simple launch cases, build the delve binary, and configure `"go.alternateTools"` setting.
-
-```json5
-"go.alternateTools": {
-    "dlv-dap": <path_to_your_delve>
-}
-```
-
-Set `logOutput` and `showLog` attributes in `launch.json` to enable Delve-side logging (server-side) and DAP message tracing.
-
-```json5
-{
-    "name": "Launch file",
-    "type": "go",
-    "debugAdapter": "dlv-dap",
-    "showLog": true,
-    "logOutput": "dap",
-    ...
-}
-```
-
-Set `trace` attribute to control the verbosity of Go extension's side logging (client-side).
-
-```json5
-{
-    "name": "Launch file",
-    "type": "go",
-    "debugAdapter": "dlv-dap",
-    "trace": "verbose",
-    ...
-}
-```
-
-The logging will appear in the `Go Debug` output channel (Command Palette -> "View: Toggle Output" -> Select "Go Debug" from the dropdown menu).
-
-<p align="center"><img src="images/debug-output.png" alt="Go Debug output channel" width="100%"></p>
-If you are having issues with seeing logs and/or suspect problems in the extension's integration, you can start the Delve DAP server from a separate terminal and configure the extension to directly connect to it. Please remember to file an issue if you encounter any logging-related issues.
-
-```
-$ dlv-dap dap --listen=:12345 --log --log-output=dap
-```
-
-```json5
-{
-    "name": "Launch file",
-    "type": "go",
-    "request": "launch",
-    "debugAdapter": "dlv-dap",
-    ...
-    "port": 12345
-}
-```
+The new debug adapter integration using Delve's native DAP implementation
+is enabled by default for local debugging. See
+[Debugging Doc](https://github.com/golang/vscode-go/blob/master/docs/debugging.md)
+for more information.
diff --git a/docs/settings.md b/docs/settings.md
index 993bb74..3f9f79a 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -143,7 +143,7 @@
 | Properties | Description |
 | --- | --- |
 | `apiVersion` | Delve Api Version to use. Default value is 2. <br/> Allowed Options: `1`, `2` <br/> Default: `2` |
-| `debugAdapter` | Select which debug adapter to use by default. This is also used for choosing which debug adapter to use when no launch.json is present and with codelenses. <br/> Allowed Options: `legacy`, `dlv-dap` <br/> Default: `"legacy"` |
+| `debugAdapter` | Select which debug adapter to use by default. This is also used for choosing which debug adapter to use when no launch.json is present and with codelenses. <br/> Allowed Options: `legacy`, `dlv-dap` <br/> Default: `"dlv-dap"` |
 | `dlvLoadConfig` | LoadConfig describes to delve, how to load values from target's memory. Ignored by 'dlv-dap'. <br/> Default: ``` { <pre>"followPointers" :	true,<br/>"maxArrayValues" :	64,<br/>"maxStringLen" :	64,<br/>"maxStructFields" :	-1,<br/>"maxVariableRecurse" :	1,</pre>} ``` |
 | `showGlobalVariables` | Boolean value to indicate whether global package variables should be shown in the variables pane or not. <br/> Default: `false` |
 | `substitutePath` | An array of mappings from a local path to the remote path that is used by the debuggee. The debug adapter will replace the local path with the remote path in all of the calls. Overriden by `remotePath` (in attach request). |
diff --git a/package.json b/package.json
index af8d4f9..1b8bfdd 100644
--- a/package.json
+++ b/package.json
@@ -538,7 +538,7 @@
                   "dlv-dap"
                 ],
                 "description": "Select which debug adapter to use with this launch configuration.",
-                "default": "legacy"
+                "default": "dlv-dap"
               },
               "program": {
                 "type": "string",
@@ -749,7 +749,7 @@
                   "dlv-dap"
                 ],
                 "description": "Select which debug adapter to use with this launch configuration.",
-                "default": "legacy"
+                "default": "dlv-dap"
               },
               "processId": {
                 "anyOf": [
@@ -1746,7 +1746,7 @@
                 "dlv-dap"
               ],
               "description": "Select which debug adapter to use by default. This is also used for choosing which debug adapter to use when no launch.json is present and with codelenses.",
-              "default": "legacy"
+              "default": "dlv-dap"
             },
             "substitutePath": {
               "type": "array",
diff --git a/src/goDebugFactory.ts b/src/goDebugFactory.ts
index 142d9ee..0ec2d28 100644
--- a/src/goDebugFactory.ts
+++ b/src/goDebugFactory.ts
@@ -355,7 +355,7 @@
 			`Couldn't find dlv-dap at the Go tools path, ${process.env['GOPATH']}${
 				env['GOPATH'] ? ', ' + env['GOPATH'] : ''
 			} or ${envPath}\n` +
-				'Follow the setup instruction in https://github.com/golang/vscode-go/blob/master/docs/dlv-dap.md#getting-started.\n'
+				'Follow the setup instruction in https://github.com/golang/vscode-go/blob/master/docs/debugging.md#getting-started.\n'
 		);
 		throw new Error('Cannot find Delve debugger (dlv dap)');
 	}
diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index 515ea4a..e27b16b 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -362,8 +362,8 @@
 	let msg = `The "${tool.name}" command is not available.
 Run "go get -v ${getImportPath(tool, goVersion)}" to install.`;
 	if (tool.name === 'dlv-dap') {
-		msg = `The ["${tool.name}"](https://github.com/golang/vscode-go/blob/master/docs/dlv-dap.md) command is not available.
-Please select "Install", or follow the installation instructions [here](https://github.com/golang/vscode-go/blob/master/docs/dlv-dap.md#updating-dlv-dap).`;
+		msg = `The ["${tool.name}"](https://github.com/golang/vscode-go/blob/master/docs/debugging.md) command is not available.
+Please select "Install", or follow the installation instructions [here](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#updating-dlv-dap).`;
 	}
 
 	const selected = await vscode.window.showErrorMessage(msg, ...installOptions);
diff --git a/tools/generate.go b/tools/generate.go
index fab1c52..4f0948e 100644
--- a/tools/generate.go
+++ b/tools/generate.go
@@ -220,7 +220,7 @@
 
 	b.Reset()
 	generateDebugConfigTable(b, pkgJSON)
-	rewriteDebugDoc(filepath.Join(dir, "docs", "dlv-dap.md"), b.Bytes())
+	rewriteDebugDoc(filepath.Join(dir, "docs", "debugging.md"), b.Bytes())
 
 	// Only update the latest tool versions if the flag is set.
 	if !*updateLatestToolVersionsFlag {