This commit is contained in:
Sandeep Somavarapu
2020-11-19 03:23:22 +01:00
parent a89864b295
commit a36c68b9ec
+13 -8
View File
@@ -133,6 +133,7 @@ export class Main {
console.log(localize('installingExtensions', "Installing extensions..."));
}
const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
const vsixs: string[] = [];
const installExtensionInfos: InstallExtensionInfo[] = [];
for (const extension of extensions) {
@@ -140,6 +141,17 @@ export class Main {
vsixs.push(extension);
} else {
const [id, version] = getIdAndVersion(extension);
const installedExtension = installed.find(i => areSameExtensions(i.identifier, { id }));
if (installedExtension) {
if (!version && !force) {
console.log(localize('alreadyInstalled-checkAndUpdate', "Extension '{0}' is already installed. Use '--force' option to check and update to newer version.", id));
continue;
}
if (version && installedExtension.manifest.version === version) {
console.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", `${id}@${version}`));
continue;
}
}
installExtensionInfos.push({ id, version, installOptions: { isBuiltin: false, isMachineScoped } });
}
}
@@ -164,10 +176,7 @@ export class Main {
if (installExtensionInfos.length) {
const [galleryExtensions, installed] = await Promise.all([
this.getGalleryExtensions(installExtensionInfos),
this.extensionManagementService.getInstalled(ExtensionType.User)
]);
const galleryExtensions = await this.getGalleryExtensions(installExtensionInfos);
await Promise.all(installExtensionInfos.map(async extensionInfo => {
const gallery = galleryExtensions.get(extensionInfo.id.toLowerCase());
@@ -248,10 +257,6 @@ export class Main {
console.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", version ? `${id}@${version}` : id));
return null;
}
if (!version && !force) {
console.log(localize('forceUpdate', "Extension '{0}' v{1} is already installed, but a newer version {2} is available in the marketplace. Use '--force' option to update to newer version.", id, installedExtension.manifest.version, galleryExtension.version));
return null;
}
console.log(localize('updateMessage', "Updating the extension '{0}' to the version {1}", id, galleryExtension.version));
}