You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/goDebugConfiguration: use fileWorkspaceFolder in multi root workspace
In multi folder workspaces, it is not allowed to use `${workspaceFolder}`.
If we detect that it is a multi folder workspace, we instead use
`${fileWorkspaceFolder}` which will get the folder of the current open
file.
Fixes#1499
Change-Id: Ibbe6e869cb0e5093c1bcd9f55d8f7057bceeed9f
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/319809
Trust: Suzy Mueller <[email protected]>
Run-TryBot: Suzy Mueller <[email protected]>
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
*`showGlobalVariables`: Show global variables in the Debug view (default: `false`).
72
73
*`debugAdapter`: Controls which debug adapter to use (default: `legacy`).
73
74
*`substitutePath`: Path mappings to apply to get from a path in the editor to a path in the compiled program (default: `[]`).
74
75
@@ -117,7 +118,7 @@ buildFlags | Build flags to pass to the Go compiler. This corresponds to `dlv`'s
117
118
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.
118
119
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.
119
120
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.
120
-
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. 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.
121
+
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.
121
122
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.
@@ -162,7 +163,8 @@ Note that it is not recommended to debug optimized executables as Delve may not
162
163
163
164
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:
164
165
165
-
*`${workspaceFolder}` refers to the root of the workspace opened in VS Code.
166
+
*`${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}`
167
+
*`${fileWorkspaceFolder}` refers to the the current opened file's workspace folder.
166
168
*`${file}` refers to the currently opened file.
167
169
*`${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.
0 commit comments