1
>
/*---------------------------------------------------------------------------------------------
extensions.ts
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 Severity from '../../../base/common/severity.js';
7
>
import * as strings from '../../../base/common/strings.js';
8
>
import { URI } from '../../../base/common/uri.js';
9
>
import { ILocalizedString } from '../../action/common/action.js';
10
>
import { ExtensionKind } from '../../environment/common/environment.js';
11
>
import { createDecorator } from '../../instantiation/common/instantiation.js';
12
>
import { getRemoteName } from '../../remote/common/remoteHosts.js';
13
>
14
>
export const USER_MANIFEST_CACHE_FILE = 'extensions.user.cache';
15
>
export const BUILTIN_MANIFEST_CACHE_FILE = 'extensions.builtin.cache';
16
>
export const UNDEFINED_PUBLISHER = 'undefined_publisher';
17
>
18
>
export interface ICommand {
19
>
command: string;
20
>
title: string | ILocalizedString;
21
>
category?: string | ILocalizedString;
22
>
}
23
>
24
>
export interface IDebugger {
25
>
label?: string;
26
>
type: string;
27
>
runtime?: string;
28
>
}
29
>
30
>
export interface IGrammar {
31
>
language?: string;
32
>
}
33
>
34
>
export interface IJSONValidation {
35
>
fileMatch: string | string[];
36
>
url: string;
37
>
}
38
>
39
>
export interface IJSONValidationRegistry {
40
>
url: string;
41
>
}
42
>
43
>
export interface IKeyBinding {
44
>
command: string;
45
>
key: string;
46
>
when?: string;
47
>
mac?: string;
48
>
linux?: string;
49
>
win?: string;
50
>
}
51
>
52
>
export interface ILanguage {
53
>
id: string;
54
>
extensions: string[];
55
>
aliases: string[];
56
>
}
57
>
58
>
export interface IMenu {
59
>
command: string;
60
>
alt?: string;
61
>
when?: string;
62
>
group?: string;
63
>
}
64
>
65
>
export interface ISnippet {
66
>
language: string;
67
>
}
68
>
69
>
export interface ITheme {
70
>
label: string;
71
>
}
72
>
73
>
export interface IViewContainer {
74
>
id: string;
75
>
title: string;
76
>
}
77
>
78
>
export interface IView {
79
>
id: string;
80
>
name: string;
81
>
}
82
>
83
>
export interface IColor {
84
>
id: string;
85
>
description: string;
86
>
defaults: { light: string; dark: string; highContrast: string };
87
>
}
88
>
89
>
interface IWebviewEditor {
90
>
readonly viewType: string;
91
>
readonly priority: string;
92
>
readonly selector: readonly {
93
>
readonly filenamePattern?: string;
94
>
}[];
95
>
}
96
>
97
>
export interface ICodeActionContributionAction {
98
>
readonly kind: string;
99
>
readonly title: string;
100
>
readonly description?: string;
101
>
}
102
>
103
>
export interface ICodeActionContribution {
104
>
readonly languages: readonly string[];
105
>
readonly actions: readonly ICodeActionContributionAction[];
106
>
}
107
>
108
>
export interface IAuthenticationContribution {
109
>
readonly id: string;
110
>
readonly label: string;
111
>
readonly authorizationServerGlobs?: string[];
112
>
}
113
>
114
>
export interface IWalkthroughStep {
115
>
readonly id: string;
116
>
readonly title: string;
117
>
readonly description: string | undefined;
118
>
readonly media:
119
>
| { image: string | { dark: string; light: string; hc: string }; altText: string; markdown?: never; svg?: never; video?: never }
120
>
| { markdown: string; image?: never; svg?: never; video?: never }
121
>
| { svg: string; altText: string; markdown?: never; image?: never; video?: never }
122
>
| { video: string | { dark: string; light: string; hc: string }; poster: string | { dark: string; light: string; hc: string }; altText: string; markdown?: never; image?: never; svg?: never };
123
>
readonly completionEvents?: string[];
124
>
/** @deprecated use `completionEvents: 'onCommand:...'` */
125
>
readonly doneOn?: { command: string };
126
>
readonly when?: string;
127
>
}
128
>
129
>
export interface IWalkthrough {
130
>
readonly id: string;
131
>
readonly title: string;
132
>
readonly icon?: string;
133
>
readonly description: string;
134
>
readonly steps: IWalkthroughStep[];
135
>
readonly featuredFor: string[] | undefined;
136
>
readonly when?: string;
137
>
}
138
>
139
>
export interface IStartEntry {
140
>
readonly title: string;
141
>
readonly description: string;
142
>
readonly command: string;
143
>
readonly when?: string;
144
>
readonly category: 'file' | 'folder' | 'notebook';
145
>
}
146
>
147
>
export interface INotebookEntry {
148
>
readonly type: string;
149
>
readonly displayName: string;
150
>
}
151
>
152
>
export interface INotebookRendererContribution {
153
>
readonly id: string;
154
>
readonly displayName: string;
155
>
readonly mimeTypes: string[];
156
>
}
157
>
158
>
export interface IDebugVisualizationContribution {
159
>
readonly id: string;
160
>
readonly when: string;
161
>
}
162
>
163
>
export interface ITranslation {
164
>
id: string;
165
>
path: string;
166
>
}
167
>
168
>
export interface ILocalizationContribution {
169
>
languageId: string;
170
>
languageName?: string;
171
>
localizedLanguageName?: string;
172
>
translations: ITranslation[];
173
>
minimalTranslations?: { [key: string]: string };
174
>
}
175
>
176
>
export interface IChatParticipantContribution {
177
>
id: string;
178
>
name: string;
179
>
fullName: string;
180
>
description?: string;
181
>
isDefault?: boolean;
182
>
commands?: { name: string }[];
183
>
}
184
>
185
>
export interface IToolContribution {
186
>
name: string;
187
>
displayName: string;
188
>
modelDescription: string;
189
>
userDescription?: string;
190
>
}
191
>
192
>
export interface IToolSetContribution {
193
>
name: string;
194
>
referenceName: string;
195
>
description: string;
196
>
icon?: string;
197
>
tools: string[];
198
>
}
199
>
200
>
export interface IMcpCollectionContribution {
201
>
readonly id: string;
202
>
readonly label: string;
203
>
readonly when?: string;
204
>
}
205
>
206
>
export interface IChatFileContribution {
207
>
readonly path: string;
208
>
readonly name?: string;
209
>
readonly description?: string;
210
>
readonly when?: string;
211
>
readonly sessionTypes?: readonly string[];
212
>
}
213
>
214
>
export interface IExtensionContributions {
215
>
commands?: ICommand[];
216
>
configuration?: any;
217
>
configurationDefaults?: any;
218
>
debuggers?: IDebugger[];
219
>
grammars?: IGrammar[];
220
>
jsonValidation?: IJSONValidation[];
221
>
jsonValidationRegistry?: IJSONValidationRegistry[];
222
>
keybindings?: IKeyBinding[];
223
>
languages?: ILanguage[];
224
>
menus?: { [context: string]: IMenu[] };
225
>
snippets?: ISnippet[];
226
>
themes?: ITheme[];
227
>
iconThemes?: ITheme[];
228
>
productIconThemes?: ITheme[];
229
>
viewsContainers?: { [location: string]: IViewContainer[] };
230
>
views?: { [location: string]: IView[] };
231
>
colors?: IColor[];
232
>
localizations?: ILocalizationContribution[];
233
>
readonly customEditors?: readonly IWebviewEditor[];
234
>
readonly codeActions?: readonly ICodeActionContribution[];
235
>
authentication?: IAuthenticationContribution[];
236
>
walkthroughs?: IWalkthrough[];
237
>
startEntries?: IStartEntry[];
238
>
readonly notebooks?: INotebookEntry[];
239
>
readonly notebookRenderer?: INotebookRendererContribution[];
240
>
readonly debugVisualizers?: IDebugVisualizationContribution[];
241
>
readonly chatParticipants?: ReadonlyArray<IChatParticipantContribution>;
242
>
readonly chatPromptFiles?: ReadonlyArray<IChatFileContribution>;
243
>
readonly chatInstructions?: ReadonlyArray<IChatFileContribution>;
244
>
readonly chatAgents?: ReadonlyArray<IChatFileContribution>;
245
>
readonly chatSkills?: ReadonlyArray<IChatFileContribution>;
246
>
readonly chatPlugins?: ReadonlyArray<IChatFileContribution>;
247
>
readonly languageModelTools?: ReadonlyArray<IToolContribution>;
248
>
readonly languageModelToolSets?: ReadonlyArray<IToolSetContribution>;
249
>
readonly mcpServerDefinitionProviders?: ReadonlyArray<IMcpCollectionContribution>;
250
>
}
251
>
252
>
export interface IExtensionCapabilities {
253
>
readonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;
254
>
readonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;
255
>
}
256
>
257
>
258
>
export const ALL_EXTENSION_KINDS: readonly ExtensionKind[] = ['ui', 'workspace', 'web'];
259
>
260
>
export type LimitedWorkspaceSupportType = 'limited';
261
>
export type ExtensionUntrustedWorkspaceSupportType = boolean | LimitedWorkspaceSupportType;
262
>
export type ExtensionUntrustedWorkspaceSupport = { supported: true } | { supported: false; description: string } | { supported: LimitedWorkspaceSupportType; description: string; restrictedConfigurations?: string[] };
263
>
264
>
export type ExtensionVirtualWorkspaceSupportType = boolean | LimitedWorkspaceSupportType;
265
>
export type ExtensionVirtualWorkspaceSupport = boolean | { supported: true } | { supported: false | LimitedWorkspaceSupportType; description: string };
266
>
267
>
export function getWorkspaceSupportTypeMessage(supportType: ExtensionUntrustedWorkspaceSupport | ExtensionVirtualWorkspaceSupport | undefined): string | undefined {
268
if (typeof supportType === 'object' && supportType !== null) {
269
if (supportType.supported !== true) {