mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-29 00:46:00 +01:00
fix: debug focus, remove 'kind' discriminators 63943 (#181244)
* fix: review comments, remove 'kind' discrims, use instanceof * fix: tweak the isXXXX checks, add some prop typeof checks * fix: review, remove isX duck type fncs, and construct object
This commit is contained in:
@@ -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
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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<void> {
|
||||
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 = <vscode.ThreadFocus | vscode.StackFrameFocus>focus;
|
||||
this._onDidChangeStackFrameFocus.fire(this._stackFrameFocus);
|
||||
}
|
||||
|
||||
public $provideDebugConfigurations(configProviderHandle: number, folderUri: UriComponents | undefined, token: CancellationToken): Promise<vscode.DebugConfiguration[]> {
|
||||
|
||||
@@ -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;
|
||||
|
||||
+23
-6
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user