return localize('install', "Install"); } <del> protected getInstallOptions(): InstallOptions { return this.options; } } export class InstallAction extends AbstractInstallAction { constructor( options: InstallOptions, @IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService, @IInstantiationService instantiationService: IInstantiationService, @IExtensionService runtimeExtensionService: IExtensionService, @IWorkbenchThemeService workbenchThemeService: IWorkbenchThemeService, @ILabelService labelService: ILabelService, @IDialogService dialogService: IDialogService, @IPreferencesService preferencesService: IPreferencesService, @IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService, @IWorkbenchExtensionManagementService private readonly workbenchExtensionManagementService: IWorkbenchExtensionManagementService, @IUserDataSyncEnablementService protected readonly userDataSyncEnablementService: IUserDataSyncEnablementService, @ITelemetryService telemetryService: ITelemetryService, ) { super(`extensions.install`, options, InstallAction.Class, extensionsWorkbenchService, instantiationService, runtimeExtensionService, workbenchThemeService, labelService, dialogService, preferencesService, telemetryService); this.updateLabel(); this._register(labelService.onDidChangeFormatters(() => this.updateLabel(), this)); this._register(Event.any(userDataSyncEnablementService.onDidChangeEnablement, Event.filter(userDataSyncEnablementService.onDidChangeResourceEnablement, e => e[0] === SyncResource.Extensions))(() => this.update())); } override getLabel(primary?: boolean): string { const baseLabel = super.getLabel(primary); const donotSyncLabel = localize('do no sync', "Do not sync"); const isMachineScoped = this.getInstallOptions().isMachineScoped; // When remote connection exists if (this._manifest && this.extensionManagementServerService.remoteExtensionManagementServer) { const server = this.workbenchExtensionManagementService.getExtensionManagementServerToInstall(this._manifest); if (server === this.extensionManagementServerService.remoteExtensionManagementServer) { const host = this.extensionManagementServerService.remoteExtensionManagementServer.label; return isMachineScoped ? localize({ key: 'install extension in remote and do not sync', comment: [ 'First placeholder is install action label.', 'Second placeholder is the name of the action to install an extension in remote server and do not sync it. Placeholder is for the name of remote server.', 'Third placeholder is do not sync label.', ] }, "{0} in {1} ({2})", baseLabel, host, donotSyncLabel) : localize({ key: 'install extension in remote', comment: [ 'First placeholder is install action label.', 'Second placeholder is the name of the action to install an extension in remote server and do not sync it. Placeholder is for the name of remote server.', ] }, "{0} in {1}", baseLabel, host); } return isMachineScoped ? localize('install extension locally and do not sync', "{0} Locally ({1})", baseLabel, donotSyncLabel) : localize('install extension locally', "{0} Locally", baseLabel); } return isMachineScoped ? `${baseLabel} (${donotSyncLabel})` : baseLabel; } protected override getInstallOptions(): InstallOptions { return { ...super.getInstallOptions(), isMachineScoped: this.userDataSyncEnablementService.isEnabled() && this.userDataSyncEnablementService.isResourceEnabled(SyncResource.Extensions) }; } } export class InstallAndSyncAction extends AbstractInstallAction { constructor( options: InstallOptions, @IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService, @IInstantiationService instantiationService: IInstantiationService, @IExtensionService runtimeExtensionService: IExtensionService, @IWorkbenchThemeService workbenchThemeService: IWorkbenchThemeService, @ILabelService labelService: ILabelService, @IDialogService dialogService: IDialogService, @IPreferencesService preferencesService: IPreferencesService, @IProductService productService: IProductService, @IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService, @ITelemetryService telemetryService: ITelemetryService, ) { super('extensions.installAndSync', options, AbstractInstallAction.Class, extensionsWorkbenchService, instantiationService, runtimeExtensionService, workbenchThemeService, labelService, dialogService, preferencesService, telemetryService); this.tooltip = localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Visual Studio Code or Visual Studio Code - Insiders'] }, "Install this extension in all your synced {0} instances", productService.nameLong); this._register(Event.any(userDataSyncEnablementService.onDidChangeEnablement, Event.filter(userDataSyncEnablementService.onDidChangeResourceEnablement, e => e[0] === SyncResource.Extensions))(() => this.update())); } protected override async computeAndUpdateEnablement(): Promise<void> { await super.computeAndUpdateEnablement(); if (this.enabled) { this.enabled = this.userDataSyncEnablementService.isEnabled() && this.userDataSyncEnablementService.isResourceEnabled(SyncResource.Extensions); } } protected override getInstallOptions(): InstallOptions { return { ...super.getInstallOptions(), isMachineScoped: false }; } </del> } export class InstallDropdownAction extends ActionWithDropDownAction { set manifest(manifest: IExtensionManifest | null) { <del> this.extensionActions.forEach(a => (<AbstractInstallAction>a).manifest = manifest); </del> <ins> this.extensionActions.forEach(a => (<InstallAction>a).manifest = manifest); </ins> this.update(); }