Skip to content

Commit

Permalink
Search for dlv in go.toolsGopath too
Browse files Browse the repository at this point in the history
  • Loading branch information
segevfiner committed Nov 8, 2018
1 parent 6fdbf20 commit 510a90d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,11 @@
"maxStructFields": -1
}
},
"dlvToolPath": {
"type": "string",
"description": "Path to dlv tool (Auto detected if not given).",
"default": ""
},
"apiVersion": {
"type": "number",
"enum": [
Expand Down
3 changes: 2 additions & 1 deletion src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
output?: string;
/** Delve LoadConfig parameters **/
dlvLoadConfig?: LoadConfig;
dlvToolPath?: string;
/** Delve Version */
apiVersion: number;
}
Expand Down Expand Up @@ -356,7 +357,7 @@ class Delve {
return;
}

let dlv = getBinPathWithPreferredGopath('dlv', [resolveHomeDir(env['GOPATH']), process.env['GOPATH']]);
let dlv = launchArgs.dlvToolPath || getBinPathWithPreferredGopath('dlv', [resolveHomeDir(env['GOPATH']), process.env['GOPATH']]);

if (!existsSync(dlv)) {
verbose(`Couldn't find dlv at ${process.env['GOPATH']}${env['GOPATH'] ? ', ' + env['GOPATH'] : ''} or ${envPath}`);
Expand Down
8 changes: 6 additions & 2 deletions src/goDebugConfiguration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import vscode = require('vscode');
import { getCurrentGoPath, getToolsEnvVars, sendTelemetryEvent } from './util';
import { getCurrentGoPath, getToolsEnvVars, sendTelemetryEvent, getBinPath } from './util';

export class GoDebugConfigurationProvider implements vscode.DebugConfigurationProvider {

Expand Down Expand Up @@ -78,11 +78,15 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
debugConfiguration['dlvLoadConfig'] = dlvConfig['dlvLoadConfig'];
}

if (!debugConfiguration['dlvToolPath']) {
debugConfiguration['dlvToolPath'] = getBinPath('dlv');
}

if (debugConfiguration['mode'] === 'auto') {
debugConfiguration['mode'] = (activeEditor && activeEditor.document.fileName.endsWith('_test.go')) ? 'test' : 'debug';
}

return debugConfiguration;
}

}
}

0 comments on commit 510a90d

Please # to comment.