@@ -45,6 +45,7 @@ export class PullRequestsTreeDataProvider extends Disposable implements vscode.T
4545 private _initialized : boolean = false ;
4646 public notificationProvider : NotificationProvider ;
4747 public readonly prsTreeModel : PrsTreeModel ;
48+ private _notificationClearTimeout : NodeJS . Timeout | undefined ;
4849
4950 get view ( ) : vscode . TreeView < TreeNode > {
5051 return this . _view ;
@@ -54,7 +55,7 @@ export class PullRequestsTreeDataProvider extends Disposable implements vscode.T
5455 super ( ) ;
5556 this . prsTreeModel = this . _register ( new PrsTreeModel ( this . _telemetry , this . _reposManager , _context ) ) ;
5657 this . _register ( this . prsTreeModel . onDidChangeData ( folderManager => folderManager ? this . refreshRepo ( folderManager ) : this . refresh ( ) ) ) ;
57- this . _register ( new PRStatusDecorationProvider ( this . prsTreeModel ) ) ;
58+ this . _register ( new PRStatusDecorationProvider ( this . prsTreeModel , this . _copilotStateModel ) ) ;
5859 this . _register ( vscode . commands . registerCommand ( 'pr.refreshList' , _ => {
5960 this . refresh ( undefined , true ) ;
6061 } ) ) ;
@@ -71,12 +72,28 @@ export class PullRequestsTreeDataProvider extends Disposable implements vscode.T
7172
7273 this . _register ( this . _view . onDidChangeVisibility ( e => {
7374 if ( e . visible ) {
74- _copilotStateModel . clearNotifications ( ) ;
75- this . _view . badge = undefined ;
75+ // Clear notifications with a delay of 5 seconds
76+ if ( this . _notificationClearTimeout ) {
77+ clearTimeout ( this . _notificationClearTimeout ) ;
78+ }
79+ this . _notificationClearTimeout = setTimeout ( ( ) => {
80+ _copilotStateModel . clearNotifications ( ) ;
81+ this . _view . badge = undefined ;
82+ this . _notificationClearTimeout = undefined ;
83+ } , 5000 ) ;
7684 }
7785 } ) ) ;
7886
79- this . _register ( _copilotStateModel . onDidChange ( ( ) => {
87+ this . _register ( {
88+ dispose : ( ) => {
89+ if ( this . _notificationClearTimeout ) {
90+ clearTimeout ( this . _notificationClearTimeout ) ;
91+ this . _notificationClearTimeout = undefined ;
92+ }
93+ }
94+ } ) ;
95+
96+ this . _register ( _copilotStateModel . onDidChangeStates ( ( ) => {
8097 if ( _copilotStateModel . notifications . size > 0 ) {
8198 this . _view . badge = {
8299 tooltip : _copilotStateModel . notifications . size === 1 ? vscode . l10n . t ( 'Coding agent has 1 change to view' ) : vscode . l10n . t ( 'Coding agent has {0} changes to view' , _copilotStateModel . notifications . size ) ,
0 commit comments