Fix extension recommendations (#14275)

* Fix extension recommendations

* revert header
This commit is contained in:
Charles Gagnon
2021-02-12 13:00:48 -08:00
committed by GitHub
parent c456b81071
commit 56d2f6b497
4 changed files with 8 additions and 236 deletions

View File

@@ -3,12 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtensionRecommendations, ExtensionRecommendation, PromptedExtensionRecommendations } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations';
import { ExtensionRecommendations, ExtensionRecommendation } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations';
import { IProductService } from 'vs/platform/product/common/productService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { localize } from 'vs/nls';
import { IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
@@ -28,21 +26,16 @@ export class ScenarioRecommendations extends ExtensionRecommendations {
get recommendations(): ReadonlyArray<ExtensionRecommendation> { return this._recommendations; }
constructor(
promptedExtensionRecommendations?: PromptedExtensionRecommendations,
@IProductService private readonly productService?: IProductService,
@IInstantiationService private readonly instantiationService?: IInstantiationService,
@IConfigurationService configurationService?: IConfigurationService,
@INotificationService private readonly notificationService?: INotificationService,
@ITelemetryService telemetryService?: ITelemetryService,
@IStorageService private readonly storageService?: IStorageService,
@IExtensionManagementService protected readonly extensionManagementService?: IExtensionManagementService,
@IAdsTelemetryService private readonly adsTelemetryService?: IAdsTelemetryService,
@IExtensionsWorkbenchService protected readonly extensionsWorkbenchService?: IExtensionsWorkbenchService
) {
super(promptedExtensionRecommendations);
// this._recommendations = productService.recommendedExtensionsByScenario.map(r => ({ extensionId: r, reason: { reasonId: ExtensionRecommendationReason.Application, reasonText: localize('defaultRecommendations', "This extension is recommended by Azure Data Studio.") }, source: 'application' }));
super();
}
protected async doActivate(): Promise<void> {
@@ -128,7 +121,7 @@ export class ScenarioRecommendations extends ExtensionRecommendations {
if (!scenarioType) {
return Promise.reject(new Error(localize('scenarioTypeUndefined', 'The scenario type for extension recommendations must be provided.')));
}
return this.promptedExtensionRecommendations.filterIgnoredOrNotAllowed(this.productService.recommendedExtensionsByScenario[scenarioType] || [])
return (this.productService.recommendedExtensionsByScenario[scenarioType] || [])
.map(extensionId => (<IExtensionRecommendation>{ extensionId, sources: ['application'] }));
}
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtensionRecommendations, ExtensionRecommendation, PromptedExtensionRecommendations } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations';
import { ExtensionRecommendations, ExtensionRecommendation } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations';
import { IProductService } from 'vs/platform/product/common/productService';
import { localize } from 'vs/nls';
import { ExtensionRecommendationReason } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
@@ -14,10 +14,9 @@ export class StaticRecommendations extends ExtensionRecommendations {
get recommendations(): ReadonlyArray<ExtensionRecommendation> { return this._recommendations; }
constructor(
promptedExtensionRecommendations?: PromptedExtensionRecommendations,
@IProductService productService?: IProductService
) {
super(promptedExtensionRecommendations);
super();
this._recommendations = productService.recommendedExtensions.map(r => ({ extensionId: r, reason: { reasonId: ExtensionRecommendationReason.Application, reasonText: localize('defaultRecommendations', "This extension is recommended by Azure Data Studio.") }, source: 'application' }));
}