@@ -345,7 +345,7 @@ export class ExtensionsListView extends ViewPane {
345
345
private async queryLocal ( query : Query , options : IQueryOptions ) : Promise < IQueryResult > {
346
346
const local = await this . extensionsWorkbenchService . queryLocal ( this . options . server ) ;
347
347
const runningExtensions = await this . extensionService . getExtensions ( ) ;
348
- let { extensions, canIncludeInstalledExtensions } = this . filterLocal ( local , runningExtensions , query , options ) ;
348
+ let { extensions, canIncludeInstalledExtensions } = await this . filterLocal ( local , runningExtensions , query , options ) ;
349
349
const disposables = new DisposableStore ( ) ;
350
350
const onDidChangeModel = disposables . add ( new Emitter < IPagedModel < IExtension > > ( ) ) ;
351
351
@@ -358,7 +358,7 @@ export class ExtensionsListView extends ViewPane {
358
358
) , ( ) => undefined ) ( async ( ) => {
359
359
const local = this . options . server ? this . extensionsWorkbenchService . installed . filter ( e => e . server === this . options . server ) : this . extensionsWorkbenchService . local ;
360
360
const runningExtensions = await this . extensionService . getExtensions ( ) ;
361
- const { extensions : newExtensions } = this . filterLocal ( local , runningExtensions , query , options ) ;
361
+ const { extensions : newExtensions } = await this . filterLocal ( local , runningExtensions , query , options ) ;
362
362
if ( ! isDisposed ) {
363
363
const mergedExtensions = this . mergeAddedExtensions ( extensions , newExtensions ) ;
364
364
if ( mergedExtensions ) {
@@ -376,7 +376,7 @@ export class ExtensionsListView extends ViewPane {
376
376
} ;
377
377
}
378
378
379
- private filterLocal ( local : IExtension [ ] , runningExtensions : IExtensionDescription [ ] , query : Query , options : IQueryOptions ) : { extensions : IExtension [ ] ; canIncludeInstalledExtensions : boolean } {
379
+ private async filterLocal ( local : IExtension [ ] , runningExtensions : IExtensionDescription [ ] , query : Query , options : IQueryOptions ) : Promise < { extensions : IExtension [ ] ; canIncludeInstalledExtensions : boolean } > {
380
380
const value = query . value ;
381
381
let extensions : IExtension [ ] = [ ] ;
382
382
let canIncludeInstalledExtensions = true ;
@@ -406,6 +406,10 @@ export class ExtensionsListView extends ViewPane {
406
406
extensions = this . filterWorkspaceUnsupportedExtensions ( local , query , options ) ;
407
407
}
408
408
409
+ else if ( / @ d e p r e c a t e d / i. test ( query . value ) ) {
410
+ extensions = await this . filterDeprecatedExtensions ( local , query , options ) ;
411
+ }
412
+
409
413
return { extensions, canIncludeInstalledExtensions } ;
410
414
}
411
415
@@ -616,6 +620,13 @@ export class ExtensionsListView extends ViewPane {
616
620
return this . sortExtensions ( local , options ) ;
617
621
}
618
622
623
+ private async filterDeprecatedExtensions ( local : IExtension [ ] , query : Query , options : IQueryOptions ) : Promise < IExtension [ ] > {
624
+ const value = query . value . replace ( / @ d e p r e c a t e d / g, '' ) . replace ( / @ s o r t : ( \w + ) ( - \w * ) ? / g, '' ) . trim ( ) . toLowerCase ( ) ;
625
+ const extensionsControlManifest = await this . extensionManagementService . getExtensionsControlManifest ( ) ;
626
+ const deprecatedExtensionIds = Object . keys ( extensionsControlManifest . deprecated ) ;
627
+ local = local . filter ( e => deprecatedExtensionIds . includes ( e . identifier . id ) && ( ! value || e . name . toLowerCase ( ) . indexOf ( value ) > - 1 || e . displayName . toLowerCase ( ) . indexOf ( value ) > - 1 ) ) ;
628
+ return this . sortExtensions ( local , options ) ;
629
+ }
619
630
620
631
private mergeAddedExtensions ( extensions : IExtension [ ] , newExtensions : IExtension [ ] ) : IExtension [ ] | undefined {
621
632
const oldExtensions = [ ...extensions ] ;
@@ -653,10 +664,6 @@ export class ExtensionsListView extends ViewPane {
653
664
return this . queryRecommendations ( query , options , token ) ;
654
665
}
655
666
656
- if ( / @ d e p r e c a t e d / i. test ( query . value ) ) {
657
- return this . getDeprecatedExtensions ( options , token ) ;
658
- }
659
-
660
667
if ( / \b c u r a t e d : ( [ ^ \s ] + ) \b / . test ( query . value ) ) {
661
668
return this . getCuratedModel ( query , options , token ) ;
662
669
}
@@ -752,16 +759,6 @@ export class ExtensionsListView extends ViewPane {
752
759
return new PagedModel ( [ ] ) ;
753
760
}
754
761
755
- private async getDeprecatedExtensions ( options : IQueryOptions , token : CancellationToken ) : Promise < IPagedModel < IExtension > > {
756
- const extensionsControlManifest = await this . extensionManagementService . getExtensionsControlManifest ( ) ;
757
- const deprecatedExtensionIds = Object . keys ( extensionsControlManifest . deprecated ) ;
758
- if ( deprecatedExtensionIds . length ) {
759
- const pager = await this . extensionsWorkbenchService . queryGallery ( { ...options , names : deprecatedExtensionIds , text : undefined } , token ) ;
760
- return this . getPagedModel ( pager ) ;
761
- }
762
- return this . getPagedModel ( [ ] ) ;
763
- }
764
-
765
762
private isRecommendationsQuery ( query : Query ) : boolean {
766
763
return ExtensionsListView . isWorkspaceRecommendedExtensionsQuery ( query . value )
767
764
|| ExtensionsListView . isKeymapsRecommendedExtensionsQuery ( query . value )
@@ -1024,6 +1021,7 @@ export class ExtensionsListView extends ViewPane {
1024
1021
|| this . isBuiltInExtensionsQuery ( query )
1025
1022
|| this . isSearchBuiltInExtensionsQuery ( query )
1026
1023
|| this . isBuiltInGroupExtensionsQuery ( query )
1024
+ || this . isSearchDeprecatedExtensionsQuery ( query )
1027
1025
|| this . isSearchWorkspaceUnsupportedExtensionsQuery ( query ) ;
1028
1026
}
1029
1027
@@ -1059,6 +1057,10 @@ export class ExtensionsListView extends ViewPane {
1059
1057
return / @ d i s a b l e d / i. test ( query ) ;
1060
1058
}
1061
1059
1060
+ static isSearchDeprecatedExtensionsQuery ( query : string ) : boolean {
1061
+ return / @ d e p r e c a t e d \s ? .* / i. test ( query ) ;
1062
+ }
1063
+
1062
1064
static isRecommendedExtensionsQuery ( query : string ) : boolean {
1063
1065
return / ^ @ r e c o m m e n d e d $ / i. test ( query . trim ( ) ) ;
1064
1066
}
@@ -1194,6 +1196,12 @@ export class VirtualWorkspacePartiallySupportedExtensionsView extends Extensions
1194
1196
}
1195
1197
}
1196
1198
1199
+ export class DeprecatedExtensionsView extends ExtensionsListView {
1200
+ override async show ( query : string ) : Promise < IPagedModel < IExtension > > {
1201
+ return ExtensionsListView . isSearchDeprecatedExtensionsQuery ( query ) ? super . show ( query ) : this . showEmptyModel ( ) ;
1202
+ }
1203
+ }
1204
+
1197
1205
export class DefaultRecommendedExtensionsView extends ExtensionsListView {
1198
1206
private readonly recommendedExtensionsQuery = '@recommended:all' ;
1199
1207
0 commit comments