Skip to content

Commit 616882b

Browse files
committed
CallStack: We need the MenuEntryActionViewItem so the icon would get rendere
fixes microsoft#95887
1 parent 99aae3f commit 616882b

2 files changed

Lines changed: 26 additions & 10 deletions

File tree

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

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { IDebugService, State, IStackFrame, IDebugSession, IThread, CONTEXT_CALL
1111
import { Thread, StackFrame, ThreadAndSessionIds } from 'vs/workbench/contrib/debug/common/debugModel';
1212
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
1313
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
14-
import { MenuId, IMenu, IMenuService } from 'vs/platform/actions/common/actions';
14+
import { MenuId, IMenu, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
1515
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1616
import { renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView';
1717
import { IAction, Action } from 'vs/base/common/actions';
@@ -21,7 +21,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
2121
import { ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
2222
import { ILabelService } from 'vs/platform/label/common/label';
2323
import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
24-
import { createAndFillInContextMenuActions, createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
24+
import { createAndFillInContextMenuActions, createAndFillInActionBarActions, MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
2525
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
2626
import { ITreeRenderer, ITreeNode, ITreeContextMenuEvent, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree';
2727
import { TreeResourceNavigator, WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
@@ -40,6 +40,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
4040
import { IOpenerService } from 'vs/platform/opener/common/opener';
4141
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
4242
import { attachStylerCallback } from 'vs/platform/theme/common/styler';
43+
import { INotificationService } from 'vs/platform/notification/common/notification';
4344

4445
const $ = dom.$;
4546

@@ -171,8 +172,9 @@ export class CallStackView extends ViewPane {
171172
const treeContainer = renderViewTree(container);
172173

173174
this.dataSource = new CallStackDataSource(this.debugService);
175+
const sessionsRenderer = this.instantiationService.createInstance(SessionsRenderer, this.menu);
174176
this.tree = <WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>>this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'CallStackView', treeContainer, new CallStackDelegate(), [
175-
new SessionsRenderer(this.menu, this.instantiationService, this.debugService),
177+
sessionsRenderer,
176178
new ThreadsRenderer(this.instantiationService),
177179
this.instantiationService.createInstance(StackFramesRenderer),
178180
new ErrorsRenderer(),
@@ -382,7 +384,7 @@ export class CallStackView extends ViewPane {
382384
const primary: IAction[] = [];
383385
const secondary: IAction[] = [];
384386
const result = { primary, secondary };
385-
const actionsDisposable = createAndFillInContextMenuActions(this.menu, { arg: getContextForContributedActions(element), shouldForwardArgs: true }, result, this.contextMenuService, g => g === 'inline');
387+
const actionsDisposable = createAndFillInContextMenuActions(this.menu, { arg: getContextForContributedActions(element), shouldForwardArgs: true }, result, this.contextMenuService, g => /^inline/.test(g));
386388

387389
this.contextMenuService.showContextMenu({
388390
getAnchor: () => e.anchor,
@@ -435,8 +437,11 @@ class SessionsRenderer implements ITreeRenderer<IDebugSession, FuzzyScore, ISess
435437

436438
constructor(
437439
private menu: IMenu,
438-
private readonly instantiationService: IInstantiationService,
439-
private readonly debugService: IDebugService
440+
@IInstantiationService private readonly instantiationService: IInstantiationService,
441+
@IDebugService private readonly debugService: IDebugService,
442+
@IKeybindingService private readonly keybindingService: IKeybindingService,
443+
@INotificationService private readonly notificationService: INotificationService,
444+
@IContextMenuService private readonly contextMenuService: IContextMenuService
440445
) { }
441446

442447
get templateId(): string {
@@ -450,7 +455,16 @@ class SessionsRenderer implements ITreeRenderer<IDebugSession, FuzzyScore, ISess
450455
const state = dom.append(session, $('.state'));
451456
const stateLabel = dom.append(state, $('span.label'));
452457
const label = new HighlightedLabel(name, false);
453-
const actionBar = new ActionBar(session);
458+
const actionBar = new ActionBar(session, {
459+
actionViewItemProvider: action => {
460+
if (action instanceof MenuItemAction) {
461+
// We need the MenuEntryActionViewItem so the icon would get rendered
462+
return new MenuEntryActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
463+
}
464+
465+
return undefined;
466+
}
467+
});
454468

455469
return { session, name, state, stateLabel, label, actionBar, elementDisposable: [] };
456470
}
@@ -462,14 +476,14 @@ class SessionsRenderer implements ITreeRenderer<IDebugSession, FuzzyScore, ISess
462476
const thread = session.getAllThreads().filter(t => t.stopped).pop();
463477

464478
const setActionBar = () => {
465-
data.actionBar.clear();
466479
const actions = getActions(this.instantiationService, element.element);
467480

468481
const primary: IAction[] = actions;
469482
const secondary: IAction[] = [];
470483
const result = { primary, secondary };
471-
data.elementDisposable.push(createAndFillInActionBarActions(this.menu, { arg: getContextForContributedActions(session), shouldForwardArgs: true }, result, g => g === 'inline'));
484+
data.elementDisposable.push(createAndFillInActionBarActions(this.menu, { arg: getContextForContributedActions(session), shouldForwardArgs: true }, result, g => /^inline/.test(g)));
472485

486+
data.actionBar.clear();
473487
data.actionBar.push(primary, { icon: true, label: false });
474488
};
475489
setActionBar();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@
159159
height: 100%;
160160
line-height: 22px;
161161
margin-right: 8px;
162-
vertical-align: text-top;
162+
background-size: 16px;
163+
background-position: center center;
164+
background-repeat: no-repeat;
163165
}
164166

165167
.debug-pane .debug-call-stack .thread > .state > .label,

0 commit comments

Comments
 (0)