Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/extensions/browser/webRecommendations.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ExtensionRecommendations, ExtensionRecommendation } from './extensionRecommendations.js';
7
import { IProductService } from '../../../../platform/product/common/productService.js';
8
import { ExtensionRecommendationReason } from '../../../services/extensionRecommendations/common/extensionRecommendations.js';
9
import { localize } from '../../../../nls.js';
10
import { IExtensionManagementServerService } from '../../../services/extensionManagement/common/extensionManagement.js';
11
12
export class WebRecommendations extends ExtensionRecommendations {
13
14
private _recommendations: ExtensionRecommendation[] = [];
15
get recommendations(): ReadonlyArray<ExtensionRecommendation> { return this._recommendations; }
16
17
constructor(
18
@IProductService private readonly productService: IProductService,
19
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
20
) {
21
super();
22
}
23
24
protected async doActivate(): Promise<void> {
25
const isOnlyWeb = this.extensionManagementServerService.webExtensionManagementServer && !this.extensionManagementServerService.localExtensionManagementServer && !this.extensionManagementServerService.remoteExtensionManagementServer;
26
if (isOnlyWeb && Array.isArray(this.productService.webExtensionTips)) {
27
this._recommendations = this.productService.webExtensionTips.map((extensionId): ExtensionRecommendation => ({
28
extension: extensionId.toLowerCase(),
29
reason: {
30
reasonId: ExtensionRecommendationReason.Application,
31
reasonText: localize('reason', "This extension is recommended for {0} for the Web", this.productService.nameLong)
32
}
33
}));
34
}
35
}
36
}
37
38
39