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

Commit

Permalink
When a file but no folder is open, no launch.json, debug should work
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed May 2, 2017
1 parent 037b004 commit 42646af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,17 @@ export function activate(ctx: vscode.ExtensionContext): void {
}));

ctx.subscriptions.push(vscode.commands.registerCommand('go.debug.startSession', config => {
let activeEditor = vscode.window.activeTextEditor;
if (!activeEditor || activeEditor.document.languageId !== 'go') {
return;
}
if (!config.request) { // if 'request' is missing interpret this as a missing launch.json
config = Object.assign(config, {
'name': 'Launch',
'type': 'go',
'request': 'launch',
'mode': 'debug',
'program': '${file}',
'program': activeEditor.document.fileName,
'env': {
'GOPATH': process.env['GOPATH']
}
Expand Down

0 comments on commit 42646af

Please # to comment.