Skip to content

Commit 72250a8

Browse files
authored
debug: treat 'subtle' frames like 'deemphasized' (microsoft#209078)
To be closer to DAP Fixes microsoft#206801
1 parent a2acd13 commit 72250a8

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

src/vs/workbench/contrib/debug/browser/callStackView.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import { renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView
4545
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';
4646
import * as icons from 'vs/workbench/contrib/debug/browser/debugIcons';
4747
import { createDisconnectMenuItemAction } from 'vs/workbench/contrib/debug/browser/debugToolBar';
48-
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';
48+
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';
4949
import { StackFrame, Thread, ThreadAndSessionIds } from 'vs/workbench/contrib/debug/common/debugModel';
5050
import { isSessionAttach } from 'vs/workbench/contrib/debug/common/debugUtils';
5151
import { ICustomHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
@@ -744,9 +744,8 @@ class StackFramesRenderer implements ICompressibleTreeRenderer<IStackFrame, Fuzz
744744

745745
renderElement(element: ITreeNode<IStackFrame, FuzzyScore>, index: number, data: IStackFrameTemplateData): void {
746746
const stackFrame = element.element;
747-
data.stackFrame.classList.toggle('disabled', !stackFrame.source || !stackFrame.source.available || isDeemphasized(stackFrame));
747+
data.stackFrame.classList.toggle('disabled', !stackFrame.source || !stackFrame.source.available || isFrameDeemphasized(stackFrame));
748748
data.stackFrame.classList.toggle('label', stackFrame.presentationHint === 'label');
749-
data.stackFrame.classList.toggle('subtle', stackFrame.presentationHint === 'subtle');
750749
const hasActions = !!stackFrame.thread.session.capabilities.supportsRestartFrame && stackFrame.presentationHint !== 'label' && stackFrame.presentationHint !== 'subtle' && stackFrame.canRestart;
751750
data.stackFrame.classList.toggle('has-actions', hasActions);
752751

@@ -933,10 +932,6 @@ function isDebugSession(obj: any): obj is IDebugSession {
933932
return obj && typeof obj.getAllThreads === 'function';
934933
}
935934

936-
function isDeemphasized(frame: IStackFrame): boolean {
937-
return frame.source.presentationHint === 'deemphasize' || frame.presentationHint === 'deemphasize';
938-
}
939-
940935
class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem> {
941936
deemphasizedStackFramesToShow: IStackFrame[] = [];
942937

@@ -984,7 +979,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
984979
// Check if some stack frames should be hidden under a parent element since they are deemphasized
985980
const result: CallStackItem[] = [];
986981
children.forEach((child, index) => {
987-
if (child instanceof StackFrame && child.source && isDeemphasized(child)) {
982+
if (child instanceof StackFrame && child.source && isFrameDeemphasized(child)) {
988983
// Check if the user clicked to show the deemphasized source
989984
if (this.deemphasizedStackFramesToShow.indexOf(child) === -1) {
990985
if (result.length) {
@@ -997,7 +992,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
997992
}
998993

999994
const nextChild = index < children.length - 1 ? children[index + 1] : undefined;
1000-
if (nextChild instanceof StackFrame && nextChild.source && isDeemphasized(nextChild)) {
995+
if (nextChild instanceof StackFrame && nextChild.source && isFrameDeemphasized(nextChild)) {
1001996
// Start collecting stackframes that will be "collapsed"
1002997
result.push([child]);
1003998
return;

src/vs/workbench/contrib/debug/browser/debugCommands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
88
import { List } from 'vs/base/browser/ui/list/listWidget';
99
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
1010
import { IListService } from 'vs/platform/list/browser/listService';
11-
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';
11+
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';
1212
import { Expression, Variable, Breakpoint, FunctionBreakpoint, DataBreakpoint, Thread } from 'vs/workbench/contrib/debug/common/debugModel';
1313
import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
1414
import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -291,7 +291,7 @@ function findNextVisibleFrame(down: boolean, callStack: readonly IStackFrame[],
291291
}
292292

293293
currFrame = callStack[index];
294-
if (!(currFrame.source.presentationHint === 'deemphasize' || currFrame.presentationHint === 'deemphasize')) {
294+
if (!isFrameDeemphasized(currFrame)) {
295295
return currFrame;
296296
}
297297
} while (index !== startIndex); // end loop when we've just checked the start index, since that should be the last one checked

src/vs/workbench/contrib/debug/browser/debugSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'
2929
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
3030
import { ViewContainerLocation } from 'vs/workbench/common/views';
3131
import { RawDebugSession } from 'vs/workbench/contrib/debug/browser/rawDebugSession';
32-
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';
32+
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';
3333
import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot';
3434
import { DebugModel, ExpressionContainer, MemoryRegion, Thread } from 'vs/workbench/contrib/debug/common/debugModel';
3535
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
@@ -1347,7 +1347,7 @@ export class DebugSession implements IDebugSession, IDisposable {
13471347
}
13481348

13491349
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
1350-
if (!focusedStackFrame || !focusedStackFrame.source || focusedStackFrame.source.presentationHint === 'deemphasize' || focusedStackFrame.presentationHint === 'deemphasize') {
1350+
if (!focusedStackFrame || !isFrameDeemphasized(focusedStackFrame)) {
13511351
// The top stack frame can be deemphesized so try to focus again #68616
13521352
focus();
13531353
}

src/vs/workbench/contrib/debug/browser/media/debugViewlet.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,6 @@
174174
min-width: fit-content;
175175
}
176176

177-
.debug-pane .debug-call-stack .stack-frame.subtle {
178-
font-style: italic;
179-
}
180-
181177
.debug-pane .debug-call-stack .stack-frame.label > .file {
182178
display: none;
183179
}

src/vs/workbench/contrib/debug/common/debug.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ export interface IStackFrame extends ITreeElement {
533533
equals(other: IStackFrame): boolean;
534534
}
535535

536+
export function isFrameDeemphasized(frame: IStackFrame): boolean {
537+
return frame.source.presentationHint === 'deemphasize' || frame.presentationHint === 'deemphasize' || frame.presentationHint === 'subtle';
538+
}
539+
536540
export interface IEnablement extends ITreeElement {
537541
readonly enabled: boolean;
538542
}

0 commit comments

Comments
 (0)