debug: treat 'subtle' frames like 'deemphasized' (#209078)

To be closer to DAP

Fixes https://github.com/microsoft/vscode/issues/206801
This commit is contained in:
Connor Peet 2024-03-28 19:48:33 -07:00 committed by GitHub
parent a2acd131e4
commit 72250a8700
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 17 deletions

View file

@ -45,7 +45,7 @@ import { renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView
import { CONTINUE_ID, CONTINUE_LABEL, DISCONNECT_ID, DISCONNECT_LABEL, PAUSE_ID, PAUSE_LABEL, RESTART_LABEL, RESTART_SESSION_ID, STEP_INTO_ID, STEP_INTO_LABEL, STEP_OUT_ID, STEP_OUT_LABEL, STEP_OVER_ID, STEP_OVER_LABEL, STOP_ID, STOP_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands';
import * as icons from 'vs/workbench/contrib/debug/browser/debugIcons';
import { createDisconnectMenuItemAction } from 'vs/workbench/contrib/debug/browser/debugToolBar';
import { CALLSTACK_VIEW_ID, CONTEXT_CALLSTACK_ITEM_STOPPED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_CALLSTACK_SESSION_HAS_ONE_THREAD, CONTEXT_CALLSTACK_SESSION_IS_ATTACH, CONTEXT_DEBUG_STATE, CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, getStateLabel, IDebugModel, IDebugService, IDebugSession, IRawStoppedDetails, IStackFrame, IThread, State } from 'vs/workbench/contrib/debug/common/debug';
import { CALLSTACK_VIEW_ID, CONTEXT_CALLSTACK_ITEM_STOPPED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_CALLSTACK_SESSION_HAS_ONE_THREAD, CONTEXT_CALLSTACK_SESSION_IS_ATTACH, CONTEXT_DEBUG_STATE, CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, getStateLabel, IDebugModel, IDebugService, IDebugSession, IRawStoppedDetails, isFrameDeemphasized, IStackFrame, IThread, State } from 'vs/workbench/contrib/debug/common/debug';
import { StackFrame, Thread, ThreadAndSessionIds } from 'vs/workbench/contrib/debug/common/debugModel';
import { isSessionAttach } from 'vs/workbench/contrib/debug/common/debugUtils';
import { ICustomHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
@ -744,9 +744,8 @@ class StackFramesRenderer implements ICompressibleTreeRenderer<IStackFrame, Fuzz
renderElement(element: ITreeNode<IStackFrame, FuzzyScore>, index: number, data: IStackFrameTemplateData): void {
const stackFrame = element.element;
data.stackFrame.classList.toggle('disabled', !stackFrame.source || !stackFrame.source.available || isDeemphasized(stackFrame));
data.stackFrame.classList.toggle('disabled', !stackFrame.source || !stackFrame.source.available || isFrameDeemphasized(stackFrame));
data.stackFrame.classList.toggle('label', stackFrame.presentationHint === 'label');
data.stackFrame.classList.toggle('subtle', stackFrame.presentationHint === 'subtle');
const hasActions = !!stackFrame.thread.session.capabilities.supportsRestartFrame && stackFrame.presentationHint !== 'label' && stackFrame.presentationHint !== 'subtle' && stackFrame.canRestart;
data.stackFrame.classList.toggle('has-actions', hasActions);
@ -933,10 +932,6 @@ function isDebugSession(obj: any): obj is IDebugSession {
return obj && typeof obj.getAllThreads === 'function';
}
function isDeemphasized(frame: IStackFrame): boolean {
return frame.source.presentationHint === 'deemphasize' || frame.presentationHint === 'deemphasize';
}
class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem> {
deemphasizedStackFramesToShow: IStackFrame[] = [];
@ -984,7 +979,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
// Check if some stack frames should be hidden under a parent element since they are deemphasized
const result: CallStackItem[] = [];
children.forEach((child, index) => {
if (child instanceof StackFrame && child.source && isDeemphasized(child)) {
if (child instanceof StackFrame && child.source && isFrameDeemphasized(child)) {
// Check if the user clicked to show the deemphasized source
if (this.deemphasizedStackFramesToShow.indexOf(child) === -1) {
if (result.length) {
@ -997,7 +992,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
}
const nextChild = index < children.length - 1 ? children[index + 1] : undefined;
if (nextChild instanceof StackFrame && nextChild.source && isDeemphasized(nextChild)) {
if (nextChild instanceof StackFrame && nextChild.source && isFrameDeemphasized(nextChild)) {
// Start collecting stackframes that will be "collapsed"
result.push([child]);
return;

View file

@ -8,7 +8,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { List } from 'vs/base/browser/ui/list/listWidget';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IListService } from 'vs/platform/list/browser/listService';
import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, IDebugConfiguration, CONTEXT_JUMP_TO_CURSOR_SUPPORTED, REPL_VIEW_ID, CONTEXT_DEBUGGERS_AVAILABLE, State, getStateLabel, CONTEXT_BREAKPOINT_INPUT_FOCUSED, CONTEXT_FOCUSED_SESSION_IS_ATTACH, VIEWLET_ID, CONTEXT_DISASSEMBLY_VIEW_FOCUS, CONTEXT_IN_DEBUG_REPL, CONTEXT_STEP_INTO_TARGETS_SUPPORTED } from 'vs/workbench/contrib/debug/common/debug';
import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, IDebugConfiguration, CONTEXT_JUMP_TO_CURSOR_SUPPORTED, REPL_VIEW_ID, CONTEXT_DEBUGGERS_AVAILABLE, State, getStateLabel, CONTEXT_BREAKPOINT_INPUT_FOCUSED, CONTEXT_FOCUSED_SESSION_IS_ATTACH, VIEWLET_ID, CONTEXT_DISASSEMBLY_VIEW_FOCUS, CONTEXT_IN_DEBUG_REPL, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, isFrameDeemphasized } from 'vs/workbench/contrib/debug/common/debug';
import { Expression, Variable, Breakpoint, FunctionBreakpoint, DataBreakpoint, Thread } from 'vs/workbench/contrib/debug/common/debugModel';
import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
@ -291,7 +291,7 @@ function findNextVisibleFrame(down: boolean, callStack: readonly IStackFrame[],
}
currFrame = callStack[index];
if (!(currFrame.source.presentationHint === 'deemphasize' || currFrame.presentationHint === 'deemphasize')) {
if (!isFrameDeemphasized(currFrame)) {
return currFrame;
}
} while (index !== startIndex); // end loop when we've just checked the start index, since that should be the last one checked

View file

@ -29,7 +29,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { ViewContainerLocation } from 'vs/workbench/common/views';
import { RawDebugSession } from 'vs/workbench/contrib/debug/browser/rawDebugSession';
import { AdapterEndEvent, IBreakpoint, IConfig, IDataBreakpoint, IDataBreakpointInfoResponse, IDebugConfiguration, IDebugService, IDebugSession, IDebugSessionOptions, IDebugger, IExceptionBreakpoint, IExceptionInfo, IFunctionBreakpoint, IInstructionBreakpoint, IMemoryRegion, IRawModelUpdate, IRawStoppedDetails, IReplElement, IStackFrame, IThread, LoadedSourceEvent, State, VIEWLET_ID } from 'vs/workbench/contrib/debug/common/debug';
import { AdapterEndEvent, IBreakpoint, IConfig, IDataBreakpoint, IDataBreakpointInfoResponse, IDebugConfiguration, IDebugService, IDebugSession, IDebugSessionOptions, IDebugger, IExceptionBreakpoint, IExceptionInfo, IFunctionBreakpoint, IInstructionBreakpoint, IMemoryRegion, IRawModelUpdate, IRawStoppedDetails, IReplElement, IStackFrame, IThread, LoadedSourceEvent, State, VIEWLET_ID, isFrameDeemphasized } from 'vs/workbench/contrib/debug/common/debug';
import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot';
import { DebugModel, ExpressionContainer, MemoryRegion, Thread } from 'vs/workbench/contrib/debug/common/debugModel';
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
@ -1347,7 +1347,7 @@ export class DebugSession implements IDebugSession, IDisposable {
}
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
if (!focusedStackFrame || !focusedStackFrame.source || focusedStackFrame.source.presentationHint === 'deemphasize' || focusedStackFrame.presentationHint === 'deemphasize') {
if (!focusedStackFrame || !isFrameDeemphasized(focusedStackFrame)) {
// The top stack frame can be deemphesized so try to focus again #68616
focus();
}

View file

@ -174,10 +174,6 @@
min-width: fit-content;
}
.debug-pane .debug-call-stack .stack-frame.subtle {
font-style: italic;
}
.debug-pane .debug-call-stack .stack-frame.label > .file {
display: none;
}

View file

@ -533,6 +533,10 @@ export interface IStackFrame extends ITreeElement {
equals(other: IStackFrame): boolean;
}
export function isFrameDeemphasized(frame: IStackFrame): boolean {
return frame.source.presentationHint === 'deemphasize' || frame.presentationHint === 'deemphasize' || frame.presentationHint === 'subtle';
}
export interface IEnablement extends ITreeElement {
readonly enabled: boolean;
}