diff options
author | Benjamin Simmonds <bsimmond@student.ethz.ch> | 2022-09-13 12:27:00 +0300 |
---|---|---|
committer | Benjamin Simmonds <bsimmond@student.ethz.ch> | 2022-09-13 12:27:00 +0300 |
commit | 85b3a395aa490ef09119912b102ebc1ea3b6060f (patch) | |
tree | 414f347f8ae955b9d2b31ac8d87aa264495c6ae3 /src/vs/platform | |
parent | a9f9893925fe0eda9138f3addd803b0de2e4a632 (diff) |
Recently updated fixes
Diffstat (limited to 'src/vs/platform')
-rw-r--r-- | src/vs/platform/extensionManagement/common/extensionGalleryService.ts | 14 | ||||
-rw-r--r-- | src/vs/platform/extensionManagement/common/extensionManagement.ts | 13 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts index 064b2124435..c7cfa2a4619 100644 --- a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts +++ b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts @@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri'; import { 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 } from 'vs/platform/extensionManagement/common/extensionManagement'; +import { getFallbackTargetPlarforms, getTargetPlatform, IExtensionGalleryService, IExtensionIdentifier, IExtensionInfo, IGalleryExtension, IGalleryExtensionAsset, IGalleryExtensionAssets, IGalleryExtensionVersion, InstallOperation, IQueryOptions, IExtensionsControlManifest, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ITranslation, SortOrder, StatisticType, toTargetPlatform, WEB_EXTENSION_TAG, IExtensionQueryOptions, IDeprecationInfo, GallerySortBy } 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'; @@ -216,7 +216,7 @@ const DefaultPageSize = 10; interface IQueryState { readonly pageNumber: number; readonly pageSize: number; - readonly sortBy: SortBy; + readonly sortBy: GallerySortBy; readonly sortOrder: SortOrder; readonly flags: Flags; readonly criteria: ICriterium[]; @@ -227,7 +227,7 @@ interface IQueryState { const DefaultQueryState: IQueryState = { pageNumber: 1, pageSize: DefaultPageSize, - sortBy: SortBy.NoneOrRelevance, + sortBy: GallerySortBy.NoneOrRelevance, sortOrder: SortOrder.Default, flags: Flags.None, criteria: [], @@ -315,8 +315,8 @@ class Query { return new Query({ ...this.state, criteria }); } - withSortBy(sortBy: SortBy): Query { - return sortBy !== SortBy.UpdateDate ? new Query({ ...this.state, sortBy }) : new Query({ ...this.state }); + withSortBy(sortBy: GallerySortBy): Query { + return new Query({ ...this.state, sortBy }); } withSortOrder(sortOrder: SortOrder): Query { @@ -746,13 +746,13 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi query = query.withFilter(FilterType.SearchText, text); } - query = query.withSortBy(SortBy.NoneOrRelevance); + query = query.withSortBy(GallerySortBy.NoneOrRelevance); } else if (options.ids) { query = query.withFilter(FilterType.ExtensionId, ...options.ids); } else if (options.names) { query = query.withFilter(FilterType.ExtensionName, ...options.names); } else { - query = query.withSortBy(SortBy.InstallCount); + query = query.withSortBy(GallerySortBy.InstallCount); } if (typeof options.sortBy === 'number') { diff --git a/src/vs/platform/extensionManagement/common/extensionManagement.ts b/src/vs/platform/extensionManagement/common/extensionManagement.ts index 73ef9335d17..9d7154fa478 100644 --- a/src/vs/platform/extensionManagement/common/extensionManagement.ts +++ b/src/vs/platform/extensionManagement/common/extensionManagement.ts @@ -251,7 +251,7 @@ export interface ILocalExtension extends IExtension { updated: boolean; } -export const enum SortBy { +export const enum GallerySortBy { NoneOrRelevance = 0, LastUpdatedDate = 1, Title = 2, @@ -260,7 +260,16 @@ export const enum SortBy { PublishedDate = 10, AverageRating = 6, WeightedRating = 12, - UpdateDate = 13, +} + +export enum LocalSortBy { + UpdateDate = 'UpdateDate', +} + +export type SortBy = GallerySortBy | LocalSortBy; + +export function isLocalSort(sortBy: SortBy): sortBy is LocalSortBy { + return (Object.values(LocalSortBy) as SortBy[]).includes(sortBy); } export const enum SortOrder { |