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

Commit

Permalink
Add auto test debug mode for launch.json (#1780) (#1832)
Browse files Browse the repository at this point in the history
* Add auto `test` debug mode for launch.json(#1780)

check filename to get debug mode

* Remove redundant `else` and add check for null activeEditor
  • Loading branch information
prism4time authored and ramya-rao-a committed Aug 10, 2018
1 parent 69ffb74 commit 9cc625e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/goDebugConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
}

public resolveDebugConfiguration?(folder: vscode.WorkspaceFolder | undefined, debugConfiguration: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.DebugConfiguration {
const activeEditor = vscode.window.activeTextEditor;
if (!debugConfiguration || !debugConfiguration.request) { // if 'request' is missing interpret this as a missing launch.json
let activeEditor = vscode.window.activeTextEditor;
if (!activeEditor || activeEditor.document.languageId !== 'go') {
return;
}
Expand Down Expand Up @@ -54,6 +54,10 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
debugConfiguration['dlvLoadConfig'] = dlvConfig['dlvLoadConfig'];
}

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

return debugConfiguration;
}

Expand Down

0 comments on commit 9cc625e

Please sign in to comment.