Skip to content

Commit 87baaea

Browse files
authored
1 parent 3640c5a commit 87baaea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export abstract class AbstractExtensionManagementService extends Disposable impl
118118

119119
await Promise.allSettled(extensions.map(async ({ extension, options }) => {
120120
try {
121-
const compatible = await this.checkAndGetCompatibleVersion(extension, !!options?.installGivenVersion, !!options?.installPreReleaseVersion);
121+
const compatible = await this.checkAndGetCompatibleVersion(extension, !!options?.installGivenVersion, !!options?.installPreReleaseVersion, false);
122122
installableExtensions.push({ ...compatible, options });
123123
} catch (error) {
124124
results.push({ identifier: extension.identifier, operation: InstallOperation.Install, source: extension, error });
@@ -434,7 +434,7 @@ export abstract class AbstractExtensionManagementService extends Disposable impl
434434
const isDependency = dependecies.some(id => areSameExtensions({ id }, galleryExtension.identifier));
435435
let compatible;
436436
try {
437-
compatible = await this.checkAndGetCompatibleVersion(galleryExtension, false, installPreRelease);
437+
compatible = await this.checkAndGetCompatibleVersion(galleryExtension, false, installPreRelease, true);
438438
} catch (error) {
439439
if (!isDependency) {
440440
this.logService.info('Skipping the packed extension as it cannot be installed', galleryExtension.identifier.id, getErrorMessage(error));
@@ -454,7 +454,7 @@ export abstract class AbstractExtensionManagementService extends Disposable impl
454454
return allDependenciesAndPacks;
455455
}
456456

457-
private async checkAndGetCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, installPreRelease: boolean): Promise<{ extension: IGalleryExtension; manifest: IExtensionManifest }> {
457+
private async checkAndGetCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, installPreRelease: boolean, fallbackToRelease: boolean): Promise<{ extension: IGalleryExtension; manifest: IExtensionManifest }> {
458458
const extensionsControlManifest = await this.getExtensionsControlManifest();
459459
if (extensionsControlManifest.malicious.some(identifier => areSameExtensions(extension.identifier, identifier))) {
460460
throw new ExtensionManagementError(nls.localize('malicious extension', "Can't install '{0}' extension since it was reported to be problematic.", extension.identifier.id), ExtensionManagementErrorCode.Malicious);
@@ -467,7 +467,7 @@ export abstract class AbstractExtensionManagementService extends Disposable impl
467467

468468
const compatibleExtension = await this.getCompatibleVersion(extension, sameVersion, installPreRelease);
469469
if (compatibleExtension) {
470-
if (installPreRelease && !sameVersion && extension.hasPreReleaseVersion && !compatibleExtension.properties.isPreReleaseVersion) {
470+
if (!fallbackToRelease && installPreRelease && !sameVersion && extension.hasPreReleaseVersion && !compatibleExtension.properties.isPreReleaseVersion) {
471471
throw new ExtensionManagementError(nls.localize('notFoundCompatiblePrereleaseDependency', "Can't install pre-release version of '{0}' extension because it is not compatible with the current version of {1} (version {2}).", extension.identifier.id, this.productService.nameLong, this.productService.version), ExtensionManagementErrorCode.IncompatiblePreRelease);
472472
}
473473
} else {

0 commit comments

Comments
 (0)