diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index 24a2ea496a52628061f28cf62bf3e574f0526552..d1f29cf4eed2a2f522c5fc5d252b58175c4625b9 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -156,7 +156,6 @@ export class StartAction extends AbstractDebugAction { public static isEnabled(debugService: IDebugService, contextService: IWorkspaceContextService, configName: string) { const sessions = debugService.getModel().getSessions(); - const launch = debugService.getConfigurationManager().selectedConfiguration.launch; if (debugService.state === State.Initializing) { return false; @@ -164,13 +163,6 @@ export class StartAction extends AbstractDebugAction { if (contextService && contextService.getWorkbenchState() === WorkbenchState.EMPTY && sessions.length > 0) { return false; } - if (sessions.some(p => p.getName(false) === configName && (!launch || !launch.workspace || !p.raw.root || p.raw.root.uri.toString() === launch.workspace.uri.toString()))) { - return false; - } - const compound = launch && launch.getCompound(configName); - if (compound && compound.configurations && sessions.some(p => compound.configurations.indexOf(p.getName(false)) !== -1)) { - return false; - } return true; } diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 710532a6a5c5b4601ee5108e40d278f352d374f3..135d6e164a9c2f86bcd7a2bd6774931bbf1c9eb2 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -721,6 +721,15 @@ export class DebugService implements debug.IDebugService { if (typeof configOrName === 'string' && launch) { config = launch.getConfiguration(configOrName); compound = launch.getCompound(configOrName); + + const sessions = this.model.getSessions(); + const alreadyRunningMessage = nls.localize('configurationAlreadyRunning', "There is already a debug configuration \"{0}\" running.", configOrName); + if (sessions.some(p => p.getName(false) === configOrName && (!launch || !launch.workspace || !p.raw.root || p.raw.root.uri.toString() === launch.workspace.uri.toString()))) { + return TPromise.wrapError(new Error(alreadyRunningMessage)); + } + if (compound && compound.configurations && sessions.some(p => compound.configurations.indexOf(p.getName(false)) !== -1)) { + return TPromise.wrapError(new Error(alreadyRunningMessage)); + } } else if (typeof configOrName !== 'string') { config = configOrName; }