Skip to content

Commit

Permalink
package.json: use 'console' enums consistent with other extensions
Browse files Browse the repository at this point in the history
Major language extensions like
vscode-python, vscode-cpptools, vscode-js-debug, vscode-java-debug
all use internalConsole/integratedTerminal/externalTerminal as
accepted values and translate them to RunInTerminal parameters.
Let's follow the convention.

Updates #124

Change-Id: Ie2d3c89487ed05a62d6108e514e985c132140b74
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/374135
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
  • Loading branch information
hyangah committed Jan 5, 2022
1 parent 1fa51bc commit 7abeb7a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Here is the list of attributes specific to Go debugging.
| `asRoot` | (Experimental) Debug with elevated permissions (on Unix). It requires `integrated` or `external` console modes and is ignored in remote debugging.<br/>(Default: `false`)<br/> | (Experimental) Debug with elevated permissions (on Unix). This requires `integrated` or `external` console modes and is ignored in remote debugging.<br/>(Default: `false`)<br/> |
| `backend` | Backend used by delve. Maps to `dlv`'s `--backend` flag.<br/><p>Allowed Values: `"default"`, `"native"`, `"lldb"`, `"rr"`<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> |
| `console` | (Experimental) Where to launch the debugger and the debug target: internal console, integrated terminal, or external terminal. It is ignored in remote debugging.<br/><p>Allowed Values: `"internal"`, `"integrated"`, `"external"`<br/>(Default: `internal`)<br/> | (Experimental) Where to launch the debugger: internal console, integrated terminal, or external terminal. This does not affect tty of the running program. It is ignored in remote debugging.<br/><p>Allowed Values: `"internal"`, `"integrated"`, `"external"`<br/>(Default: `internal`)<br/> |
| `console` | (Experimental) Where to launch the debugger and the debug target: internal console, integrated terminal, or external terminal. It is ignored in remote debugging.<br/><p>Allowed Values: `"internalConsole"`, `"integratedTerminal"`, `"externalTerminal"`<br/>(Default: `internalConsole`)<br/> | (Experimental) Where to launch the debugger: internal console, integrated terminal, or external terminal. This does not affect tty of the running program. It is ignored in remote debugging.<br/><p>Allowed Values: `"internalConsole"`, `"integratedTerminal"`, `"externalTerminal"`<br/>(Default: `internalConsole`)<br/> |
| `coreFilePath` | Path to the core dump file to open. For use on 'core' mode only<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>|
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,12 @@
"description": "Boolean value to indicate whether system goroutines should be hidden from call stack view."
},
"console": {
"default": "internal",
"default": "internalConsole",
"description": "(Experimental) Where to launch the debugger and the debug target: internal console, integrated terminal, or external terminal. It is ignored in remote debugging.",
"enum": [
"internal",
"integrated",
"external"
"internalConsole",
"integratedTerminal",
"externalTerminal"
]
},
"asRoot": {
Expand Down Expand Up @@ -1010,12 +1010,12 @@
"description": "Boolean value to indicate whether system goroutines should be hidden from call stack view."
},
"console": {
"default": "internal",
"default": "internalConsole",
"description": "(Experimental) Where to launch the debugger: internal console, integrated terminal, or external terminal. This does not affect tty of the running program. It is ignored in remote debugging.",
"enum": [
"internal",
"integrated",
"external"
"internalConsole",
"integratedTerminal",
"externalTerminal"
]
},
"asRoot": {
Expand Down
6 changes: 3 additions & 3 deletions src/goDebugFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class DelveDAPOutputAdapter extends ProxyDebugAdapter {

if (
!dlvExternallyLaunched &&
(configuration.console === 'integrated' || configuration.console === 'external')
(configuration.console === 'integratedTerminal' || configuration.console === 'externalTerminal')
) {
return this.startDAPServerWithClientAddrFlag(configuration, logErr);
}
Expand Down Expand Up @@ -390,8 +390,8 @@ export class DelveDAPOutputAdapter extends ProxyDebugAdapter {
launchAttachArgs: vscode.DebugConfiguration,
logErr: (msg: string) => void
): Promise<{ dlvDapServer?: ChildProcessWithoutNullStreams; socket: net.Socket }> {
// This is called only when launchAttachArgs.console === 'integrated' | 'external' currently.
const console = (launchAttachArgs as any).console || 'integrated';
// This is called only when launchAttachArgs.console === 'integratedTerminal' | 'externalTerminal' currently.
const console = (launchAttachArgs as any).console === 'externalTerminal' ? 'external' : 'integrated';

const { dlvArgs, dlvPath, dir, env } = getSpawnConfig(launchAttachArgs, logErr);

Expand Down
6 changes: 3 additions & 3 deletions test/integration/goDebug.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean, withConsole?: string) =>
dc = undefined;
const dapLog = fs.readFileSync(DELVE_LOG)?.toString();
const preamble =
debugConfig.console === 'integrated' || debugConfig.console === 'external'
debugConfig.console === 'integratedTerminal' || debugConfig.console === 'externalTerminal'
? 'DAP server for a predetermined client'
: 'DAP server listening at';
assert(
Expand Down Expand Up @@ -2228,9 +2228,9 @@ suite('Go Debug Adapter Tests (dlv-dap)', function () {
testAll(this.ctx, true);
});

suite('Go Debug Adapter Tests (dlv-dap, console=integrated)', function () {
suite('Go Debug Adapter Tests (dlv-dap, console=integratedTerminal)', function () {
this.timeout(60_000);
testAll(this.ctx, true, 'integrated');
testAll(this.ctx, true, 'integratedTerminal');
});

// DelveDAPDebugAdapterOnSocket runs a DelveDAPOutputAdapter
Expand Down

0 comments on commit 7abeb7a

Please sign in to comment.