diff --git a/src/goMain.ts b/src/goMain.ts index 485e536f8..5ae235682 100644 --- a/src/goMain.ts +++ b/src/goMain.ts @@ -57,6 +57,7 @@ import { installCurrentPackage } from './goInstall'; import { setGlobalState } from './stateUtils'; import { ProvideTypeDefinitionSignature } from 'vscode-languageclient/lib/typeDefinition'; import { ProvideImplementationSignature } from 'vscode-languageclient/lib/implementation'; +import { DebugSession } from 'vscode-debugadapter'; export let buildDiagnosticCollection: vscode.DiagnosticCollection; export let lintDiagnosticCollection: vscode.DiagnosticCollection; @@ -627,6 +628,11 @@ function addOnSaveTextDocumentListeners(ctx: vscode.ExtensionContext) { if (document.languageId !== 'go') { return; } + if (vscode.debug.activeDebugSession) { + vscode.window.showWarningMessage('Changes are not allowed while code is running'); + + return; + } if (vscode.window.visibleTextEditors.some(e => e.document.fileName === document.fileName)) { runBuilds(document, vscode.workspace.getConfiguration('go', document.uri)); }