Skip to content

Commit 4f60251

Browse files
committed
Fix #139015
- make single query to get all compatible extensions while checking updates
1 parent b686f7a commit 4f60251

File tree

3 files changed

+183
-164
lines changed

3 files changed

+183
-164
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,9 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
561561
}
562562

563563
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, token: CancellationToken): Promise<IGalleryExtension[]>;
564-
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: { targetPlatform: TargetPlatform, compatible?: boolean }, token: CancellationToken): Promise<IGalleryExtension[]>;
564+
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: { targetPlatform: TargetPlatform, compatible?: boolean, queryAllVersions?: boolean }, token: CancellationToken): Promise<IGalleryExtension[]>;
565565
async getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, arg1: any, arg2?: any): Promise<IGalleryExtension[]> {
566-
const options = CancellationToken.isCancellationToken(arg1) ? { targetPlatform: CURRENT_TARGET_PLATFORM } : arg1 as { targetPlatform: TargetPlatform, compatible?: boolean };
566+
const options = CancellationToken.isCancellationToken(arg1) ? { targetPlatform: CURRENT_TARGET_PLATFORM } : arg1 as { targetPlatform: TargetPlatform, compatible?: boolean, queryAllVersions?: boolean };
567567
const token = CancellationToken.isCancellationToken(arg1) ? arg1 : arg2 as CancellationToken;
568568
const names: string[] = []; const ids: string[] = [], includePreRelease: (IExtensionIdentifier & { includePreRelease: boolean })[] = [], versions: (IExtensionIdentifier & { version: string })[] = [];
569569
for (const extensionInfo of extensionInfos) {
@@ -589,6 +589,9 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
589589
if (names.length) {
590590
query = query.withFilter(FilterType.ExtensionName, ...names);
591591
}
592+
if (options.queryAllVersions) {
593+
query = query.withFlags(query.flags, Flags.IncludeVersions);
594+
}
592595

593596
const { extensions } = await this.queryGalleryExtensions(query, { targetPlatform: options.targetPlatform, includePreRelease, versions, compatible: !!options.compatible }, token);
594597
return extensions;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export interface IExtensionGalleryService {
346346
isEnabled(): boolean;
347347
query(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>>;
348348
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, token: CancellationToken): Promise<IGalleryExtension[]>;
349-
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: { targetPlatform: TargetPlatform, compatible?: boolean }, token: CancellationToken): Promise<IGalleryExtension[]>;
349+
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: { targetPlatform: TargetPlatform, compatible?: boolean, queryAllVersions?: boolean }, token: CancellationToken): Promise<IGalleryExtension[]>;
350350
isExtensionCompatible(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform): Promise<boolean>;
351351
getCompatibleExtension(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform): Promise<IGalleryExtension | null>;
352352
getAllCompatibleVersions(extension: IGalleryExtension, preRelease: boolean, targetPlatform: TargetPlatform): Promise<IGalleryExtensionVersion[]>;

0 commit comments

Comments
 (0)