@@ -630,7 +630,9 @@ export class Remote {
630
630
} ) ,
631
631
) ;
632
632
633
- this . createAgentMetadataStatusBar ( agent , workspaceRestClient , disposables ) ;
633
+ disposables . push (
634
+ ...this . createAgentMetadataStatusBar ( agent , workspaceRestClient ) ,
635
+ ) ;
634
636
635
637
this . storage . output . info ( "Remote setup complete" ) ;
636
638
@@ -982,38 +984,33 @@ export class Remote {
982
984
private createAgentMetadataStatusBar (
983
985
agent : WorkspaceAgent ,
984
986
restClient : Api ,
985
- disposables : vscode . Disposable [ ] ,
986
- ) : void {
987
+ ) : vscode . Disposable [ ] {
987
988
const statusBarItem = vscode . window . createStatusBarItem (
988
989
"agentMetadata" ,
989
990
vscode . StatusBarAlignment . Left ,
990
991
) ;
991
- disposables . push ( statusBarItem ) ;
992
992
993
993
const agentWatcher = createAgentMetadataWatcher ( agent . id , restClient ) ;
994
- disposables . push ( agentWatcher ) ;
995
994
996
- agentWatcher . onChange (
997
- ( ) => {
998
- if ( agentWatcher . error ) {
999
- this . storage . output . warn ( formatMetadataError ( agentWatcher . error ) ) ;
1000
- statusBarItem . hide ( ) ;
1001
- return ;
1002
- }
995
+ const onChangeDisposable = agentWatcher . onChange ( ( ) => {
996
+ if ( agentWatcher . error ) {
997
+ this . storage . output . warn ( formatMetadataError ( agentWatcher . error ) ) ;
998
+ statusBarItem . hide ( ) ;
999
+ return ;
1000
+ }
1003
1001
1004
- if ( agentWatcher . metadata && agentWatcher . metadata . length > 0 ) {
1005
- statusBarItem . text = getEventValue ( agentWatcher . metadata [ 0 ] ) ;
1006
- statusBarItem . tooltip = agentWatcher . metadata
1007
- . map ( ( metadata ) => formatEventLabel ( metadata ) )
1008
- . join ( "\n" ) ;
1009
- statusBarItem . show ( ) ;
1010
- } else {
1011
- statusBarItem . hide ( ) ;
1012
- }
1013
- } ,
1014
- undefined ,
1015
- disposables ,
1016
- ) ;
1002
+ if ( agentWatcher . metadata && agentWatcher . metadata . length > 0 ) {
1003
+ statusBarItem . text = getEventValue ( agentWatcher . metadata [ 0 ] ) ;
1004
+ statusBarItem . tooltip = agentWatcher . metadata
1005
+ . map ( ( metadata ) => formatEventLabel ( metadata ) )
1006
+ . join ( "\n" ) ;
1007
+ statusBarItem . show ( ) ;
1008
+ } else {
1009
+ statusBarItem . hide ( ) ;
1010
+ }
1011
+ } ) ;
1012
+
1013
+ return [ statusBarItem , agentWatcher , onChangeDisposable ] ;
1017
1014
}
1018
1015
1019
1016
// closeRemote ends the current remote session.
0 commit comments