From cdc8e53cf33fc35aef54e4815790eb74c17651bb Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Thu, 2 Sep 2021 10:59:42 -0700 Subject: [PATCH] Add DebugSessionOptions suppressSaveBeforeStart See microsoft/vscode-jupyter#6898 --- src/vs/vscode.proposed.d.ts | 5 +++++ src/vs/workbench/api/browser/mainThreadDebugService.ts | 2 +- src/vs/workbench/api/common/extHost.protocol.ts | 1 + src/vs/workbench/api/common/extHostDebugService.ts | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index bc7ae318265..bec79f9cdef 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -729,6 +729,11 @@ declare module 'vscode' { */ simple?: boolean; } + + /** + * When true, a save will not be triggered for open editors when starting a debug session, regardless of the value of the `debug.saveBeforeStart` setting. + */ + suppressSaveBeforeStart?: boolean; } //#endregion diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index c75431e1e75..649157c0cfe 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -232,7 +232,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb debugUI: options.debugUI, compoundRoot: parentSession?.compoundRoot }; - return this.debugService.startDebugging(launch, nameOrConfig, debugOptions).then(success => { + return this.debugService.startDebugging(launch, nameOrConfig, debugOptions, !options.suppressSaveBeforeStart).then(success => { return success; }, err => { return Promise.reject(new Error(err && err.message ? err.message : 'cannot start debugging')); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 2980fdafaef..69b1018a721 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1114,6 +1114,7 @@ export interface IStartDebuggingOptions { debugUI?: { simple?: boolean; }; + suppressSaveBeforeStart?: boolean; } export interface MainThreadDebugServiceShape extends IDisposable { diff --git a/src/vs/workbench/api/common/extHostDebugService.ts b/src/vs/workbench/api/common/extHostDebugService.ts index e05e8173354..90c30ff8992 100644 --- a/src/vs/workbench/api/common/extHostDebugService.ts +++ b/src/vs/workbench/api/common/extHostDebugService.ts @@ -293,7 +293,8 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E repl: options.consoleMode === DebugConsoleMode.MergeWithParent ? 'mergeWithParent' : 'separate', noDebug: options.noDebug, compact: options.compact, - debugUI: options.debugUI + debugUI: options.debugUI, + suppressSaveBeforeStart: options.suppressSaveBeforeStart }); }