@@ -565,18 +565,21 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
565
565
async getExtensions ( extensionInfos : ReadonlyArray < IExtensionInfo > , arg1 : any , arg2 ?: any ) : Promise < IGalleryExtension [ ] > {
566
566
const options = CancellationToken . isCancellationToken ( arg1 ) ? { targetPlatform : CURRENT_TARGET_PLATFORM } : arg1 as { targetPlatform : TargetPlatform , compatible ?: boolean , queryAllVersions ?: boolean } ;
567
567
const token = CancellationToken . isCancellationToken ( arg1 ) ? arg1 : arg2 as CancellationToken ;
568
- const names : string [ ] = [ ] ; const ids : string [ ] = [ ] , includePreRelease : ( IExtensionIdentifier & { includePreRelease : boolean } ) [ ] = [ ] , versions : ( IExtensionIdentifier & { version : string } ) [ ] = [ ] ;
568
+ const names : string [ ] = [ ] ; const ids : string [ ] = [ ] , includePreReleases : ( IExtensionIdentifier & { includePreRelease : boolean } ) [ ] = [ ] , versions : ( IExtensionIdentifier & { version : string } ) [ ] = [ ] ;
569
+ let isQueryForReleaseVersionFromPreReleaseVersion = true ;
569
570
for ( const extensionInfo of extensionInfos ) {
570
571
if ( extensionInfo . uuid ) {
571
572
ids . push ( extensionInfo . uuid ) ;
572
573
} else {
573
574
names . push ( extensionInfo . id ) ;
574
575
}
575
576
// Set includePreRelease to true if version is set, because the version can be a pre-release version
576
- includePreRelease . push ( { id : extensionInfo . id , uuid : extensionInfo . uuid , includePreRelease : ! ! ( extensionInfo . version || extensionInfo . preRelease ) } ) ;
577
+ const includePreRelease = ! ! ( extensionInfo . version || extensionInfo . preRelease ) ;
578
+ includePreReleases . push ( { id : extensionInfo . id , uuid : extensionInfo . uuid , includePreRelease } ) ;
577
579
if ( extensionInfo . version ) {
578
580
versions . push ( { id : extensionInfo . id , uuid : extensionInfo . uuid , version : extensionInfo . version } ) ;
579
581
}
582
+ isQueryForReleaseVersionFromPreReleaseVersion = isQueryForReleaseVersionFromPreReleaseVersion && ( ! ! extensionInfo . hasPreRelease && ! includePreRelease ) ;
580
583
}
581
584
582
585
if ( ! ids . length && ! names . length ) {
@@ -590,11 +593,11 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
590
593
if ( names . length ) {
591
594
query = query . withFilter ( FilterType . ExtensionName , ...names ) ;
592
595
}
593
- if ( options . queryAllVersions ) {
596
+ if ( options . queryAllVersions || isQueryForReleaseVersionFromPreReleaseVersion /* Inlcude all versions if every requested extension is for release version and has pre-release version */ ) {
594
597
query = query . withFlags ( query . flags , Flags . IncludeVersions ) ;
595
598
}
596
599
597
- const { extensions } = await this . queryGalleryExtensions ( query , { targetPlatform : options . targetPlatform , includePreRelease, versions, compatible : ! ! options . compatible } , token ) ;
600
+ const { extensions } = await this . queryGalleryExtensions ( query , { targetPlatform : options . targetPlatform , includePreRelease : includePreReleases , versions, compatible : ! ! options . compatible } , token ) ;
598
601
return extensions ;
599
602
}
600
603
0 commit comments