@@ -141,6 +141,10 @@ export class WatchExpressionsView extends ViewletPanel {
141141
142142 private onContextMenu ( e : ITreeContextMenuEvent < IExpression > ) : void {
143143 const element = e . element ;
144+ const anchor = e . anchor ;
145+ if ( ! anchor ) {
146+ return ;
147+ }
144148 const actions : IAction [ ] = [ ] ;
145149
146150 if ( element instanceof Expression ) {
@@ -167,7 +171,7 @@ export class WatchExpressionsView extends ViewletPanel {
167171 }
168172
169173 this . contextMenuService . showContextMenu ( {
170- getAnchor : ( ) => e . anchor ,
174+ getAnchor : ( ) => anchor ,
171175 getActions : ( ) => actions ,
172176 getActionsContext : ( ) => element
173177 } ) ;
@@ -184,11 +188,9 @@ class WatchExpressionsDelegate implements IListVirtualDelegate<IExpression> {
184188 if ( element instanceof Expression ) {
185189 return WatchExpressionsRenderer . ID ;
186190 }
187- if ( element instanceof Variable ) {
188- return VariablesRenderer . ID ;
189- }
190191
191- return undefined ;
192+ // Variable
193+ return VariablesRenderer . ID ;
192194 }
193195}
194196
@@ -198,7 +200,7 @@ function isDebugService(element: any): element is IDebugService {
198200
199201class WatchExpressionsDataSource implements IAsyncDataSource < IDebugService , IExpression > {
200202
201- hasChildren ( element : IExpression | null ) : boolean {
203+ hasChildren ( element : IExpression | IDebugService ) : boolean {
202204 return isDebugService ( element ) || element . hasChildren ;
203205 }
204206
@@ -208,7 +210,7 @@ class WatchExpressionsDataSource implements IAsyncDataSource<IDebugService, IExp
208210 const watchExpressions = debugService . getModel ( ) . getWatchExpressions ( ) ;
209211 const viewModel = debugService . getViewModel ( ) ;
210212 return Promise . all ( watchExpressions . map ( we => ! ! we . name
211- ? we . evaluate ( viewModel . focusedSession , viewModel . focusedStackFrame , 'watch' ) . then ( ( ) => we )
213+ ? we . evaluate ( viewModel . focusedSession ! , viewModel . focusedStackFrame ! , 'watch' ) . then ( ( ) => we )
212214 : Promise . resolve ( we ) ) ) ;
213215 }
214216
@@ -258,11 +260,9 @@ class WatchExpressionsAccessibilityProvider implements IAccessibilityProvider<IE
258260 if ( element instanceof Expression ) {
259261 return nls . localize ( 'watchExpressionAriaLabel' , "{0} value {1}, watch, debug" , ( < Expression > element ) . name , ( < Expression > element ) . value ) ;
260262 }
261- if ( element instanceof Variable ) {
262- return nls . localize ( 'watchVariableAriaLabel' , "{0} value {1}, watch, debug" , ( < Variable > element ) . name , ( < Variable > element ) . value ) ;
263- }
264263
265- return null ;
264+ // Variable
265+ return nls . localize ( 'watchVariableAriaLabel' , "{0} value {1}, watch, debug" , ( < Variable > element ) . name , ( < Variable > element ) . value ) ;
266266 }
267267}
268268
0 commit comments