Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.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, GalleryExtensionRecommendation } from './extensionRecommendations.js';
7
import { IProductService } from '../../../../platform/product/common/productService.js';
8
import { ExtensionRecommendationReason } from '../../../services/extensionRecommendations/common/extensionRecommendations.js';
9
import { PlatformToString, platform } from '../../../../base/common/platform.js';
10
11
export class RemoteRecommendations extends ExtensionRecommendations {
12
13
private _recommendations: GalleryExtensionRecommendation[] = [];
14
get recommendations(): ReadonlyArray<GalleryExtensionRecommendation> { return this._recommendations; }
15
16
constructor(
17
@IProductService private readonly productService: IProductService,
18
) {
19
super();
20
}
21
22
protected async doActivate(): Promise<void> {
23
const extensionTips = { ...this.productService.remoteExtensionTips, ...this.productService.virtualWorkspaceExtensionTips };
24
const currentPlatform = PlatformToString(platform);
25
this._recommendations = Object.values(extensionTips).filter(({ supportedPlatforms }) => !supportedPlatforms || supportedPlatforms.includes(currentPlatform)).map(extension => ({
26
extension: extension.extensionId.toLowerCase(),
27
reason: {
28
reasonId: ExtensionRecommendationReason.Application,
29
reasonText: ''
30
}
31
}));
32
}
33
}
34
35
36