diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 7015e3d1d5e798d7d0acb7c8114885d63928018d..fe340e53c7f7556efa9502150fec0cbcc7490771 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -852,6 +852,14 @@ declare module 'vscode' { debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult; } + export interface DebugSession { + + /** + * Terminates the session. + */ + terminate(): Thenable; + } + //#endregion //#region LogLevel: https://github.com/microsoft/vscode/issues/85992 diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index 1ddadf87184a0dfea49727db1c80dfe92778ded4..9011d0cf0d7cc4b071abf63263658285c448cec5 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -262,6 +262,14 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb return Promise.reject(new Error('debug session not found')); } + public $terminateDebugSession(sessionId: DebugSessionUUID): Promise { + const session = this.debugService.getModel().getSession(sessionId, true); + if (session) { + return session.terminate(); + } + return Promise.reject(new Error('debug session not found')); + } + public $appendDebugConsole(value: string): void { // Use warning as severity to get the orange color for messages coming from the debug extension const session = this.debugService.getViewModel().focusedSession; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 6d21b5a745deab4ca182b66ce4950d77efb452fd..b320db71bc07fe9049ecd1bc288edfb1abf24e4d 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -873,6 +873,7 @@ export interface MainThreadDebugServiceShape extends IDisposable { $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, options: IStartDebuggingOptions): Promise; $setDebugSessionName(id: DebugSessionUUID, name: string): void; $customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): Promise; + $terminateDebugSession(id: DebugSessionUUID): Promise; $appendDebugConsole(value: string): void; $startBreakpointEvents(): void; $registerBreakpoints(breakpoints: Array): Promise; diff --git a/src/vs/workbench/api/common/extHostDebugService.ts b/src/vs/workbench/api/common/extHostDebugService.ts index 6fc0dc2bdc1c120f2554c0fd0e6a69410613a3e9..167ab16048085b76c1ca04c0ab0db67490e4730a 100644 --- a/src/vs/workbench/api/common/extHostDebugService.ts +++ b/src/vs/workbench/api/common/extHostDebugService.ts @@ -952,6 +952,10 @@ export class ExtHostDebugSession implements vscode.DebugSession { public customRequest(command: string, args: any): Promise { return this._debugServiceProxy.$customDebugAdapterRequest(this._id, command, args); } + + public terminate(): Promise { + return this._debugServiceProxy.$terminateDebugSession(this._id); + } } export class ExtHostDebugConsole implements vscode.DebugConsole {