Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
renamed attach to local, connect to remote
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT committed Jun 12, 2019
1 parent 21cf2cb commit cfa2eb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@
}
},
{
"label": "Go: Attach to process",
"label": "Go: Attach to local process",
"description": "Attach to an existing process by process ID",
"body": {
"name": "${1:Attach to Process}",
"type": "go",
"request": "attach",
"mode": "attach",
"mode": "local",
"processId": 0
}
},
Expand All @@ -383,7 +383,7 @@
"name": "${1:Connect to server}",
"type": "go",
"request": "attach",
"mode": "connect",
"mode": "remote",
"remotePath": "^\"\\${workspaceFolder}\"",
"port": 2345,
"host": "127.0.0.1"
Expand Down Expand Up @@ -572,11 +572,11 @@
},
"mode": {
"enum": [
"attach",
"connect"
"local",
"remote"
],
"description": "One of 'auto', 'debug', 'remote', 'test', 'exec'.",
"default": "auto"
"description": "Indicates local or remote debugging. Local maps to the dlv 'attach' command, remote maps to 'connect'.",
"default": "local"
},
"stopOnEntry": {
"type": "boolean",
Expand Down
16 changes: 8 additions & 8 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
logOutput?: string;
cwd?: string;
env?: { [key: string]: string; };
mode?: string;
mode?: 'auto' | 'debug' | 'remote' | 'test' | 'exec';
remotePath?: string;
port?: number;
host?: string;
Expand Down Expand Up @@ -240,7 +240,7 @@ interface AttachRequestArguments extends DebugProtocol.AttachRequestArguments {
showLog?: boolean;
logOutput?: string;
cwd?: string;
mode?: string;
mode?: 'local' | 'remote';
remotePath?: string;
port?: number;
host?: string;
Expand Down Expand Up @@ -318,7 +318,7 @@ class Delve {
let dlvCwd = dirname(program);
let serverRunning = false;
const dlvArgs = new Array<string>();
if (mode === 'remote' || mode === 'connect') {
if (mode === 'remote') {
this.debugProcess = null;
serverRunning = true; // assume server is running when in remote mode
connectClient(launchArgs.port, launchArgs.host);
Expand Down Expand Up @@ -560,9 +560,9 @@ class Delve {
* For launch debugging, since the extension starts the delve process, the extension should close it as well.
* To gracefully clean up the assets created by delve, we send the Detach request with kill option set to true.
*
* For attach debugging there are two scenarios; attaching to an existing process by ID or connecting to an
* existing delve server. For debug-attach we start the delve process so will also terminate it however we
* detach from the debugee without killing it. For debug-connect we only detach from delve.
* For attach debugging there are two scenarios; attaching to a local process by ID or connecting to a
* remote delve server. For attach-local we start the delve process so will also terminate it however we
* detach from the debugee without killing it. For attach-remote we only detach from delve.
*
* The only way to detach from delve when it is running a program is to send a Halt request first.
* Since the Halt request might sometimes take too long to complete, we have a timer in place to forcefully kill
Expand Down Expand Up @@ -770,9 +770,9 @@ class GoDebugSession extends LoggingDebugSession {
}

protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
if (args.mode === 'attach' && !args.processId) {
if (args.mode === 'local' && !args.processId) {
this.sendErrorResponse(response, 3000, 'Failed to continue: the processId attribute is missing in the debug configuration in launch.json');
} else if (args.mode === 'connect' && !args.port) {
} else if (args.mode === 'remote' && !args.port) {
this.sendErrorResponse(response, 3000, 'Failed to continue: the port attribute is missing in the debug configuration in launch.json');
}
this.initLaunchAttachRequest(response, args);
Expand Down

0 comments on commit cfa2eb7

Please sign in to comment.