@@ -34,6 +34,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
3434import { IThemeService } from 'vs/platform/theme/common/themeService' ;
3535import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
3636import { withUndefinedAsNull } from 'vs/base/common/types' ;
37+ import { IMenuService , IMenu , MenuId } from 'vs/platform/actions/common/actions' ;
38+ import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem' ;
3739
3840const $ = dom . $ ;
3941let forgetScopes = true ;
@@ -47,6 +49,7 @@ export class VariablesView extends ViewPane {
4749 private tree ! : WorkbenchAsyncDataTree < IStackFrame | null , IExpression | IScope , FuzzyScore > ;
4850 private savedViewState = new Map < string , IAsyncDataTreeViewState > ( ) ;
4951 private autoExpandedScopes = new Set < string > ( ) ;
52+ private menu : IMenu ;
5053
5154 constructor (
5255 options : IViewletViewOptions ,
@@ -61,9 +64,13 @@ export class VariablesView extends ViewPane {
6164 @IOpenerService openerService : IOpenerService ,
6265 @IThemeService themeService : IThemeService ,
6366 @ITelemetryService telemetryService : ITelemetryService ,
67+ @IMenuService menuService : IMenuService
6468 ) {
6569 super ( options , keybindingService , contextMenuService , configurationService , contextKeyService , viewDescriptorService , instantiationService , openerService , themeService , telemetryService ) ;
6670
71+ this . menu = menuService . createMenu ( MenuId . DebugVariablesContext , contextKeyService ) ;
72+ this . _register ( this . menu ) ;
73+
6774 // Use scheduler to prevent unnecessary flashing
6875 this . onFocusStackFrameScheduler = new RunOnceScheduler ( async ( ) => {
6976 const stackFrame = this . debugService . getViewModel ( ) . focusedStackFrame ;
@@ -213,11 +220,17 @@ export class VariablesView extends ViewPane {
213220 }
214221 }
215222
223+ const context = {
224+ container : ( variable . parent as ( Variable | Scope ) ) . toDebugProtocolObject ( ) ,
225+ variable : variable . toDebugProtocolObject ( )
226+ } ;
227+ const actionsDisposable = createAndFillInContextMenuActions ( this . menu , { arg : context , shouldForwardArgs : false } , actions , this . contextMenuService ) ;
228+
216229 this . contextMenuService . showContextMenu ( {
217230 getAnchor : ( ) => e . anchor ,
218231 getActions : ( ) => actions ,
219232 getActionsContext : ( ) => variable ,
220- onHide : ( ) => dispose ( actions )
233+ onHide : ( ) => dispose ( actionsDisposable )
221234 } ) ;
222235 }
223236 }
0 commit comments