Don't show "is already running" dialog for debug sessions that weren't launched directly by the user

Fix #131432
This commit is contained in:
Rob Lourens 2021-08-23 14:34:50 -07:00
parent 5e7eb1bbba
commit e4634eaa6b
4 changed files with 7 additions and 6 deletions

View file

@ -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<IDebugConfiguration>('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);
}
});

View file

@ -72,7 +72,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider<IPi
accept: async () => {
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<IPi
try {
const { launch, getConfig } = configManager.selectedConfiguration;
const config = await getConfig();
await this.debugService.startDebugging(launch, config);
await this.debugService.startDebugging(launch, config, { startedByUser: true });
} catch (error) {
this.notificationService.error(error);
}
@ -121,7 +121,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider<IPi
if (pick) {
// Use the type of the provider, not of the config since config sometimes have subtypes (for example "node-terminal")
await configManager.selectConfiguration(pick.launch, pick.config.name, pick.config, { type: provider.type });
this.debugService.startDebugging(pick.launch, pick.config);
this.debugService.startDebugging(pick.launch, pick.config, { startedByUser: true });
}
}
});

View file

@ -526,7 +526,7 @@ export class DebugService implements IDebugService {
private async doCreateSession(sessionId: string, root: IWorkspaceFolder | undefined, configuration: { resolved: IConfig, unresolved: IConfig | undefined }, options?: IDebugSessionOptions): Promise<boolean> {
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) {

View file

@ -191,6 +191,7 @@ export interface IDebugSessionOptions {
debugUI?: {
simple?: boolean;
};
startedByUser?: boolean;
}
export interface IDataBreakpointInfoResponse {