Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/extensionRecommendations/common/extensionRecommendationsIpc.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 { Event } from '../../../base/common/event.js';
7
import { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';
8
import { IExtensionRecommendationNotificationService, IExtensionRecommendations, RecommendationsNotificationResult } from './extensionRecommendations.js';
9
10
export class ExtensionRecommendationNotificationServiceChannelClient implements IExtensionRecommendationNotificationService {
11
12
declare readonly _serviceBrand: undefined;
13
14
constructor(private readonly channel: IChannel) { }
15
16
get ignoredRecommendations(): string[] { throw new Error('not supported'); }
17
18
promptImportantExtensionsInstallNotification(extensionRecommendations: IExtensionRecommendations): Promise<RecommendationsNotificationResult> {
19
return this.channel.call('promptImportantExtensionsInstallNotification', [extensionRecommendations]);
20
}
21
22
promptWorkspaceRecommendations(recommendations: string[]): Promise<void> {
23
throw new Error('not supported');
24
}
25
26
hasToIgnoreRecommendationNotifications(): boolean {
27
throw new Error('not supported');
28
}
29
30
}
31
32
export class ExtensionRecommendationNotificationServiceChannel implements IServerChannel {
33
34
constructor(private service: IExtensionRecommendationNotificationService) { }
35
36
listen(_: unknown, event: string): Event<any> {
37
throw new Error(`Event not found: ${event}`);
38
}
39
40
call(_: unknown, command: string, args?: any): Promise<any> {
41
switch (command) {
42
case 'promptImportantExtensionsInstallNotification': return this.service.promptImportantExtensionsInstallNotification(args[0]);
43
}
44
45
throw new Error(`Call not found: ${command}`);
46
}
47
}
48
49