Skip to content

Commit 99494a7

Browse files
authored
Show busy indicator in remote menu when initializing. (microsoft#187018)
* Show progress bar in remote indicator when initializing * Remove placeholder change
1 parent 322bc2d commit 99494a7

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

src/vs/workbench/contrib/remote/browser/remoteIndicator.ts

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { STATUS_BAR_HOST_NAME_BACKGROUND, STATUS_BAR_HOST_NAME_FOREGROUND } from
88
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
99
import { IRemoteAgentService, remoteConnectionLatencyMeasurer } from 'vs/workbench/services/remote/common/remoteAgentService';
1010
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';
1313
import { MenuId, IMenuService, MenuItemAction, MenuRegistry, registerAction2, Action2, SubmenuItemAction } from 'vs/platform/actions/common/actions';
1414
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
1515
import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatusbarEntry } from 'vs/workbench/services/statusbar/browser/statusbar';
@@ -115,6 +115,9 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
115115
private loggedInvalidGroupNames: { [group: string]: boolean } = Object.create(null);
116116
private readonly remoteExtensionMetadata: RemoteExtensionMetadata[];
117117
private remoteMetadataInitialized: boolean = false;
118+
private readonly _onDidChangeEntries = this._register(new Emitter<void>());
119+
private readonly onDidChangeEntries: Event<void> = this._onDidChangeEntries.event;
120+
118121
constructor(
119122
@IStatusbarService private readonly statusbarService: IStatusbarService,
120123
@IBrowserWorkbenchEnvironmentService private readonly environmentService: IBrowserWorkbenchEnvironmentService,
@@ -341,6 +344,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
341344
}
342345

343346
this.remoteMetadataInitialized = true;
347+
this._onDidChangeEntries.fire();
344348
showRemoteStartEntry.bindTo(this.contextKeyService).set(true);
345349
this.updateRemoteStatusIndicator();
346350
}
@@ -551,15 +555,8 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
551555
}
552556
}
553557

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;
563560
}
564561

565562
private renderRemoteStatusIndicator(initialText: string, initialTooltip?: string | MarkdownString, command?: string, showProgress?: boolean): void {
@@ -573,7 +570,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
573570
text,
574571
showProgress,
575572
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
577574
};
578575

579576
if (this.remoteStatusEntry) {
@@ -834,17 +831,15 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
834831
const itemUpdater = this.remoteIndicatorMenu.onDidChange(() => quickPick.items = computeItems());
835832
quickPick.onDidHide(itemUpdater.dispose);
836833

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+
}));
847841
}
848-
return this.getRemoteMenuActions().length > 0;
842+
843+
quickPick.show();
849844
}
850845
}

0 commit comments

Comments
 (0)