Skip to content

Commit

Permalink
Fix #110905
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Nov 19, 2020
1 parent a89864b commit a36c68b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/vs/code/node/cliProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,25 @@ 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) {
if (/\.vsix$/i.test(extension)) {
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 } });
}
}
Expand All @@ -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());
Expand Down Expand Up @@ -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));
}

Expand Down

0 comments on commit a36c68b

Please sign in to comment.