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)
Browse files Browse the repository at this point in the history
check filename to get debug mode
  • Loading branch information
prism4time committed Aug 10, 2018
1 parent 69ffb74 commit 39b3d17
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 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,12 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
debugConfiguration['dlvLoadConfig'] = dlvConfig['dlvLoadConfig'];
}

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

return debugConfiguration;
}

Expand Down

0 comments on commit 39b3d17

Please sign in to comment.