recovery fix: fixing installing extensions everywhere when it is already installed locally (#236562)
* recovery fix: fixing installing extensions everywhere when it is already installed locally * clean uppull/236567/head
parent
d74499bdb9
commit
7e000daa48
|
@ -2368,8 +2368,9 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
|||
if (extension?.isMalicious) {
|
||||
throw new Error(nls.localize('malicious', "This extension is reported to be problematic."));
|
||||
}
|
||||
// TODO: @sandy081 - Install the extension only on servers where it is not installed
|
||||
// Do not install if requested to enable and extension is already installed
|
||||
if (!(installOptions.enable && extension?.local)) {
|
||||
if (installOptions.installEverywhere || !(installOptions.enable && extension?.local)) {
|
||||
if (!installable) {
|
||||
if (!gallery) {
|
||||
const id = isString(arg) ? arg : (<IExtension>arg).identifier.id;
|
||||
|
@ -2730,10 +2731,11 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
|||
return this.extensionManagementService.installVSIX(vsix, manifest, installOptions);
|
||||
}
|
||||
|
||||
private installFromGallery(extension: IExtension, gallery: IGalleryExtension, installOptions?: InstallOptions): Promise<ILocalExtension> {
|
||||
private installFromGallery(extension: IExtension, gallery: IGalleryExtension, installOptions?: InstallExtensionOptions): Promise<ILocalExtension> {
|
||||
installOptions = installOptions ?? {};
|
||||
installOptions.pinned = extension.local?.pinned || !this.shouldAutoUpdateExtension(extension);
|
||||
if (extension.local) {
|
||||
// TODO: @sandy081 - Install the extension only on servers where it is not installed
|
||||
if (!installOptions.installEverywhere && extension.local) {
|
||||
installOptions.productVersion = this.getProductVersion();
|
||||
installOptions.operation = InstallOperation.Update;
|
||||
return this.extensionManagementService.updateFromGallery(gallery, extension.local, installOptions);
|
||||
|
|
|
@ -466,7 +466,7 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
|
|||
installOptions = { ...(installOptions || {}), isMachineScoped };
|
||||
}
|
||||
|
||||
if (installOptions.installEverywhere || (!installOptions.isMachineScoped && this.isExtensionsSyncEnabled())) {
|
||||
if (!installOptions.isMachineScoped && this.isExtensionsSyncEnabled()) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer
|
||||
&& !servers.includes(this.extensionManagementServerService.localExtensionManagementServer)
|
||||
&& await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(gallery) === true) {
|
||||
|
@ -597,7 +597,7 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
|
|||
}
|
||||
}
|
||||
|
||||
private async validateAndGetExtensionManagementServersToInstall(gallery: IGalleryExtension, installOptions?: InstallOptions): Promise<IExtensionManagementServer[]> {
|
||||
private async validateAndGetExtensionManagementServersToInstall(gallery: IGalleryExtension, installOptions?: IWorkbenchInstallOptions): Promise<IExtensionManagementServer[]> {
|
||||
|
||||
const manifest = await this.extensionGalleryService.getManifest(gallery, CancellationToken.None);
|
||||
if (!manifest) {
|
||||
|
@ -606,8 +606,8 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
|
|||
|
||||
const servers: IExtensionManagementServer[] = [];
|
||||
|
||||
// Install Language pack on local and remote servers
|
||||
if (isLanguagePackExtension(manifest)) {
|
||||
// Install everywhere if asked to install everywhere or if the extension is a language pack
|
||||
if (installOptions?.installEverywhere || isLanguagePackExtension(manifest)) {
|
||||
servers.push(...this.servers.filter(server => server !== this.extensionManagementServerService.webExtensionManagementServer));
|
||||
} else {
|
||||
const server = this.getExtensionManagementServerToInstall(manifest);
|
||||
|
|
Loading…
Reference in New Issue