Skip to content

Commit

Permalink
remove target platform fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Oct 16, 2023
1 parent ffa1bef commit df3c2cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri';
import { IHeaders, IRequestContext, IRequestOptions } from 'vs/base/parts/request/common/request';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { getFallbackTargetPlarforms, getTargetPlatform, IExtensionGalleryService, IExtensionIdentifier, IExtensionInfo, IGalleryExtension, IGalleryExtensionAsset, IGalleryExtensionAssets, IGalleryExtensionVersion, InstallOperation, IQueryOptions, IExtensionsControlManifest, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ITranslation, SortBy, SortOrder, StatisticType, toTargetPlatform, WEB_EXTENSION_TAG, IExtensionQueryOptions, IDeprecationInfo, ISearchPrefferedResults } from 'vs/platform/extensionManagement/common/extensionManagement';
import { getTargetPlatform, IExtensionGalleryService, IExtensionIdentifier, IExtensionInfo, IGalleryExtension, IGalleryExtensionAsset, IGalleryExtensionAssets, IGalleryExtensionVersion, InstallOperation, IQueryOptions, IExtensionsControlManifest, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ITranslation, SortBy, SortOrder, StatisticType, toTargetPlatform, WEB_EXTENSION_TAG, IExtensionQueryOptions, IDeprecationInfo, ISearchPrefferedResults } from 'vs/platform/extensionManagement/common/extensionManagement';
import { adoptToGalleryExtensionId, areSameExtensions, getGalleryExtensionId, getGalleryExtensionTelemetryData } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { IExtensionManifest, TargetPlatform } from 'vs/platform/extensions/common/extensions';
import { isEngineValid } from 'vs/platform/extensions/common/extensionValidator';
Expand Down Expand Up @@ -471,7 +471,6 @@ function getAllTargetPlatforms(rawGalleryExtension: IRawGalleryExtension): Targe

export function sortExtensionVersions(versions: IRawGalleryExtensionVersion[], preferredTargetPlatform: TargetPlatform): IRawGalleryExtensionVersion[] {
/* It is expected that versions from Marketplace are sorted by version. So we are just sorting by preferred targetPlatform */
const fallbackTargetPlatforms = getFallbackTargetPlarforms(preferredTargetPlatform);
for (let index = 0; index < versions.length; index++) {
const version = versions[index];
if (version.version === versions[index - 1]?.version) {
Expand All @@ -481,10 +480,6 @@ export function sortExtensionVersions(versions: IRawGalleryExtensionVersion[], p
if (versionTargetPlatform === preferredTargetPlatform) {
while (insertionIndex > 0 && versions[insertionIndex - 1].version === version.version) { insertionIndex--; }
}
/* put it after version with preferred targetPlatform or at the beginning */
else if (fallbackTargetPlatforms.includes(versionTargetPlatform)) {
while (insertionIndex > 0 && versions[insertionIndex - 1].version === version.version && getTargetPlatformForExtensionVersion(versions[insertionIndex - 1]) !== preferredTargetPlatform) { insertionIndex--; }
}
if (insertionIndex !== index) {
versions.splice(index, 1);
versions.splice(insertionIndex, 0, version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,7 @@ export function isTargetPlatformCompatible(extensionTargetPlatform: TargetPlatfo
return true;
}

// Fallback
const fallbackTargetPlatforms = getFallbackTargetPlarforms(productTargetPlatform);
return fallbackTargetPlatforms.includes(extensionTargetPlatform);
}

export function getFallbackTargetPlarforms(targetPlatform: TargetPlatform): TargetPlatform[] {
switch (targetPlatform) {
case TargetPlatform.WIN32_X64: return [];
case TargetPlatform.WIN32_ARM64: return [];
}
return [];
return false;
}

export interface IGalleryExtensionProperties {
Expand Down

0 comments on commit df3c2cd

Please sign in to comment.