debug: fix to prevents multiple debug sessions launching
Fixes golang/vscode-go#109
Clicking 'debug test' twice will launch multiple instances.
Fixed to show an error message if debug session already exists.
Change-Id: I60dbb55511f626b31fff2e2c8849be4ecbb1acfa
GitHub-Last-Rev: 789d36f8df0697f233d810824396ff415e61256d
GitHub-Pull-Request: golang/vscode-go#283
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/240905
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/src/goMain.ts b/src/goMain.ts
index 39ec4a9..16df376 100644
--- a/src/goMain.ts
+++ b/src/goMain.ts
@@ -303,6 +303,10 @@
ctx.subscriptions.push(
vscode.commands.registerCommand('go.debug.cursor', (args) => {
+ if (vscode.debug.activeDebugSession) {
+ vscode.window.showErrorMessage('Debug session has already been started.');
+ return;
+ }
const goConfig = getGoConfig();
testAtCursor(goConfig, 'debug', args);
})