diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 12f3fe83572..b69fb900dd1 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1516,7 +1516,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I EditSessionIdentityMatch: EditSessionIdentityMatch, InteractiveSessionVoteDirection: extHostTypes.InteractiveSessionVoteDirection, InteractiveSessionCopyKind: extHostTypes.InteractiveSessionCopyKind, - InteractiveEditorResponseFeedbackKind: extHostTypes.InteractiveEditorResponseFeedbackKind + InteractiveEditorResponseFeedbackKind: extHostTypes.InteractiveEditorResponseFeedbackKind, + StackFrameFocus: extHostTypes.StackFrameFocus, + ThreadFocus: extHostTypes.ThreadFocus }; }; } diff --git a/src/vs/workbench/api/common/extHostDebugService.ts b/src/vs/workbench/api/common/extHostDebugService.ts index 415df6d572a..6ba0e4f9b30 100644 --- a/src/vs/workbench/api/common/extHostDebugService.ts +++ b/src/vs/workbench/api/common/extHostDebugService.ts @@ -16,7 +16,7 @@ import { DebugSessionUUID, ExtHostDebugServiceShape, IBreakpointsDeltaDto, IThre import { IExtHostEditorTabs } from 'vs/workbench/api/common/extHostEditorTabs'; import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; -import { Breakpoint, DataBreakpoint, DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer, DebugConsoleMode, Disposable, FunctionBreakpoint, Location, Position, setBreakpointId, SourceBreakpoint } from 'vs/workbench/api/common/extHostTypes'; +import { Breakpoint, DataBreakpoint, DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer, DebugConsoleMode, Disposable, FunctionBreakpoint, Location, Position, setBreakpointId, SourceBreakpoint, ThreadFocus, StackFrameFocus } from 'vs/workbench/api/common/extHostTypes'; import { IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace'; import { AbstractDebugAdapter } from 'vs/workbench/contrib/debug/common/abstractDebugAdapter'; import { IAdapterDescriptor, IConfig, IDebugAdapter, IDebugAdapterExecutable, IDebugAdapterNamedPipeServer, IDebugAdapterServer, IDebuggerContribution } from 'vs/workbench/contrib/debug/common/debug'; @@ -601,29 +601,20 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E } public async $acceptStackFrameFocus(focusDto: IThreadFocusDto | IStackFrameFocusDto): Promise { - let focus: vscode.ThreadFocus | vscode.StackFrameFocus; + let focus: ThreadFocus | StackFrameFocus; const session = focusDto.sessionId ? await this.getSession(focusDto.sessionId) : undefined; if (!session) { throw new Error('no DebugSession found for debug focus context'); } if (focusDto.kind === 'thread') { - focus = { - kind: focusDto.kind, - threadId: focusDto.threadId, - session, - }; + focus = new ThreadFocus(session, focusDto.threadId); } else { - focus = { - kind: focusDto.kind, - threadId: focusDto.threadId, - frameId: focusDto.frameId, - session, - }; + focus = new StackFrameFocus(session, focusDto.threadId, focusDto.frameId); } - this._stackFrameFocus = focus; - this._onDidChangeStackFrameFocus.fire(focus); + this._stackFrameFocus = focus; + this._onDidChangeStackFrameFocus.fire(this._stackFrameFocus); } public $provideDebugConfigurations(configProviderHandle: number, folderUri: UriComponents | undefined, token: CancellationToken): Promise { diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 0eb50c6f095..c53fd072ae6 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -2957,6 +2957,24 @@ export class DebugAdapterInlineImplementation implements vscode.DebugAdapterInli } } + +@es5ClassCompat +export class StackFrameFocus { + constructor( + public readonly session: vscode.DebugSession, + readonly threadId?: number, + readonly frameId?: number) { } +} + +@es5ClassCompat +export class ThreadFocus { + constructor( + public readonly session: vscode.DebugSession, + readonly threadId?: number) { } +} + + + @es5ClassCompat export class EvaluatableExpression implements vscode.EvaluatableExpression { readonly range: vscode.Range; diff --git a/src/vscode-dts/vscode.proposed.debugFocus.d.ts b/src/vscode-dts/vscode.proposed.debugFocus.d.ts index b4b267d5402..73abb814bbe 100644 --- a/src/vscode-dts/vscode.proposed.debugFocus.d.ts +++ b/src/vscode-dts/vscode.proposed.debugFocus.d.ts @@ -7,9 +7,17 @@ declare module 'vscode' { // See https://github.com/microsoft/vscode/issues/63943 - export interface ThreadFocus { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: 'thread'; + export class ThreadFocus { + /** + * Create a ThreadFocus + * @param session + * @param threadId + * @param frameId + */ + constructor( + session: DebugSession, + threadId?: number); + /** * Debug session for thread. @@ -22,9 +30,18 @@ declare module 'vscode' { readonly threadId: number | undefined; } - export interface StackFrameFocus { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: 'stackFrame'; + export class StackFrameFocus { + /** + * Create a StackFrameFocus + * @param session + * @param threadId + * @param frameId + */ + constructor( + session: DebugSession, + threadId?: number, + frameId?: number); + /** * Debug session for thread.