@@ -8,8 +8,8 @@ import { STATUS_BAR_HOST_NAME_BACKGROUND, STATUS_BAR_HOST_NAME_FOREGROUND } from
8
8
import { themeColorFromId } from 'vs/platform/theme/common/themeService' ;
9
9
import { IRemoteAgentService , remoteConnectionLatencyMeasurer } from 'vs/workbench/services/remote/common/remoteAgentService' ;
10
10
import { RunOnceScheduler , retry } from 'vs/base/common/async' ;
11
- import { Event } from 'vs/base/common/event' ;
12
- import { Disposable , dispose } from 'vs/base/common/lifecycle' ;
11
+ import { Emitter , Event } from 'vs/base/common/event' ;
12
+ import { Disposable } from 'vs/base/common/lifecycle' ;
13
13
import { MenuId , IMenuService , MenuItemAction , MenuRegistry , registerAction2 , Action2 , SubmenuItemAction } from 'vs/platform/actions/common/actions' ;
14
14
import { IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
15
15
import { StatusbarAlignment , IStatusbarService , IStatusbarEntryAccessor , IStatusbarEntry } from 'vs/workbench/services/statusbar/browser/statusbar' ;
@@ -115,6 +115,9 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
115
115
private loggedInvalidGroupNames : { [ group : string ] : boolean } = Object . create ( null ) ;
116
116
private readonly remoteExtensionMetadata : RemoteExtensionMetadata [ ] ;
117
117
private remoteMetadataInitialized : boolean = false ;
118
+ private readonly _onDidChangeEntries = this . _register ( new Emitter < void > ( ) ) ;
119
+ private readonly onDidChangeEntries : Event < void > = this . _onDidChangeEntries . event ;
120
+
118
121
constructor (
119
122
@IStatusbarService private readonly statusbarService : IStatusbarService ,
120
123
@IBrowserWorkbenchEnvironmentService private readonly environmentService : IBrowserWorkbenchEnvironmentService ,
@@ -341,6 +344,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
341
344
}
342
345
343
346
this . remoteMetadataInitialized = true ;
347
+ this . _onDidChangeEntries . fire ( ) ;
344
348
showRemoteStartEntry . bindTo ( this . contextKeyService ) . set ( true ) ;
345
349
this . updateRemoteStatusIndicator ( ) ;
346
350
}
@@ -551,15 +555,8 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
551
555
}
552
556
}
553
557
554
- // Show when there are commands or installable remote extensions.
555
- if ( this . hasRemoteMenuCommands ( true ) || this . remoteExtensionMetadata . some ( ext => ! ext . installed && ext . isPlatformCompatible ) ) {
556
- this . renderRemoteStatusIndicator ( `$(remote)` , nls . localize ( 'noHost.tooltip' , "Open a Remote Window" ) ) ;
557
- return ;
558
- }
559
-
560
- // No Remote Extensions: hide status indicator
561
- dispose ( this . remoteStatusEntry ) ;
562
- this . remoteStatusEntry = undefined ;
558
+ this . renderRemoteStatusIndicator ( `$(remote)` , nls . localize ( 'noHost.tooltip' , "Open a Remote Window" ) ) ;
559
+ return ;
563
560
}
564
561
565
562
private renderRemoteStatusIndicator ( initialText : string , initialTooltip ?: string | MarkdownString , command ?: string , showProgress ?: boolean ) : void {
@@ -573,7 +570,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
573
570
text,
574
571
showProgress,
575
572
tooltip,
576
- command : command ?? ( this . hasRemoteMenuCommands ( false ) || this . remoteExtensionMetadata . some ( ext => ! ext . installed && ext . isPlatformCompatible ) ) ? RemoteStatusIndicator . REMOTE_ACTIONS_COMMAND_ID : undefined
573
+ command : command ?? RemoteStatusIndicator . REMOTE_ACTIONS_COMMAND_ID
577
574
} ;
578
575
579
576
if ( this . remoteStatusEntry ) {
@@ -834,17 +831,15 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
834
831
const itemUpdater = this . remoteIndicatorMenu . onDidChange ( ( ) => quickPick . items = computeItems ( ) ) ;
835
832
quickPick . onDidHide ( itemUpdater . dispose ) ;
836
833
837
- quickPick . show ( ) ;
838
- }
839
-
840
- private hasRemoteMenuCommands ( ignoreInstallAdditional : boolean ) : boolean {
841
- if ( this . remoteAuthority !== undefined || this . virtualWorkspaceLocation !== undefined ) {
842
- if ( RemoteStatusIndicator . SHOW_CLOSE_REMOTE_COMMAND_ID ) {
843
- return true ;
844
- }
845
- } else if ( ! ignoreInstallAdditional && this . extensionGalleryService . isEnabled ( ) ) {
846
- return true ;
834
+ if ( ! this . remoteMetadataInitialized ) {
835
+ quickPick . busy = true ;
836
+ this . _register ( this . onDidChangeEntries ( ( ) => {
837
+ // If quick pick is open, update the quick pick items after initialization.
838
+ quickPick . busy = false ;
839
+ quickPick . items = computeItems ( ) ;
840
+ } ) ) ;
847
841
}
848
- return this . getRemoteMenuActions ( ) . length > 0 ;
842
+
843
+ quickPick . show ( ) ;
849
844
}
850
845
}
0 commit comments