this.storageService.store(promptedRecommendationsStorageKey, JSON.stringify(promptedRecommendations), StorageScope.PROFILE, StorageTarget.USER); } <del> private getPromptedFileExtensions(): string[] { return JSON.parse(this.storageService.get(promptedFileExtensionsStorageKey, StorageScope.PROFILE, '[]')); } private addToPromptedFileExtensions(fileExtension: string) { const promptedFileExtensions = this.getPromptedFileExtensions(); promptedFileExtensions.push(fileExtension); this.storageService.store(promptedFileExtensionsStorageKey, JSON.stringify(distinct(promptedFileExtensions)), StorageScope.PROFILE, StorageTarget.USER); } private async promptRecommendedExtensionForFileExtension(uri: URI, fileExtension: string): Promise<void> { if (this.extensionRecommendationNotificationService.hasToIgnoreRecommendationNotifications()) { return; } // Do not prompt when there is no local and remote extension management servers if (!this.extensionManagementServerService.localExtensionManagementServer && !this.extensionManagementServerService.remoteExtensionManagementServer) { return; } fileExtension = fileExtension.substring(1); // Strip the dot if (!fileExtension) { return; } const mimeTypes = getMimeTypes(uri); if (mimeTypes.length !== 1 || mimeTypes[0] !== Mimes.unknown) { return; } const fileExtensionSuggestionIgnoreList = <string[]>JSON.parse(this.storageService.get('extensionsAssistant/fileExtensionsSuggestionIgnore', StorageScope.PROFILE, '[]')); if (fileExtensionSuggestionIgnoreList.indexOf(fileExtension) > -1) { return; } const promptedFileExtensions = this.getPromptedFileExtensions(); if (promptedFileExtensions.includes(fileExtension)) { return; } const text = `ext:${fileExtension}`; const pager = await this.extensionsWorkbenchService.queryGallery({ text, pageSize: 100 }, CancellationToken.None).then(r => r, () => null); if (!pager?.firstPage.length) { return; } const installedExtensionsIds = this.extensionsWorkbenchService.local.reduce((result, i) => { result.add(i.identifier.id.toLowerCase()); return result; }, new Set<string>()); if (pager.firstPage.some(e => installedExtensionsIds.has(e.identifier.id.toLowerCase()))) { return; } this.notificationService.prompt( Severity.Info, localize('showLanguageExtensions', "The Marketplace has extensions that can help with '.{0}' files", fileExtension), [{ label: searchMarketplace, run: () => { this.addToPromptedFileExtensions(fileExtension); this.telemetryService.publicLog2<{ userReaction: string; fileExtension: string }, FileExtensionSuggestionClassification>('fileExtensionSuggestion:popup', { userReaction: 'ok', fileExtension }); this.paneCompositeService.openPaneComposite(EXTENSIONS_VIEWLET_ID, ViewContainerLocation.Sidebar, true) .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(`ext:${fileExtension}`); viewlet.focus(); }); } }, { label: localize('dontShowAgainExtension', "Don't Show Again for '.{0}' files", fileExtension), run: () => { fileExtensionSuggestionIgnoreList.push(fileExtension); this.storageService.store( 'extensionsAssistant/fileExtensionsSuggestionIgnore', JSON.stringify(fileExtensionSuggestionIgnoreList), StorageScope.PROFILE, StorageTarget.USER); this.telemetryService.publicLog2<{ userReaction: string; fileExtension: string }, FileExtensionSuggestionClassification>('fileExtensionSuggestion:popup', { userReaction: 'neverShowAgain', fileExtension }); } }], { sticky: true, onCancel: () => { this.telemetryService.publicLog2<{ userReaction: string; fileExtension: string }, FileExtensionSuggestionClassification>('fileExtensionSuggestion:popup', { userReaction: 'cancelled', fileExtension }); } } ); } </del> private filterIgnoredOrNotAllowed(recommendationsToSuggest: string[]): string[] { const ignoredRecommendations = [...this.extensionIgnoredRecommendationsService.ignoredRecommendations, ...this.extensionRecommendationNotificationService.ignoredRecommendations]; return recommendationsToSuggest.filter(id => !ignoredRecommendations.includes(id));