@theia/plugin-utils 1.75.0-next.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/lib/common/constants.d.ts +12 -0
- package/lib/common/constants.d.ts.map +1 -0
- package/lib/common/constants.js +30 -0
- package/lib/common/constants.js.map +1 -0
- package/lib/common/constants.spec.d.ts +2 -0
- package/lib/common/constants.spec.d.ts.map +1 -0
- package/lib/common/constants.spec.js +33 -0
- package/lib/common/constants.spec.js.map +1 -0
- package/lib/common/contribution-types.d.ts +648 -0
- package/lib/common/contribution-types.d.ts.map +1 -0
- package/lib/common/contribution-types.js +30 -0
- package/lib/common/contribution-types.js.map +1 -0
- package/lib/common/manifest-types.d.ts +105 -0
- package/lib/common/manifest-types.d.ts.map +1 -0
- package/lib/common/manifest-types.js +31 -0
- package/lib/common/manifest-types.js.map +1 -0
- package/lib/common/manifest-types.spec.d.ts +2 -0
- package/lib/common/manifest-types.spec.d.ts.map +1 -0
- package/lib/common/manifest-types.spec.js +35 -0
- package/lib/common/manifest-types.spec.js.map +1 -0
- package/lib/common/package-nls.d.ts +24 -0
- package/lib/common/package-nls.d.ts.map +1 -0
- package/lib/common/package-nls.js +82 -0
- package/lib/common/package-nls.js.map +1 -0
- package/lib/common/package-nls.spec.d.ts +2 -0
- package/lib/common/package-nls.spec.d.ts.map +1 -0
- package/lib/common/package-nls.spec.js +98 -0
- package/lib/common/package-nls.spec.js.map +1 -0
- package/lib/common/plugin-activation-events.d.ts +7 -0
- package/lib/common/plugin-activation-events.d.ts.map +1 -0
- package/lib/common/plugin-activation-events.js +95 -0
- package/lib/common/plugin-activation-events.js.map +1 -0
- package/lib/common/plugin-activation-events.spec.d.ts +2 -0
- package/lib/common/plugin-activation-events.spec.d.ts.map +1 -0
- package/lib/common/plugin-activation-events.spec.js +89 -0
- package/lib/common/plugin-activation-events.spec.js.map +1 -0
- package/lib/common/plugin-manifest.d.ts +10 -0
- package/lib/common/plugin-manifest.d.ts.map +1 -0
- package/lib/common/plugin-manifest.js +35 -0
- package/lib/common/plugin-manifest.js.map +1 -0
- package/lib/common/plugin-manifest.spec.d.ts +2 -0
- package/lib/common/plugin-manifest.spec.d.ts.map +1 -0
- package/lib/common/plugin-manifest.spec.js +83 -0
- package/lib/common/plugin-manifest.spec.js.map +1 -0
- package/lib/common/plugin-model.d.ts +33 -0
- package/lib/common/plugin-model.d.ts.map +1 -0
- package/lib/common/plugin-model.js +166 -0
- package/lib/common/plugin-model.js.map +1 -0
- package/lib/common/plugin-model.spec.d.ts +2 -0
- package/lib/common/plugin-model.spec.d.ts.map +1 -0
- package/lib/common/plugin-model.spec.js +204 -0
- package/lib/common/plugin-model.spec.js.map +1 -0
- package/lib/common/protocol-shims.d.ts +128 -0
- package/lib/common/protocol-shims.d.ts.map +1 -0
- package/lib/common/protocol-shims.js +29 -0
- package/lib/common/protocol-shims.js.map +1 -0
- package/lib/common/test-helpers.d.ts +5 -0
- package/lib/common/test-helpers.d.ts.map +1 -0
- package/lib/common/test-helpers.js +41 -0
- package/lib/common/test-helpers.js.map +1 -0
- package/lib/common/utils.d.ts +20 -0
- package/lib/common/utils.d.ts.map +1 -0
- package/lib/common/utils.js +74 -0
- package/lib/common/utils.js.map +1 -0
- package/lib/common/utils.spec.d.ts +2 -0
- package/lib/common/utils.spec.d.ts.map +1 -0
- package/lib/common/utils.spec.js +77 -0
- package/lib/common/utils.spec.js.map +1 -0
- package/lib/node/normalize-contributions.d.ts +54 -0
- package/lib/node/normalize-contributions.d.ts.map +1 -0
- package/lib/node/normalize-contributions.js +985 -0
- package/lib/node/normalize-contributions.js.map +1 -0
- package/lib/node/normalize-contributions.spec.d.ts +2 -0
- package/lib/node/normalize-contributions.spec.d.ts.map +1 -0
- package/lib/node/normalize-contributions.spec.js +850 -0
- package/lib/node/normalize-contributions.spec.js.map +1 -0
- package/lib/node/package-nls.d.ts +3 -0
- package/lib/node/package-nls.d.ts.map +1 -0
- package/lib/node/package-nls.js +45 -0
- package/lib/node/package-nls.js.map +1 -0
- package/lib/node/plugin-manifest.d.ts +6 -0
- package/lib/node/plugin-manifest.d.ts.map +1 -0
- package/lib/node/plugin-manifest.js +26 -0
- package/lib/node/plugin-manifest.js.map +1 -0
- package/lib/node/plugin-model.d.ts +5 -0
- package/lib/node/plugin-model.d.ts.map +1 -0
- package/lib/node/plugin-model.js +36 -0
- package/lib/node/plugin-model.js.map +1 -0
- package/lib/node/read-grammars.d.ts +10 -0
- package/lib/node/read-grammars.d.ts.map +1 -0
- package/lib/node/read-grammars.js +83 -0
- package/lib/node/read-grammars.js.map +1 -0
- package/lib/node/read-grammars.spec.d.ts +2 -0
- package/lib/node/read-grammars.spec.d.ts.map +1 -0
- package/lib/node/read-grammars.spec.js +109 -0
- package/lib/node/read-grammars.spec.js.map +1 -0
- package/package.json +42 -0
- package/src/common/constants.spec.ts +34 -0
- package/src/common/constants.ts +35 -0
- package/src/common/contribution-types.ts +677 -0
- package/src/common/manifest-types.spec.ts +36 -0
- package/src/common/manifest-types.ts +126 -0
- package/src/common/package-nls.spec.ts +122 -0
- package/src/common/package-nls.ts +95 -0
- package/src/common/plugin-activation-events.spec.ts +104 -0
- package/src/common/plugin-activation-events.ts +102 -0
- package/src/common/plugin-manifest.spec.ts +94 -0
- package/src/common/plugin-manifest.ts +44 -0
- package/src/common/plugin-model.spec.ts +246 -0
- package/src/common/plugin-model.ts +194 -0
- package/src/common/protocol-shims.ts +148 -0
- package/src/common/test-helpers.ts +44 -0
- package/src/common/utils.spec.ts +86 -0
- package/src/common/utils.ts +81 -0
- package/src/node/normalize-contributions.spec.ts +931 -0
- package/src/node/normalize-contributions.ts +1098 -0
- package/src/node/package-nls.ts +45 -0
- package/src/node/plugin-manifest.ts +30 -0
- package/src/node/plugin-model.ts +33 -0
- package/src/node/read-grammars.spec.ts +128 -0
- package/src/node/read-grammars.ts +97 -0
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 Maksim Kachurin and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
ColorDefinition,
|
|
19
|
+
IJSONSchema,
|
|
20
|
+
IJSONSchemaSnippet,
|
|
21
|
+
JSONObject,
|
|
22
|
+
PreferenceSchema,
|
|
23
|
+
TaskDefinition,
|
|
24
|
+
} from './protocol-shims';
|
|
25
|
+
import type { PluginManifest } from './manifest-types';
|
|
26
|
+
|
|
27
|
+
export type { JSONObject } from './protocol-shims';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Raw `contributes` section from `package.json` before normalization.
|
|
31
|
+
* Fields that depend on `@theia/core` / `@theia/task` are typed as `unknown` here;
|
|
32
|
+
* `@theia/plugin-ext` overrides them with stricter types.
|
|
33
|
+
*/
|
|
34
|
+
export interface PluginManifestContribution {
|
|
35
|
+
authentication?: PluginPackageAuthenticationProvider[];
|
|
36
|
+
configuration?: JSONObject | JSONObject[];
|
|
37
|
+
configurationDefaults?: JSONObject;
|
|
38
|
+
languages?: PluginPackageLanguageContribution[];
|
|
39
|
+
grammars?: PluginPackageGrammarsContribution[];
|
|
40
|
+
customEditors?: PluginPackageCustomEditor[];
|
|
41
|
+
viewsContainers?: { [location: string]: PluginPackageViewContainer[] };
|
|
42
|
+
views?: { [location: string]: PluginPackageView[] };
|
|
43
|
+
viewsWelcome?: PluginPackageViewWelcome[];
|
|
44
|
+
commands?: PluginPackageCommand | PluginPackageCommand[];
|
|
45
|
+
menus?: { [location: string]: PluginPackageMenu[] };
|
|
46
|
+
submenus?: PluginPackageSubmenu[];
|
|
47
|
+
keybindings?: PluginPackageKeybinding | PluginPackageKeybinding[];
|
|
48
|
+
debuggers?: PluginPackageDebuggersContribution[];
|
|
49
|
+
snippets?: PluginPackageSnippetsContribution[];
|
|
50
|
+
themes?: PluginThemeContribution[];
|
|
51
|
+
iconThemes?: PluginIconThemeContribution[];
|
|
52
|
+
icons?: PluginIconContribution[];
|
|
53
|
+
colors?: PluginColorContribution[];
|
|
54
|
+
taskDefinitions?: PluginTaskDefinitionContribution[];
|
|
55
|
+
problemMatchers?: unknown;
|
|
56
|
+
problemPatterns?: unknown;
|
|
57
|
+
jsonValidation?: PluginJsonValidationContribution[];
|
|
58
|
+
resourceLabelFormatters?: unknown;
|
|
59
|
+
localizations?: PluginPackageLocalization[];
|
|
60
|
+
terminal?: PluginPackageTerminal;
|
|
61
|
+
notebooks?: PluginPackageNotebook[];
|
|
62
|
+
notebookRenderer?: PluginNotebookRendererContribution[];
|
|
63
|
+
notebookPreload?: PluginPackageNotebookPreload[];
|
|
64
|
+
mcpServerDefinitionProviders?: PluginPackageMcpServerDefinitionProviderContribution[];
|
|
65
|
+
languageModelTools?: PluginPackageLanguageModelToolContribution[];
|
|
66
|
+
walkthroughs?: PluginPackageWalkthrough[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface PluginPackageNotebook {
|
|
70
|
+
type: string;
|
|
71
|
+
displayName: string;
|
|
72
|
+
selector?: readonly { filenamePattern?: string; excludeFileNamePattern?: string }[];
|
|
73
|
+
priority?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface PluginNotebookRendererContribution {
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly displayName: string;
|
|
79
|
+
readonly mimeTypes: string[];
|
|
80
|
+
readonly entrypoint: string | { readonly extends: string; readonly path: string };
|
|
81
|
+
readonly requiresMessaging?: 'always' | 'optional' | 'never';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PluginPackageNotebookPreload {
|
|
85
|
+
type: string;
|
|
86
|
+
entrypoint: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface PluginPackageMcpServerDefinitionProviderContribution {
|
|
90
|
+
id: string;
|
|
91
|
+
label: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface PluginPackageLanguageModelToolContribution {
|
|
96
|
+
name: string;
|
|
97
|
+
modelDescription?: string;
|
|
98
|
+
userDescription?: string;
|
|
99
|
+
inputSchema?: object;
|
|
100
|
+
tags?: string[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Media of a walkthrough step as contributed in `package.json`. Only the light and dark variant of an
|
|
105
|
+
* image are mandatory, the high contrast ones were added to the VS Code schema later.
|
|
106
|
+
*/
|
|
107
|
+
export type PluginPackageWalkthroughStepMedia =
|
|
108
|
+
{ markdown: string }
|
|
109
|
+
| { image: string | { dark: string; light: string; hc?: string; hcLight?: string }; altText?: string }
|
|
110
|
+
| { svg: string; altText?: string };
|
|
111
|
+
|
|
112
|
+
export interface PluginPackageWalkthroughStep {
|
|
113
|
+
id: string;
|
|
114
|
+
title: string;
|
|
115
|
+
description: string;
|
|
116
|
+
media?: PluginPackageWalkthroughStepMedia;
|
|
117
|
+
completionEvents?: string[];
|
|
118
|
+
when?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface PluginPackageWalkthrough {
|
|
122
|
+
id: string;
|
|
123
|
+
title: string;
|
|
124
|
+
description: string;
|
|
125
|
+
steps: PluginPackageWalkthroughStep[];
|
|
126
|
+
when?: string;
|
|
127
|
+
icon?: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Media of a walkthrough step with every path resolved and every image variant filled in.
|
|
132
|
+
*/
|
|
133
|
+
export type WalkthroughStepMedia =
|
|
134
|
+
{ markdown: string }
|
|
135
|
+
| { image: string | { dark: string; light: string; hc: string; hcLight: string }; altText?: string }
|
|
136
|
+
| { svg: string; altText?: string };
|
|
137
|
+
|
|
138
|
+
export interface WalkthroughStepContribution {
|
|
139
|
+
id: string;
|
|
140
|
+
title: string;
|
|
141
|
+
description: string;
|
|
142
|
+
media?: WalkthroughStepMedia;
|
|
143
|
+
completionEvents?: string[];
|
|
144
|
+
when?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface WalkthroughContribution {
|
|
148
|
+
id: string;
|
|
149
|
+
title: string;
|
|
150
|
+
description: string;
|
|
151
|
+
steps: WalkthroughStepContribution[];
|
|
152
|
+
when?: string;
|
|
153
|
+
icon?: string;
|
|
154
|
+
pluginId: string;
|
|
155
|
+
/** Icon of the contributing extension, as a backend relative path. */
|
|
156
|
+
pluginIcon?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface PluginPackageAuthenticationProvider {
|
|
160
|
+
id: string;
|
|
161
|
+
label: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface PluginPackageTerminalProfile {
|
|
165
|
+
title: string;
|
|
166
|
+
id: string;
|
|
167
|
+
icon?: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface PluginPackageTerminal {
|
|
171
|
+
profiles: PluginPackageTerminalProfile[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface PluginPackageLocalization {
|
|
175
|
+
languageId: string;
|
|
176
|
+
languageName?: string;
|
|
177
|
+
localizedLanguageName?: string;
|
|
178
|
+
translations: PluginPackageTranslation[];
|
|
179
|
+
minimalTranslations?: { [key: string]: string };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface PluginPackageTranslation {
|
|
183
|
+
id: string;
|
|
184
|
+
path: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface PluginPackageCustomEditor {
|
|
188
|
+
viewType: string;
|
|
189
|
+
displayName: string;
|
|
190
|
+
selector?: CustomEditorSelector[];
|
|
191
|
+
priority?: CustomEditorPriority;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface CustomEditorSelector {
|
|
195
|
+
readonly filenamePattern?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export enum CustomEditorPriority {
|
|
199
|
+
default = 'default',
|
|
200
|
+
builtin = 'builtin',
|
|
201
|
+
option = 'option',
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface PluginPackageViewContainer {
|
|
205
|
+
id: string;
|
|
206
|
+
title: string;
|
|
207
|
+
icon: string;
|
|
208
|
+
when?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export enum PluginViewType {
|
|
212
|
+
Tree = 'tree',
|
|
213
|
+
Webview = 'webview'
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface PluginPackageView {
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
when?: string;
|
|
220
|
+
type?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface PluginPackageViewWelcome {
|
|
224
|
+
view: string;
|
|
225
|
+
contents: string;
|
|
226
|
+
when?: string;
|
|
227
|
+
enablement?: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface PluginPackageCommand {
|
|
231
|
+
command: string;
|
|
232
|
+
title: string;
|
|
233
|
+
shortTitle?: string;
|
|
234
|
+
original?: string;
|
|
235
|
+
category?: string;
|
|
236
|
+
icon?: string | { light: string; dark: string; };
|
|
237
|
+
enablement?: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface PluginPackageMenu {
|
|
241
|
+
command?: string;
|
|
242
|
+
submenu?: string;
|
|
243
|
+
alt?: string;
|
|
244
|
+
group?: string;
|
|
245
|
+
when?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type IconUrl = string | { light: string; dark: string; };
|
|
249
|
+
|
|
250
|
+
export interface PluginPackageSubmenu {
|
|
251
|
+
id: string;
|
|
252
|
+
label: string;
|
|
253
|
+
icon: IconUrl;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface PluginPackageKeybinding {
|
|
257
|
+
key?: string;
|
|
258
|
+
command: string;
|
|
259
|
+
when?: string;
|
|
260
|
+
mac?: string;
|
|
261
|
+
linux?: string;
|
|
262
|
+
win?: string;
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
264
|
+
args?: any;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface PluginPackageGrammarsContribution {
|
|
268
|
+
language?: string;
|
|
269
|
+
scopeName: string;
|
|
270
|
+
path: string;
|
|
271
|
+
embeddedLanguages?: ScopeMap;
|
|
272
|
+
tokenTypes?: ScopeMap;
|
|
273
|
+
injectTo?: string[];
|
|
274
|
+
balancedBracketScopes?: string[];
|
|
275
|
+
unbalancedBracketScopes?: string[];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface ScopeMap {
|
|
279
|
+
[scopeName: string]: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface PluginPackageSnippetsContribution {
|
|
283
|
+
language?: string;
|
|
284
|
+
path?: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface PluginColorContribution {
|
|
288
|
+
id?: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
defaults?: { light?: string, dark?: string, highContrast?: string };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type PluginUiTheme = 'vs' | 'vs-dark' | 'hc-black';
|
|
294
|
+
|
|
295
|
+
export interface PluginThemeContribution {
|
|
296
|
+
id?: string;
|
|
297
|
+
label?: string;
|
|
298
|
+
description?: string;
|
|
299
|
+
path?: string;
|
|
300
|
+
uiTheme?: PluginUiTheme;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface PluginIconThemeContribution {
|
|
304
|
+
id?: string;
|
|
305
|
+
label?: string;
|
|
306
|
+
description?: string;
|
|
307
|
+
path?: string;
|
|
308
|
+
uiTheme?: PluginUiTheme;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export interface PluginIconContribution {
|
|
312
|
+
[id: string]: {
|
|
313
|
+
description: string;
|
|
314
|
+
default: { fontPath: string; fontCharacter: string } | string;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface PlatformSpecificAdapterContribution {
|
|
319
|
+
program?: string;
|
|
320
|
+
args?: string[];
|
|
321
|
+
runtime?: string;
|
|
322
|
+
runtimeArgs?: string[];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface PluginPackageDebuggersContribution extends PlatformSpecificAdapterContribution {
|
|
326
|
+
type: string;
|
|
327
|
+
label?: string;
|
|
328
|
+
languages?: string[];
|
|
329
|
+
enableBreakpointsFor?: { languageIds: string[] };
|
|
330
|
+
configurationAttributes?: { [request: string]: IJSONSchema };
|
|
331
|
+
configurationSnippets?: IJSONSchemaSnippet[];
|
|
332
|
+
variables?: ScopeMap;
|
|
333
|
+
adapterExecutableCommand?: string;
|
|
334
|
+
win?: PlatformSpecificAdapterContribution;
|
|
335
|
+
winx86?: PlatformSpecificAdapterContribution;
|
|
336
|
+
windows?: PlatformSpecificAdapterContribution;
|
|
337
|
+
osx?: PlatformSpecificAdapterContribution;
|
|
338
|
+
linux?: PlatformSpecificAdapterContribution;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface PluginPackageLanguageContribution {
|
|
342
|
+
id: string;
|
|
343
|
+
extensions?: string[];
|
|
344
|
+
filenames?: string[];
|
|
345
|
+
filenamePatterns?: string[];
|
|
346
|
+
firstLine?: string;
|
|
347
|
+
aliases?: string[];
|
|
348
|
+
mimetypes?: string[];
|
|
349
|
+
configuration?: string;
|
|
350
|
+
icon?: IconUrl;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export type CharacterPair = [string, string];
|
|
354
|
+
|
|
355
|
+
export interface LineCommentRule {
|
|
356
|
+
comment: string;
|
|
357
|
+
noIndent?: boolean;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface CommentRule {
|
|
361
|
+
lineComment?: string | LineCommentRule;
|
|
362
|
+
blockComment?: CharacterPair;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export interface RegExpOptions {
|
|
366
|
+
pattern: string;
|
|
367
|
+
flags?: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface PluginPackageLanguageContributionConfiguration {
|
|
371
|
+
comments?: CommentRule;
|
|
372
|
+
brackets?: CharacterPair[];
|
|
373
|
+
autoClosingPairs?: (CharacterPair | AutoClosingPairConditional)[];
|
|
374
|
+
surroundingPairs?: (CharacterPair | AutoClosingPair)[];
|
|
375
|
+
wordPattern?: string;
|
|
376
|
+
indentationRules?: IndentationRules;
|
|
377
|
+
folding?: FoldingRules;
|
|
378
|
+
onEnterRules?: OnEnterRule[];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export interface IndentationRules {
|
|
382
|
+
increaseIndentPattern: string | RegExpOptions;
|
|
383
|
+
decreaseIndentPattern: string | RegExpOptions;
|
|
384
|
+
unIndentedLinePattern?: string | RegExpOptions;
|
|
385
|
+
indentNextLinePattern?: string | RegExpOptions;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface AutoClosingPair {
|
|
389
|
+
close: string;
|
|
390
|
+
open: string;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface AutoClosingPairConditional extends AutoClosingPair {
|
|
394
|
+
notIn?: string[];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface FoldingMarkers {
|
|
398
|
+
start: string | RegExpOptions;
|
|
399
|
+
end: string | RegExpOptions;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface FoldingRules {
|
|
403
|
+
offSide?: boolean;
|
|
404
|
+
markers?: FoldingMarkers;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface OnEnterRule {
|
|
408
|
+
beforeText: string | RegExpOptions;
|
|
409
|
+
afterText?: string | RegExpOptions;
|
|
410
|
+
previousLineText?: string | RegExpOptions;
|
|
411
|
+
action: EnterAction;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface EnterAction {
|
|
415
|
+
indent: 'none' | 'indent' | 'outdent' | 'indentOutdent';
|
|
416
|
+
appendText?: string;
|
|
417
|
+
removeText?: number;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface PluginTaskDefinitionContribution {
|
|
421
|
+
type: string;
|
|
422
|
+
required: string[];
|
|
423
|
+
properties?: IJSONSchema['properties'];
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface PluginJsonValidationContribution {
|
|
427
|
+
fileMatch: string | string[];
|
|
428
|
+
url: string;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
type ConfigurationScopeString = 'machine-overridable' | 'window' | 'resource' | 'language-overridable' | 'application' | 'machine';
|
|
432
|
+
|
|
433
|
+
type EditPresentationTypes = 'multilineText' | 'singleLineText';
|
|
434
|
+
|
|
435
|
+
export interface IConfigurationPropertySchema extends IJSONSchema {
|
|
436
|
+
scope?: ConfigurationScopeString;
|
|
437
|
+
included?: boolean;
|
|
438
|
+
tags?: string[];
|
|
439
|
+
editPresentation?: EditPresentationTypes;
|
|
440
|
+
order?: number;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface IExtensionInfo {
|
|
444
|
+
id: string;
|
|
445
|
+
displayName?: string;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface IConfigurationNode {
|
|
449
|
+
title?: string;
|
|
450
|
+
description?: string;
|
|
451
|
+
properties?: Record<string, IConfigurationPropertySchema>;
|
|
452
|
+
scope?: ConfigurationScopeString;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export interface NormalizeContributionsContext<TPlugin extends PluginManifest = PluginManifest> {
|
|
456
|
+
plugin: TPlugin;
|
|
457
|
+
resolveUrl(relativePath: string): string;
|
|
458
|
+
resolveUri(pck: TPlugin, relativePath: string): string;
|
|
459
|
+
onError(type: string, err: unknown, detail?: unknown): void;
|
|
460
|
+
onWarn(msg: string): void;
|
|
461
|
+
readJsonFile?(filePath: string): Promise<unknown | undefined>;
|
|
462
|
+
readGrammars?(grammars: readonly PluginPackageGrammarsContribution[], pluginPath: string): Promise<GrammarsContribution[] | undefined>;
|
|
463
|
+
readConfiguration?(rawConfiguration: IConfigurationNode, pluginPath: string): PreferenceSchema | undefined;
|
|
464
|
+
readSubmenus?(submenus: readonly RawSubmenu[], plugin: TPlugin): NormalizedSubmenu[];
|
|
465
|
+
readCustomEditors?(customEditors: readonly RawCustomEditor[]): NormalizedCustomEditor[];
|
|
466
|
+
readViewsContainers?(containers: readonly RawViewContainer[], plugin: TPlugin): NormalizedViewContainer[];
|
|
467
|
+
readViews?(views: readonly RawView[]): RawView[];
|
|
468
|
+
readViewsWelcome?(welcome: readonly RawViewWelcome[], views: ViewsByLocation | undefined): NormalizedViewWelcome[];
|
|
469
|
+
readCommand?(command: RawCommand, plugin: TPlugin): NormalizedCommand;
|
|
470
|
+
readMenus?(menus: readonly RawMenu[]): RawMenu[];
|
|
471
|
+
readKeybinding?(keybinding: RawKeybinding): NormalizedKeybinding;
|
|
472
|
+
readDebuggers?(debuggers: readonly RawDebugger[]): RawDebugger[];
|
|
473
|
+
readTaskDefinition?(pluginName: string, definition: RawTaskDefinition): TaskDefinition;
|
|
474
|
+
readSnippets?(plugin: TPlugin): NormalizedSnippet[] | undefined;
|
|
475
|
+
readThemes?(plugin: TPlugin): NormalizedTheme[] | undefined;
|
|
476
|
+
readIcons?(plugin: TPlugin): NormalizedIcon[] | undefined;
|
|
477
|
+
readIconThemes?(plugin: TPlugin): NormalizedIconTheme[] | undefined;
|
|
478
|
+
readColors?(plugin: TPlugin): ColorDefinition[] | undefined;
|
|
479
|
+
readTerminals?(plugin: TPlugin): NormalizedTerminalProfile[] | undefined;
|
|
480
|
+
readLocalizations?(plugin: TPlugin): NormalizedLocalization[] | undefined;
|
|
481
|
+
readWalkthroughs?(plugin: TPlugin): WalkthroughContribution[] | undefined;
|
|
482
|
+
readLocalization?(entry: RawLocalization, pluginPath: string): NormalizedLocalization;
|
|
483
|
+
readTranslation?(entry: RawTranslation, pluginPath: string): NormalizedTranslation;
|
|
484
|
+
readLanguages?(languages: readonly RawLanguage[], plugin: TPlugin): Promise<NormalizedLanguage[] | undefined>;
|
|
485
|
+
transformIconUrl?(plugin: TPlugin, original?: IconUrl): { iconUrl?: IconUrl; themeIcon?: string } | undefined;
|
|
486
|
+
toSchema?(definition: RawTaskDefinition): IJSONSchema;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export type RawCommand = PluginPackageCommand;
|
|
490
|
+
export type RawKeybinding = PluginPackageKeybinding;
|
|
491
|
+
export type RawSubmenu = PluginPackageSubmenu;
|
|
492
|
+
export type RawViewContainer = PluginPackageViewContainer;
|
|
493
|
+
export type RawView = PluginPackageView;
|
|
494
|
+
export type RawViewWelcome = PluginPackageViewWelcome;
|
|
495
|
+
export type RawMenu = PluginPackageMenu;
|
|
496
|
+
export type RawTranslation = PluginPackageTranslation;
|
|
497
|
+
export type RawLocalization = PluginPackageLocalization;
|
|
498
|
+
export type RawCustomEditor = PluginPackageCustomEditor;
|
|
499
|
+
export type RawLanguage = PluginPackageLanguageContribution;
|
|
500
|
+
export type RawDebugger = PluginPackageDebuggersContribution;
|
|
501
|
+
export type RawTaskDefinition = PluginTaskDefinitionContribution;
|
|
502
|
+
export type RawSnippet = PluginPackageSnippetsContribution;
|
|
503
|
+
export type RawTheme = PluginThemeContribution;
|
|
504
|
+
export type RawIconTheme = PluginIconThemeContribution;
|
|
505
|
+
|
|
506
|
+
export interface NormalizedCommand {
|
|
507
|
+
command: string;
|
|
508
|
+
title: string;
|
|
509
|
+
shortTitle?: string;
|
|
510
|
+
originalTitle?: string;
|
|
511
|
+
category?: string;
|
|
512
|
+
iconUrl?: IconUrl;
|
|
513
|
+
themeIcon?: string;
|
|
514
|
+
enablement?: string;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface NormalizedKeybinding {
|
|
518
|
+
keybinding?: string;
|
|
519
|
+
command: string;
|
|
520
|
+
when?: string;
|
|
521
|
+
mac?: string;
|
|
522
|
+
linux?: string;
|
|
523
|
+
win?: string;
|
|
524
|
+
args?: unknown;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export interface NormalizedSubmenu {
|
|
528
|
+
id: string;
|
|
529
|
+
label: string;
|
|
530
|
+
icon?: IconUrl | string;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export interface NormalizedViewContainer {
|
|
534
|
+
id: string;
|
|
535
|
+
title: string;
|
|
536
|
+
iconUrl: string;
|
|
537
|
+
themeIcon?: string;
|
|
538
|
+
when?: string;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export interface NormalizedViewWelcome {
|
|
542
|
+
view: string;
|
|
543
|
+
content: string;
|
|
544
|
+
when?: string;
|
|
545
|
+
enablement?: string;
|
|
546
|
+
order: number;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export type ViewsByLocation = Record<string, readonly RawView[]>;
|
|
550
|
+
|
|
551
|
+
export interface NormalizedCustomEditor {
|
|
552
|
+
viewType: string;
|
|
553
|
+
displayName: string;
|
|
554
|
+
selector: CustomEditorSelector[];
|
|
555
|
+
priority: CustomEditorPriority;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface NormalizedLocalization {
|
|
559
|
+
languageId: string;
|
|
560
|
+
languageName?: string;
|
|
561
|
+
localizedLanguageName?: string;
|
|
562
|
+
translations: NormalizedTranslation[];
|
|
563
|
+
minimalTranslations?: { [key: string]: string };
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export interface NormalizedTranslation {
|
|
567
|
+
id: string;
|
|
568
|
+
path: string;
|
|
569
|
+
cachedContents?: { [scope: string]: { [key: string]: string } };
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export interface NormalizedLanguageConfiguration {
|
|
573
|
+
brackets?: CharacterPair[];
|
|
574
|
+
indentationRules?: IndentationRules;
|
|
575
|
+
surroundingPairs?: AutoClosingPair[];
|
|
576
|
+
autoClosingPairs?: AutoClosingPairConditional[];
|
|
577
|
+
comments?: CommentRule;
|
|
578
|
+
folding?: FoldingRules;
|
|
579
|
+
wordPattern?: string | RegExpOptions;
|
|
580
|
+
onEnterRules?: OnEnterRule[];
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export interface NormalizedLanguage {
|
|
584
|
+
id: string;
|
|
585
|
+
aliases?: string[];
|
|
586
|
+
extensions?: string[];
|
|
587
|
+
filenamePatterns?: string[];
|
|
588
|
+
filenames?: string[];
|
|
589
|
+
firstLine?: string;
|
|
590
|
+
mimetypes?: string[];
|
|
591
|
+
icon?: IconUrl;
|
|
592
|
+
configuration?: NormalizedLanguageConfiguration;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export interface NormalizedSnippet {
|
|
596
|
+
language?: string;
|
|
597
|
+
source: string;
|
|
598
|
+
uri: string;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export interface NormalizedTheme {
|
|
602
|
+
id?: string;
|
|
603
|
+
uri: string;
|
|
604
|
+
description?: string;
|
|
605
|
+
label?: string;
|
|
606
|
+
uiTheme?: PluginUiTheme;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export interface NormalizedIconTheme {
|
|
610
|
+
id: string;
|
|
611
|
+
uri: string;
|
|
612
|
+
description?: string;
|
|
613
|
+
label?: string;
|
|
614
|
+
uiTheme?: PluginUiTheme;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export interface NormalizedIcon {
|
|
618
|
+
id: string;
|
|
619
|
+
extensionId: string;
|
|
620
|
+
description: string | undefined;
|
|
621
|
+
defaults: { id: string; color?: { id: string } } | { fontCharacter: string; location: string };
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export interface NormalizedTerminalProfile {
|
|
625
|
+
id: string;
|
|
626
|
+
title: string;
|
|
627
|
+
icon?: string;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export interface GrammarsContribution {
|
|
631
|
+
language?: string;
|
|
632
|
+
scope: string;
|
|
633
|
+
format: 'json' | 'plist';
|
|
634
|
+
grammar?: string | object;
|
|
635
|
+
grammarLocation?: string;
|
|
636
|
+
injectTo?: string[];
|
|
637
|
+
embeddedLanguages?: ScopeMap;
|
|
638
|
+
tokenTypes?: ScopeMap;
|
|
639
|
+
balancedBracketScopes?: string[];
|
|
640
|
+
unbalancedBracketScopes?: string[];
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Output of {@link normalizeContributions}, plus optional `activationEvents`
|
|
645
|
+
*/
|
|
646
|
+
export interface NormalizedPluginContribution {
|
|
647
|
+
activationEvents?: string[];
|
|
648
|
+
authentication?: PluginPackageAuthenticationProvider[];
|
|
649
|
+
configuration?: PreferenceSchema[];
|
|
650
|
+
configurationDefaults?: JSONObject;
|
|
651
|
+
languages?: NormalizedLanguage[];
|
|
652
|
+
grammars?: GrammarsContribution[];
|
|
653
|
+
customEditors?: NormalizedCustomEditor[];
|
|
654
|
+
viewsContainers?: { [location: string]: NormalizedViewContainer[] };
|
|
655
|
+
views?: { [location: string]: PluginPackageView[] };
|
|
656
|
+
viewsWelcome?: NormalizedViewWelcome[];
|
|
657
|
+
commands?: NormalizedCommand[];
|
|
658
|
+
menus?: { [location: string]: PluginPackageMenu[] };
|
|
659
|
+
submenus?: NormalizedSubmenu[];
|
|
660
|
+
keybindings?: NormalizedKeybinding[];
|
|
661
|
+
debuggers?: PluginPackageDebuggersContribution[];
|
|
662
|
+
snippets?: NormalizedSnippet[];
|
|
663
|
+
themes?: NormalizedTheme[];
|
|
664
|
+
iconThemes?: NormalizedIconTheme[];
|
|
665
|
+
icons?: NormalizedIcon[];
|
|
666
|
+
colors?: ColorDefinition[];
|
|
667
|
+
taskDefinitions?: TaskDefinition[];
|
|
668
|
+
problemMatchers?: unknown;
|
|
669
|
+
problemPatterns?: unknown;
|
|
670
|
+
resourceLabelFormatters?: unknown;
|
|
671
|
+
localizations?: NormalizedLocalization[];
|
|
672
|
+
terminalProfiles?: NormalizedTerminalProfile[];
|
|
673
|
+
notebooks?: PluginPackageNotebook[];
|
|
674
|
+
notebookRenderer?: PluginNotebookRendererContribution[];
|
|
675
|
+
notebookPreload?: PluginPackageNotebookPreload[];
|
|
676
|
+
walkthroughs?: WalkthroughContribution[];
|
|
677
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 Maksim Kachurin and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import { rawContributes } from './manifest-types';
|
|
19
|
+
|
|
20
|
+
describe('manifest-types', () => {
|
|
21
|
+
|
|
22
|
+
describe('rawContributes', () => {
|
|
23
|
+
it('returns contributes object when present', () => {
|
|
24
|
+
const contributes = { commands: [{ command: 'x', title: 'X' }] };
|
|
25
|
+
expect(rawContributes({ contributes })).to.equal(contributes);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns empty object when contributes is missing or invalid', () => {
|
|
29
|
+
expect(rawContributes({})).to.deep.equal({});
|
|
30
|
+
// eslint-disable-next-line no-null/no-null
|
|
31
|
+
expect(rawContributes({ contributes: null as unknown as undefined })).to.deep.equal({});
|
|
32
|
+
expect(rawContributes({ contributes: undefined as unknown as undefined })).to.deep.equal({});
|
|
33
|
+
expect(rawContributes({ contributes: 'invalid' as unknown as undefined })).to.deep.equal({});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|