44 *--------------------------------------------------------------------------------------------*/
55
66import * as vscode from 'vscode' ;
7+ import { commands , contexts } from '../common/executeCommands' ;
78import { Disposable } from '../common/lifecycle' ;
89import { EventType , TimelineEvent } from '../common/timelineEvent' ;
910import { toNotificationUri } from '../common/uri' ;
@@ -172,6 +173,7 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
172173 }
173174
174175 const notifications = Array . from ( this . _notifications . values ( ) ) ;
176+ this . _updateContext ( ) ;
175177 this . _onDidChangeNotifications . fire ( notifications ) ;
176178
177179 return {
@@ -180,6 +182,12 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
180182 } ;
181183 }
182184
185+ private _updateContext ( ) : void {
186+ const notificationCount = this . _notifications . size ;
187+ commands . setContext ( contexts . NOTIFICATION_COUNT , notificationCount === 0 ? - 1 : notificationCount ) ;
188+ }
189+
190+
183191 public getNotification ( key : string ) : NotificationTreeItem | undefined {
184192 return this . _notifications . get ( key ) ;
185193 }
@@ -218,6 +226,7 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
218226
219227 this . _onDidChangeNotifications . fire ( [ notification ] ) ;
220228 this . _notifications . delete ( notificationIdentifier . notificationKey ) ;
229+ this . _updateContext ( ) ;
221230
222231 this . _refresh ( false ) ;
223232 }
@@ -230,6 +239,7 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
230239
231240 this . _onDidChangeNotifications . fire ( [ notification ] ) ;
232241 this . _notifications . delete ( notificationIdentifier . notificationKey ) ;
242+ this . _updateContext ( ) ;
233243
234244 this . _refresh ( false ) ;
235245 }
0 commit comments