@@ -11,7 +11,7 @@ import { IDebugService, State, IStackFrame, IDebugSession, IThread, CONTEXT_CALL
1111import { Thread , StackFrame , ThreadAndSessionIds } from 'vs/workbench/contrib/debug/common/debugModel' ;
1212import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
1313import { 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' ;
1515import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
1616import { renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView' ;
1717import { IAction , Action } from 'vs/base/common/actions' ;
@@ -21,7 +21,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
2121import { ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer' ;
2222import { ILabelService } from 'vs/platform/label/common/label' ;
2323import { 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' ;
2525import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list' ;
2626import { ITreeRenderer , ITreeNode , ITreeContextMenuEvent , IAsyncDataSource } from 'vs/base/browser/ui/tree/tree' ;
2727import { TreeResourceNavigator , WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService' ;
@@ -40,6 +40,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
4040import { IOpenerService } from 'vs/platform/opener/common/opener' ;
4141import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
4242import { attachStylerCallback } from 'vs/platform/theme/common/styler' ;
43+ import { INotificationService } from 'vs/platform/notification/common/notification' ;
4344
4445const $ = 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 => / ^ i n l i n e / . 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 => / ^ i n l i n e / . test ( g ) ) ) ;
472485
486+ data . actionBar . clear ( ) ;
473487 data . actionBar . push ( primary , { icon : true , label : false } ) ;
474488 } ;
475489 setActionBar ( ) ;
0 commit comments