@@ -989,7 +989,8 @@ export class ExtensionsListView extends ViewPane {
989
989
990
990
// Get All types of recommendations, trimmed to show a max of 8 at any given time
991
991
private async getAllRecommendationsModel ( options : IQueryOptions , token : CancellationToken ) : Promise < IPagedModel < IExtension > > {
992
- const local = ( await this . extensionsWorkbenchService . queryLocal ( this . options . server ) ) . map ( e => e . identifier . id . toLowerCase ( ) ) ;
992
+ const localExtensions = await this . extensionsWorkbenchService . queryLocal ( this . options . server ) ;
993
+ const localExtensionIds = localExtensions . map ( e => e . identifier . id . toLowerCase ( ) ) ;
993
994
994
995
const allRecommendations = distinct (
995
996
flatten ( await Promise . all ( [
@@ -998,10 +999,32 @@ export class ExtensionsListView extends ViewPane {
998
999
this . extensionRecommendationsService . getImportantRecommendations ( ) ,
999
1000
this . extensionRecommendationsService . getFileBasedRecommendations ( ) ,
1000
1001
this . extensionRecommendationsService . getOtherRecommendations ( )
1001
- ] ) ) . filter ( extensionId => ! isString ( extensionId ) || ! local . includes ( extensionId . toLowerCase ( ) ) ) ) ;
1002
+ ] ) ) . filter ( extensionId => {
1003
+ if ( isString ( extensionId ) ) {
1004
+ return ! localExtensionIds . includes ( extensionId . toLowerCase ( ) ) ;
1005
+ }
1006
+ return ! localExtensions . some ( localExtension => localExtension . local && this . uriIdentityService . extUri . isEqual ( localExtension . local . location , extensionId ) ) ;
1007
+ } ) ) ;
1002
1008
1003
1009
const installableRecommendations = await this . getInstallableRecommendations ( allRecommendations , { ...options , source : 'recommendations-all' , sortBy : undefined } , token ) ;
1004
- return new PagedModel ( installableRecommendations . slice ( 0 , 8 ) ) ;
1010
+
1011
+ const result : IExtension [ ] = [ ] ;
1012
+ for ( let i = 0 ; i < installableRecommendations . length && result . length < 8 ; i ++ ) {
1013
+ const recommendation = allRecommendations [ i ] ;
1014
+ if ( isString ( recommendation ) ) {
1015
+ const extension = installableRecommendations . find ( extension => areSameExtensions ( extension . identifier , { id : recommendation } ) ) ;
1016
+ if ( extension ) {
1017
+ result . push ( extension ) ;
1018
+ }
1019
+ } else {
1020
+ const extension = installableRecommendations . find ( extension => extension . resourceExtension && this . uriIdentityService . extUri . isEqual ( extension . resourceExtension . location , recommendation ) ) ;
1021
+ if ( extension ) {
1022
+ result . push ( extension ) ;
1023
+ }
1024
+ }
1025
+ }
1026
+
1027
+ return new PagedModel ( result ) ;
1005
1028
}
1006
1029
1007
1030
private async searchRecommendations ( query : Query , options : IQueryOptions , token : CancellationToken ) : Promise < IPagedModel < IExtension > > {
0 commit comments