diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index 1b0e0389246b1..a9ee9c85cfbf8 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -232,10 +232,10 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb compact: options.compact, debugUI: options.debugUI, compoundRoot: parentSession?.compoundRoot, - saveBeforeStart: saveBeforeStart + saveBeforeRestart: saveBeforeStart }; try { - return this.debugService.startDebugging(launch, nameOrConfig, debugOptions); + return this.debugService.startDebugging(launch, nameOrConfig, debugOptions, saveBeforeStart); } catch (err) { throw new ErrorNoTelemetry(err && err.message ? err.message : 'cannot start debugging'); } diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index 425e5c70f68b7..f04f2889942e2 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -731,7 +731,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const { 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, startedByUser: true, saveBeforeStart: false }); + await debugService.startDebugging(launch, configOrName, { noDebug: debugStartOptions?.noDebug, startedByUser: true }, false); } }); diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 0cf0497bec287..5d6622a3b7f67 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -310,10 +310,7 @@ export class DebugService implements IDebugService { * main entry point * properly manages compounds, checks for errors and handles the initializing state. */ - async startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions): Promise { - - const saveBeforeStart = options?.saveBeforeStart ?? !options?.parentSession; - + async startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions, saveBeforeStart = !options?.parentSession): Promise { const message = options && options.noDebug ? nls.localize('runTrust', "Running executes build tasks and program code from your workspace.") : nls.localize('debugTrust', "Debugging executes build tasks and program code from your workspace."); const trust = await this.workspaceTrustRequestService.requestWorkspaceTrust({ message }); if (!trust) { @@ -702,7 +699,7 @@ export class DebugService implements IDebugService { } async restartSession(session: IDebugSession, restartData?: any): Promise { - if (session.saveBeforeStart) { + if (session.saveBeforeRestart) { await saveAllBeforeDebugStart(this.configurationService, this.editorService); } diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index 99db6b2a7a16a..2dd3ebf02411d 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -164,8 +164,8 @@ export class DebugSession implements IDebugSession { return !!this._options.compact; } - get saveBeforeStart(): boolean { - return this._options.saveBeforeStart ?? !this._options?.parentSession; + get saveBeforeRestart(): boolean { + return this._options.saveBeforeRestart ?? !this._options?.parentSession; } get compoundRoot(): DebugCompoundRoot | undefined { diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 027588ad5291b..ec6bb1652aea6 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -206,7 +206,7 @@ export interface IDebugSessionOptions { simple?: boolean; }; startedByUser?: boolean; - saveBeforeStart?: boolean; + saveBeforeRestart?: boolean; } export interface IDataBreakpointInfoResponse { @@ -297,7 +297,7 @@ export interface IDebugSession extends ITreeElement { readonly subId: string | undefined; readonly compact: boolean; readonly compoundRoot: DebugCompoundRoot | undefined; - readonly saveBeforeStart: boolean; + readonly saveBeforeRestart: boolean; readonly name: string; readonly isSimpleUI: boolean; readonly autoExpandLazyVariables: boolean; @@ -1091,7 +1091,7 @@ export interface IDebugService { * Returns true if the start debugging was successful. For compound launches, all configurations have to start successfully for it to return success. * On errors the startDebugging will throw an error, however some error and cancelations are handled and in that case will simply return false. */ - startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions): Promise; + startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions, saveBeforeStart?: boolean): Promise; /** * Restarts a session or creates a new one if there is no active session. diff --git a/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts b/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts index 1596e346e3173..44eff810343f8 100644 --- a/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts +++ b/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts @@ -190,7 +190,7 @@ export class MockSession implements IDebugSession { return undefined; } - get saveBeforeStart(): boolean { + get saveBeforeRestart(): boolean { return true; }