Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/extensionRecommendations/common/extensionRecommendationsIpc.ts
5284 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
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37
listen(_: unknown, event: string): Event<any> {
38
throw new Error(`Event not found: ${event}`);
39
}
40
41
// eslint-disable-next-line @typescript-eslint/no-explicit-any
42
call(_: unknown, command: string, args?: any): Promise<any> {
43
switch (command) {
44
case 'promptImportantExtensionsInstallNotification': return this.service.promptImportantExtensionsInstallNotification(args[0]);
45
}
46
47
throw new Error(`Call not found: ${command}`);
48
}
49
}
50
51