Skip to content

Commit f08ca68

Browse files
authored
1 parent 9b47b78 commit f08ca68

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/vs/platform/extensionManagement/common/abstractExtensionManagementService.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
321321
const isApplicationScoped = options.isApplicationScoped || options.isBuiltin || isApplicationScopedExtension(manifest);
322322
const installExtensionTaskOptions: InstallExtensionTaskOptions = {
323323
...options,
324-
installOnlyNewlyAddedFromExtensionPack: options.installOnlyNewlyAddedFromExtensionPack ?? !URI.isUri(extension) /* always true for gallery extensions */,
325324
isApplicationScoped,
326325
profileLocation: isApplicationScoped ? this.userDataProfilesService.defaultProfile.extensionsResource : options.profileLocation ?? this.getCurrentExtensionsManifestLocation(),
327326
productVersion: options.productVersion ?? { version: this.productService.version, date: this.productService.date }
@@ -342,11 +341,13 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
342341
this.logService.info('Installing the extension without checking dependencies and pack', task.identifier.id);
343342
} else {
344343
try {
345-
const allDepsAndPackExtensionsToInstall = await this.getAllDepsAndPackExtensions(task.identifier, task.manifest, !!task.options.installOnlyNewlyAddedFromExtensionPack, !!task.options.installPreReleaseVersion, task.options.profileLocation, task.options.productVersion);
344+
const allDepsAndPackExtensionsToInstall = await this.getAllDepsAndPackExtensions(task.identifier, task.manifest, !!task.options.installPreReleaseVersion, task.options.productVersion);
346345
const installed = await this.getInstalled(undefined, task.options.profileLocation, task.options.productVersion);
347346
const options: InstallExtensionTaskOptions = { ...task.options, context: { ...task.options.context, [EXTENSION_INSTALL_DEP_PACK_CONTEXT]: true } };
348347
for (const { gallery, manifest } of distinct(allDepsAndPackExtensionsToInstall, ({ gallery }) => gallery.identifier.id)) {
349-
if (installed.some(({ identifier }) => areSameExtensions(identifier, gallery.identifier))) {
348+
const existing = installed.find(e => areSameExtensions(e.identifier, gallery.identifier));
349+
// Skip if the extension is already installed and has the same application scope
350+
if (existing && existing.isApplicationScoped === !!options.isApplicationScoped) {
350351
continue;
351352
}
352353
createInstallExtensionTask(manifest, gallery, options, task);
@@ -578,12 +579,11 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
578579
throw error;
579580
}
580581

581-
private async getAllDepsAndPackExtensions(extensionIdentifier: IExtensionIdentifier, manifest: IExtensionManifest, getOnlyNewlyAddedFromExtensionPack: boolean, installPreRelease: boolean, profile: URI | undefined, productVersion: IProductVersion): Promise<{ gallery: IGalleryExtension; manifest: IExtensionManifest }[]> {
582+
private async getAllDepsAndPackExtensions(extensionIdentifier: IExtensionIdentifier, manifest: IExtensionManifest, installPreRelease: boolean, productVersion: IProductVersion): Promise<{ gallery: IGalleryExtension; manifest: IExtensionManifest }[]> {
582583
if (!this.galleryService.isEnabled()) {
583584
return [];
584585
}
585586

586-
const installed = await this.getInstalled(undefined, profile, productVersion);
587587
const knownIdentifiers: IExtensionIdentifier[] = [];
588588

589589
const allDependenciesAndPacks: { gallery: IGalleryExtension; manifest: IExtensionManifest }[] = [];
@@ -592,13 +592,9 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
592592
const dependecies: string[] = manifest.extensionDependencies || [];
593593
const dependenciesAndPackExtensions = [...dependecies];
594594
if (manifest.extensionPack) {
595-
const existing = getOnlyNewlyAddedFromExtensionPack ? installed.find(e => areSameExtensions(e.identifier, extensionIdentifier)) : undefined;
596595
for (const extension of manifest.extensionPack) {
597-
// add only those extensions which are new in currently installed extension
598-
if (!(existing && existing.manifest.extensionPack && existing.manifest.extensionPack.some(old => areSameExtensions({ id: old }, { id: extension })))) {
599-
if (dependenciesAndPackExtensions.every(e => !areSameExtensions({ id: e }, { id: extension }))) {
600-
dependenciesAndPackExtensions.push(extension);
601-
}
596+
if (dependenciesAndPackExtensions.every(e => !areSameExtensions({ id: e }, { id: extension }))) {
597+
dependenciesAndPackExtensions.push(extension);
602598
}
603599
}
604600
}

src/vs/platform/extensionManagement/common/extensionManagement.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ export type InstallOptions = {
534534
donotVerifySignature?: boolean;
535535
operation?: InstallOperation;
536536
profileLocation?: URI;
537-
installOnlyNewlyAddedFromExtensionPack?: boolean;
538537
productVersion?: IProductVersion;
539538
keepExisting?: boolean;
540539
downloadExtensionsLocally?: boolean;

src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ CommandsRegistry.registerCommand({
456456
}
457457
} else {
458458
const vsix = URI.revive(arg);
459-
await extensionsWorkbenchService.install(vsix, { installOnlyNewlyAddedFromExtensionPack: options?.installOnlyNewlyAddedFromExtensionPackVSIX, installGivenVersion: true });
459+
await extensionsWorkbenchService.install(vsix, { installGivenVersion: true });
460460
}
461461
} catch (e) {
462462
onUnexpectedError(e);

0 commit comments

Comments
 (0)