From ed2add34a5cc4d8f7897e9fef3d263bf9b5a671e Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Wed, 22 Feb 2023 06:07:10 +0000 Subject: [PATCH] Only show `Install Additional Remote Extensions` when there are more remote extensions to install (#175072) --- .../contrib/remote/browser/remoteIndicator.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts index 443d634806f..1a0b2feacb9 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts @@ -41,6 +41,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { WorkbenchActionExecutedClassification, WorkbenchActionExecutedEvent } from 'vs/base/common/actions'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; +import { IProductService } from 'vs/platform/product/common/productService'; type ActionGroup = [string, Array]; export class RemoteStatusIndicator extends Disposable implements IWorkbenchContribution { @@ -84,6 +85,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr @ILogService private readonly logService: ILogService, @IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService, @ITelemetryService private readonly telemetryService: ITelemetryService, + @IProductService private readonly productService: IProductService, ) { super(); @@ -464,7 +466,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr } } - if (this.extensionGalleryService.isEnabled()) { + if (this.extensionGalleryService.isEnabled() && this.hasAdditionalRemoteExtensions()) { items.push({ id: RemoteStatusIndicator.INSTALL_REMOTE_EXTENSIONS_ID, label: nls.localize('installRemotes', "Install Additional Remote Extensions..."), @@ -509,6 +511,18 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr quickPick.show(); } + private hasAdditionalRemoteExtensions() { + const extensionTips = { ...this.productService.remoteExtensionTips, ...this.productService.virtualWorkspaceExtensionTips }; + for (const [_, extension] of Object.entries(extensionTips)) { + const { extensionId: recommendedExtensionId } = extension; + // if this recommended extension isn't already installed, return early + if (!this.extensionService.extensions.some((extension) => extension.id?.toLowerCase() === recommendedExtensionId.toLowerCase())) { + return true; + } + } + return false; + } + private hasRemoteMenuCommands(ignoreInstallAdditional: boolean): boolean { if (this.remoteAuthority !== undefined || this.virtualWorkspaceLocation !== undefined) { if (RemoteStatusIndicator.SHOW_CLOSE_REMOTE_COMMAND_ID) {