Add debug API for call stack selection changes (63943) (#179132)

* feat: Initial pass at Debug Focus, listener for thread or stack frame
selection (#63943)

Add debug.onDidChangeDebugFocus. May provide ids for session, thread,
and stackFrame, as appropriate.

Fixes: #63943 api should provide thread/stack frame id (paraphrasing)

* chore: small comment tweaks in proposal

* fix: bad copy/paste in proposed. moved types out of 'debug' namespace

* fix: separate 'debugFocus' into thread and stackFrame specific
listeners, and create separate contexts for each

* fix: Revert prev change, switch to single api with union type

This reverts commit c308bc3a90.

* fix: rename accessor from 'focus' to 'stackFrameFocus'

* fix: review comments; remove unused type, imrpove comments

* fixL review comments, type change:  sessionID property cannot be undefined

* Remove comments

---------

Co-authored-by: Rob Lourens <roblourens@gmail.com>
This commit is contained in:
Michael Blout
2023-04-17 18:42:53 +00:00
committed by GitHub
co-authored by Rob Lourens
parent d3d397c7e6
commit 2de3b04eaf
8 changed files with 160 additions and 6 deletions
@@ -8,7 +8,7 @@ import { URI as uri, UriComponents } from 'vs/base/common/uri';
import { IDebugService, IConfig, IDebugConfigurationProvider, IBreakpoint, IFunctionBreakpoint, IBreakpointData, IDebugAdapter, IDebugAdapterDescriptorFactory, IDebugSession, IDebugAdapterFactory, IDataBreakpoint, IDebugSessionOptions, IInstructionBreakpoint, DebugConfigurationProviderTriggerKind } from 'vs/workbench/contrib/debug/common/debug';
import {
ExtHostContext, ExtHostDebugServiceShape, MainThreadDebugServiceShape, DebugSessionUUID, MainContext,
IBreakpointsDeltaDto, ISourceMultiBreakpointDto, ISourceBreakpointDto, IFunctionBreakpointDto, IDebugSessionDto, IDataBreakpointDto, IStartDebuggingOptions, IDebugConfiguration
IBreakpointsDeltaDto, ISourceMultiBreakpointDto, ISourceBreakpointDto, IFunctionBreakpointDto, IDebugSessionDto, IDataBreakpointDto, IStartDebuggingOptions, IDebugConfiguration, IThreadFocusDto, IStackFrameFocusDto
} from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import severity from 'vs/base/common/severity';
@@ -56,6 +56,29 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
this._debugConfigurationProviders = new Map();
this._debugAdapterDescriptorFactories = new Map();
this._sessions = new Set();
this._toDispose.add(this.debugService.getViewModel().onDidFocusThread(({ thread, explicit, session }) => {
if (session) {
const dto: IThreadFocusDto = {
kind: 'thread',
threadId: thread?.threadId,
sessionId: session!.getId(),
};
this._proxy.$acceptStackFrameFocus(dto);
}
}));
this._toDispose.add(this.debugService.getViewModel().onDidFocusStackFrame(({ stackFrame, explicit, session }) => {
if (session) {
const dto: IStackFrameFocusDto = {
kind: 'stackFrame',
threadId: stackFrame?.thread.threadId,
frameId: stackFrame?.frameId,
sessionId: session.getId(),
};
this._proxy.$acceptStackFrameFocus(dto);
}
}));
}
public dispose(): void {