From e4634eaa6b956f0593ef44c2ce0de317fe380167 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 23 Aug 2021 14:34:50 -0700 Subject: [PATCH] Don't show "is already running" dialog for debug sessions that weren't launched directly by the user Fix #131432 --- src/vs/workbench/contrib/debug/browser/debugCommands.ts | 4 ++-- src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts | 6 +++--- src/vs/workbench/contrib/debug/browser/debugService.ts | 2 +- src/vs/workbench/contrib/debug/common/debug.ts | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index 99f21a5714b..999fa420874 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -244,7 +244,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ if (!session) { const { launch, name } = debugService.getConfigurationManager().selectedConfiguration; - await debugService.startDebugging(launch, name, { noDebug: false }); + await debugService.startDebugging(launch, name, { noDebug: false, startedByUser: true }); } else { const showSubSessions = configurationService.getValue('debug').showSubSessionsInToolBar; // Stop should be sent to the root parent session @@ -426,7 +426,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ let { launch, name, getConfig } = debugService.getConfigurationManager().selectedConfiguration; const config = await getConfig(); const configOrName = config ? Object.assign(deepClone(config), debugStartOptions?.config) : name; - await debugService.startDebugging(launch, configOrName, { noDebug: debugStartOptions?.noDebug }, false); + await debugService.startDebugging(launch, configOrName, { noDebug: debugStartOptions?.noDebug, startedByUser: true }, false); } }); diff --git a/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts b/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts index 49eff773851..7890ffb103b 100644 --- a/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts +++ b/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts @@ -72,7 +72,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider { await configManager.selectConfiguration(config.launch, config.name); try { - await this.debugService.startDebugging(config.launch); + await this.debugService.startDebugging(config.launch, undefined, { startedByUser: true }); } catch (error) { this.notificationService.error(error); } @@ -103,7 +103,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider { const session = this.instantiationService.createInstance(DebugSession, sessionId, configuration, root, this.model, options); - if (this.model.getSessions().some(s => s.getLabel() === session.getLabel())) { + if (options?.startedByUser && this.model.getSessions().some(s => s.getLabel() === session.getLabel())) { // There is already a session with the same name, prompt user #127721 const result = await this.dialogService.confirm({ message: nls.localize('multipleSession', "'{0}' is already running. Do you want to start another instance?", session.getLabel()) }); if (!result.confirmed) { diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index ea4e5c14fc1..c0ab0c93480 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -191,6 +191,7 @@ export interface IDebugSessionOptions { debugUI?: { simple?: boolean; }; + startedByUser?: boolean; } export interface IDataBreakpointInfoResponse {