提交 502bc4e7 编写于 作者: S Sandeep Somavarapu

Fix #46352

上级 6ec24351
...@@ -205,7 +205,7 @@ export class ExtensionManagementService extends Disposable implements IExtension ...@@ -205,7 +205,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
return this.getDependenciesToInstall(local.manifest.extensionDependencies) return this.getDependenciesToInstall(local.manifest.extensionDependencies)
.then(dependenciesToInstall => this.downloadAndInstallExtensions(metadata ? dependenciesToInstall.filter(d => d.identifier.uuid !== metadata.id) : dependenciesToInstall)) .then(dependenciesToInstall => this.downloadAndInstallExtensions(metadata ? dependenciesToInstall.filter(d => d.identifier.uuid !== metadata.id) : dependenciesToInstall))
.then(() => local, error => { .then(() => local, error => {
this.uninstallExtension(local); this.setUninstalled(local);
return TPromise.wrapError(new Error(nls.localize('errorInstallingDependencies', "Error while installing dependencies. {0}", error instanceof Error ? error.message : error))); return TPromise.wrapError(new Error(nls.localize('errorInstallingDependencies', "Error while installing dependencies. {0}", error instanceof Error ? error.message : error)));
}); });
} }
...@@ -241,7 +241,7 @@ export class ExtensionManagementService extends Disposable implements IExtension ...@@ -241,7 +241,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
return this.findGalleryExtension(extension) return this.findGalleryExtension(extension)
.then(galleryExtension => { .then(galleryExtension => {
if (galleryExtension) { if (galleryExtension) {
return this.uninstallExtension(extension) return this.setUninstalled(extension)
.then(() => this.removeUninstalledExtension(extension) .then(() => this.removeUninstalledExtension(extension)
.then( .then(
() => this.installFromGallery(galleryExtension), () => this.installFromGallery(galleryExtension),
...@@ -449,7 +449,7 @@ export class ExtensionManagementService extends Disposable implements IExtension ...@@ -449,7 +449,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
return this.getInstalled(LocalExtensionType.User) return this.getInstalled(LocalExtensionType.User)
.then(installed => .then(installed =>
TPromise.join(installed.filter(local => extensions.some(galleryExtension => local.identifier.id === getLocalExtensionIdFromGallery(galleryExtension, galleryExtension.version))) // Only check id (pub.name-version) because we want to rollback the exact version TPromise.join(installed.filter(local => extensions.some(galleryExtension => local.identifier.id === getLocalExtensionIdFromGallery(galleryExtension, galleryExtension.version))) // Only check id (pub.name-version) because we want to rollback the exact version
.map(local => this.uninstallExtension(local)))) .map(local => this.setUninstalled(local))))
.then(() => null, () => null); .then(() => null, () => null);
} }
...@@ -655,7 +655,9 @@ export class ExtensionManagementService extends Disposable implements IExtension ...@@ -655,7 +655,9 @@ export class ExtensionManagementService extends Disposable implements IExtension
} }
private uninstallExtension(local: ILocalExtension): TPromise<void> { private uninstallExtension(local: ILocalExtension): TPromise<void> {
return this.setUninstalled(local.identifier.id); // Set all versions of the extension as uninstalled
return this.scanUserExtensions(false)
.then(userExtensions => this.setUninstalled(...userExtensions.filter(u => areSameExtensions({ id: getGalleryExtensionIdFromLocal(u), uuid: u.identifier.uuid }, { id: getGalleryExtensionIdFromLocal(local), uuid: local.identifier.uuid }))));
} }
private async postUninstallExtension(extension: ILocalExtension, error?: string): TPromise<void> { private async postUninstallExtension(extension: ILocalExtension, error?: string): TPromise<void> {
...@@ -791,7 +793,8 @@ export class ExtensionManagementService extends Disposable implements IExtension ...@@ -791,7 +793,8 @@ export class ExtensionManagementService extends Disposable implements IExtension
}); });
} }
private setUninstalled(...ids: string[]): TPromise<void> { private setUninstalled(...extensions: ILocalExtension[]): TPromise<void> {
const ids = extensions.map(e => e.identifier.id);
return this.withUninstalledExtensions(uninstalled => assign(uninstalled, ids.reduce((result, id) => { result[id] = true; return result; }, {}))); return this.withUninstalledExtensions(uninstalled => assign(uninstalled, ids.reduce((result, id) => { result[id] = true; return result; }, {})));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册