33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { IExtensionManagementService , ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement' ;
76import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
87import { ExtensionRecommendations , ExtensionRecommendation } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations' ;
98import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
109import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
11- import { ExtensionRecommendationSource , ExtensionRecommendationReason } from 'vs/workbench/services/extensionManagement/common/extensionManagement' ;
12- import { IExtensionsViewPaneContainer , IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions' ;
10+ import { ExtensionRecommendationSource , ExtensionRecommendationReason , EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement' ;
11+ import { IExtensionsViewPaneContainer , IExtensionsWorkbenchService , IExtension } from 'vs/workbench/contrib/extensions/common/extensions' ;
1312import { CancellationToken } from 'vs/base/common/cancellation' ;
1413import { localize } from 'vs/nls' ;
1514import { StorageScope , IStorageService } from 'vs/platform/storage/common/storage' ;
@@ -85,7 +84,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
8584
8685 constructor (
8786 isExtensionAllowedToBeRecommended : ( extensionId : string ) => boolean ,
88- @IExtensionManagementService private readonly extensionManagementService : IExtensionManagementService ,
8987 @IExtensionsWorkbenchService private readonly extensionsWorkbenchService : IExtensionsWorkbenchService ,
9088 @IExtensionService private readonly extensionService : IExtensionService ,
9189 @IViewletService private readonly viewletService : IViewletService ,
@@ -190,7 +188,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
190188 return ;
191189 }
192190
193- const installed = await this . extensionManagementService . getInstalled ( ) ;
191+ const installed = await this . extensionsWorkbenchService . queryLocal ( ) ;
194192 if ( await this . promptRecommendedExtensionForFileType ( recommendationsToPrompt , installed ) ) {
195193 return ;
196194 }
@@ -211,7 +209,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
211209 this . promptRecommendedExtensionForFileExtension ( fileExtension , installed ) ;
212210 }
213211
214- private async promptRecommendedExtensionForFileType ( recommendations : string [ ] , installed : ILocalExtension [ ] ) : Promise < boolean > {
212+ private async promptRecommendedExtensionForFileType ( recommendations : string [ ] , installed : IExtension [ ] ) : Promise < boolean > {
215213
216214 recommendations = this . filterIgnoredOrNotAllowed ( recommendations ) ;
217215 if ( recommendations . length === 0 ) {
@@ -238,7 +236,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
238236 return true ;
239237 }
240238
241- private async promptRecommendedExtensionForFileExtension ( fileExtension : string , installed : ILocalExtension [ ] ) : Promise < void > {
239+ private async promptRecommendedExtensionForFileExtension ( fileExtension : string , installed : IExtension [ ] ) : Promise < void > {
242240 const fileExtensionSuggestionIgnoreList = < string [ ] > JSON . parse ( this . storageService . get ( 'extensionsAssistant/fileExtensionsSuggestionIgnore' , StorageScope . GLOBAL , '[]' ) ) ;
243241 if ( fileExtensionSuggestionIgnoreList . indexOf ( fileExtension ) > - 1 ) {
244242 return ;
@@ -290,8 +288,13 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
290288 ) ;
291289 }
292290
293- private filterInstalled ( recommendationsToSuggest : string [ ] , installed : ILocalExtension [ ] ) : string [ ] {
294- const installedExtensionsIds = installed . reduce ( ( result , i ) => { result . add ( i . identifier . id . toLowerCase ( ) ) ; return result ; } , new Set < string > ( ) ) ;
291+ private filterInstalled ( recommendationsToSuggest : string [ ] , installed : IExtension [ ] ) : string [ ] {
292+ const installedExtensionsIds = installed . reduce ( ( result , i ) => {
293+ if ( i . enablementState !== EnablementState . DisabledByExtensionKind ) {
294+ result . add ( i . identifier . id . toLowerCase ( ) ) ;
295+ }
296+ return result ;
297+ } , new Set < string > ( ) ) ;
295298 return recommendationsToSuggest . filter ( id => ! installedExtensionsIds . has ( id . toLowerCase ( ) ) ) ;
296299 }
297300
0 commit comments