Skip to content

Commit

Permalink
Fix #139528
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Jan 14, 2022
1 parent b0cd45c commit 9d80929
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class InstallGalleryExtensionTask extends AbstractInstallExtensionTask {
installableExtension.metadata.isMachineScoped = this.options.isMachineScoped || existingExtension?.isMachineScoped;
installableExtension.metadata.isBuiltin = this.options.isBuiltin || existingExtension?.isBuiltin;
installableExtension.metadata.isPreReleaseVersion = this.gallery.properties.isPreReleaseVersion;
installableExtension.metadata.preRelease = this.gallery.hasPreReleaseVersion ? this.gallery.properties.isPreReleaseVersion : existingExtension?.preRelease;
installableExtension.metadata.preRelease = this.gallery.hasPreReleaseVersion ? this.gallery.properties.isPreReleaseVersion : (existingExtension?.preRelease || this.options.installPreReleaseVersion);

try {
const local = await this.installExtension(installableExtension, token);
Expand Down Expand Up @@ -396,7 +396,13 @@ class InstallVSIXTask extends AbstractInstallExtensionTask {
[galleryExtension] = await this.galleryService.getExtensions([{ id }], token);
}
if (galleryExtension) {
return { id: galleryExtension.identifier.uuid, publisherDisplayName: galleryExtension.publisherDisplayName, publisherId: galleryExtension.publisherId, isPreReleaseVersion: galleryExtension.properties.isPreReleaseVersion, preRelease: galleryExtension.properties.isPreReleaseVersion };
return {
id: galleryExtension.identifier.uuid,
publisherDisplayName: galleryExtension.publisherDisplayName,
publisherId: galleryExtension.publisherId,
isPreReleaseVersion: galleryExtension.properties.isPreReleaseVersion,
preRelease: galleryExtension.properties.isPreReleaseVersion || this.options.installPreReleaseVersion
};
}
} catch (error) {
/* Ignore Error */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ export class InstallLocalExtensionsInRemoteAction extends AbstractInstallExtensi
const targetPlatform = await this.extensionManagementServerService.remoteExtensionManagementServer!.extensionManagementService.getTargetPlatform();
await Promises.settled(localExtensionsToInstall.map(async extension => {
if (this.extensionGalleryService.isEnabled()) {
const gallery = await this.extensionGalleryService.getCompatibleExtension(extension.identifier, !!extension.local?.isPreReleaseVersion, targetPlatform);
const gallery = await this.extensionGalleryService.getCompatibleExtension(extension.identifier, !!extension.local?.preRelease, targetPlatform);
if (gallery) {
galleryExtensions.push(gallery);
return;
Expand Down Expand Up @@ -2672,7 +2672,7 @@ export class InstallRemoteExtensionsInLocalAction extends AbstractInstallExtensi
const targetPlatform = await this.extensionManagementServerService.localExtensionManagementServer!.extensionManagementService.getTargetPlatform();
await Promises.settled(extensions.map(async extension => {
if (this.extensionGalleryService.isEnabled()) {
const gallery = await this.extensionGalleryService.getCompatibleExtension(extension.identifier, !!extension.local?.isPreReleaseVersion, targetPlatform);
const gallery = await this.extensionGalleryService.getCompatibleExtension(extension.identifier, !!extension.local?.preRelease, targetPlatform);
if (gallery) {
galleryExtensions.push(gallery);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Extension implements IExtension {
}

get outdated(): boolean {
return !!this.gallery && this.type === ExtensionType.User && semver.gt(this.latestVersion, this.version) && (this.local?.isPreReleaseVersion || !this.gallery?.properties.isPreReleaseVersion);
return !!this.gallery && this.type === ExtensionType.User && semver.gt(this.latestVersion, this.version) && (this.local?.preRelease || !this.gallery?.properties.isPreReleaseVersion);
}

get telemetryData(): any {
Expand Down Expand Up @@ -424,7 +424,7 @@ class Extensions extends Disposable {
hasChanged = true;
}

const compatible = await this.getCompatibleExtension(gallery, extension.local.isPreReleaseVersion);
const compatible = await this.getCompatibleExtension(gallery, extension.local.preRelease);
if (compatible) {
extension.gallery = compatible;
hasChanged = true;
Expand Down Expand Up @@ -480,7 +480,7 @@ class Extensions extends Disposable {
if (!this.galleryService.isEnabled()) {
return;
}
const compatible = await this.getCompatibleExtension(extension.identifier, !!extension.local?.isPreReleaseVersion);
const compatible = await this.getCompatibleExtension(extension.identifier, !!extension.local?.preRelease);
if (compatible) {
extension.gallery = compatible;
this._onChange.fire({ extension });
Expand Down Expand Up @@ -1010,7 +1010,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
for (const installed of this.local) {
if (installed.type === ExtensionType.User) {
if (installed.identifier.uuid) {
identifiers.push({ ...installed.identifier, preRelease: !!installed.local?.isPreReleaseVersion || !!installed.local?.preRelease });
identifiers.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
} else {
names.push(installed.identifier.id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class InstallExtensionTask extends AbstractExtensionTask<ILocalExtension> implem
metadata.publisherId = this.extension.publisherId;
metadata.installedTimestamp = Date.now();
metadata.isPreReleaseVersion = this.extension.properties.isPreReleaseVersion;
metadata.preRelease = this.extension.hasPreReleaseVersion ? this.extension.properties.isPreReleaseVersion : metadata.preRelease;
metadata.preRelease = this.extension.hasPreReleaseVersion ? this.extension.properties.isPreReleaseVersion : (metadata.preRelease || this.options.installPreReleaseVersion);
}

const scannedExtension = URI.isUri(this.extension) ? await this.webExtensionsScannerService.addExtension(this.extension, metadata)
Expand Down

0 comments on commit 9d80929

Please sign in to comment.