Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/extensionRecommendations/common/extensionRecommendations.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 { URI } from '../../../base/common/uri.js';
7
import { createDecorator } from '../../instantiation/common/instantiation.js';
8
9
export const enum RecommendationSource {
10
FILE = 1,
11
WORKSPACE = 2,
12
EXE = 3
13
}
14
15
export interface IExtensionRecommendations {
16
source: RecommendationSource;
17
extensions: string[];
18
name: string;
19
searchValue?: string;
20
}
21
22
export function RecommendationSourceToString(source: RecommendationSource) {
23
switch (source) {
24
case RecommendationSource.FILE: return 'file';
25
case RecommendationSource.WORKSPACE: return 'workspace';
26
case RecommendationSource.EXE: return 'exe';
27
}
28
}
29
30
export const enum RecommendationsNotificationResult {
31
Ignored = 'ignored',
32
Cancelled = 'cancelled',
33
TooMany = 'toomany',
34
IncompatibleWindow = 'incompatibleWindow',
35
Accepted = 'reacted',
36
}
37
38
export const IExtensionRecommendationNotificationService = createDecorator<IExtensionRecommendationNotificationService>('IExtensionRecommendationNotificationService');
39
40
export interface IExtensionRecommendationNotificationService {
41
readonly _serviceBrand: undefined;
42
43
readonly ignoredRecommendations: string[];
44
hasToIgnoreRecommendationNotifications(): boolean;
45
46
promptImportantExtensionsInstallNotification(recommendations: IExtensionRecommendations): Promise<RecommendationsNotificationResult>;
47
promptWorkspaceRecommendations(recommendations: Array<string | URI>): Promise<void>;
48
}
49
50
51