@theia/plugin-ext 1.75.0-next.25 → 1.75.0-next.29

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.
Files changed (73) hide show
  1. package/lib/common/errors.d.ts +1 -14
  2. package/lib/common/errors.d.ts.map +1 -1
  3. package/lib/common/errors.js +3 -16
  4. package/lib/common/errors.js.map +1 -1
  5. package/lib/common/plugin-protocol.d.ts +44 -719
  6. package/lib/common/plugin-protocol.d.ts.map +1 -1
  7. package/lib/common/plugin-protocol.js +11 -34
  8. package/lib/common/plugin-protocol.js.map +1 -1
  9. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  10. package/lib/hosted/browser/worker/plugin-manifest-loader.js +5 -36
  11. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  12. package/lib/hosted/browser/worker/worker-main.js +2 -1
  13. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  14. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  15. package/lib/hosted/node/hosted-plugin-localization-service.js +4 -68
  16. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  17. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  18. package/lib/hosted/node/plugin-host-rpc.js +2 -2
  19. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  20. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  21. package/lib/hosted/node/plugin-reader.js +4 -3
  22. package/lib/hosted/node/plugin-reader.js.map +1 -1
  23. package/lib/hosted/node/scanners/grammars-reader.d.ts +3 -2
  24. package/lib/hosted/node/scanners/grammars-reader.d.ts.map +1 -1
  25. package/lib/hosted/node/scanners/grammars-reader.js +5 -23
  26. package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
  27. package/lib/hosted/node/scanners/scanner-theia.d.ts +37 -72
  28. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  29. package/lib/hosted/node/scanners/scanner-theia.js +114 -854
  30. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  31. package/lib/hosted/node/scanners/scanner-theia.spec.js +4 -4
  32. package/lib/hosted/node/scanners/scanner-theia.spec.js.map +1 -1
  33. package/lib/main/browser/plugin-contribution-handler.js +1 -1
  34. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  35. package/lib/main/browser/plugin-icon-service.d.ts.map +1 -1
  36. package/lib/main/browser/plugin-icon-service.js +2 -1
  37. package/lib/main/browser/plugin-icon-service.js.map +1 -1
  38. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  39. package/lib/main/browser/plugin-icon-theme-service.js +2 -1
  40. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  41. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  42. package/lib/main/browser/plugin-shared-style.js +2 -1
  43. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  44. package/package.json +31 -30
  45. package/src/common/errors.ts +1 -25
  46. package/src/common/plugin-protocol.ts +194 -719
  47. package/src/hosted/browser/worker/plugin-manifest-loader.ts +8 -41
  48. package/src/hosted/browser/worker/worker-main.ts +2 -1
  49. package/src/hosted/node/hosted-plugin-localization-service.ts +3 -82
  50. package/src/hosted/node/plugin-host-rpc.ts +3 -3
  51. package/src/hosted/node/plugin-reader.ts +4 -3
  52. package/src/hosted/node/scanners/grammars-reader.ts +14 -23
  53. package/src/hosted/node/scanners/scanner-theia.spec.ts +4 -4
  54. package/src/hosted/node/scanners/scanner-theia.ts +200 -972
  55. package/src/main/browser/plugin-contribution-handler.ts +1 -1
  56. package/src/main/browser/plugin-icon-service.ts +2 -1
  57. package/src/main/browser/plugin-icon-theme-service.ts +2 -1
  58. package/src/main/browser/plugin-shared-style.ts +2 -1
  59. package/lib/hosted/node/plugin-activation-events.d.ts +0 -7
  60. package/lib/hosted/node/plugin-activation-events.d.ts.map +0 -1
  61. package/lib/hosted/node/plugin-activation-events.js +0 -95
  62. package/lib/hosted/node/plugin-activation-events.js.map +0 -1
  63. package/lib/hosted/node/plugin-manifest-loader.d.ts +0 -3
  64. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +0 -1
  65. package/lib/hosted/node/plugin-manifest-loader.js +0 -34
  66. package/lib/hosted/node/plugin-manifest-loader.js.map +0 -1
  67. package/lib/main/node/errors.spec.d.ts +0 -2
  68. package/lib/main/node/errors.spec.d.ts.map +0 -1
  69. package/lib/main/node/errors.spec.js +0 -36
  70. package/lib/main/node/errors.spec.js.map +0 -1
  71. package/src/hosted/node/plugin-activation-events.ts +0 -112
  72. package/src/hosted/node/plugin-manifest-loader.ts +0 -32
  73. package/src/main/node/errors.spec.ts +0 -37
@@ -17,17 +17,113 @@ import { RpcServer } from '@theia/core/lib/common/messaging/proxy-factory';
17
17
  import { RPCProtocol } from './rpc-protocol';
18
18
  import { Disposable } from '@theia/core/lib/common/disposable';
19
19
  import { LogPart, KeysToAnyValues, KeysToKeysToAnyValue } from './types';
20
- import { CharacterPair, CommentRule, PluginAPIFactory, Plugin, ThemeIcon } from './plugin-api-rpc';
20
+ import { PluginAPIFactory, Plugin } from './plugin-api-rpc';
21
21
  import { ExtPluginApi } from './plugin-ext-api-contribution';
22
- import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
23
22
  import { ProblemMatcherContribution, ProblemPatternContribution, TaskDefinition } from '@theia/task/lib/common';
24
23
  import { ColorDefinition } from '@theia/core/lib/common/color';
25
24
  import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
26
- import { PluginIdentifiers } from './plugin-identifiers';
27
- import { JSONObject } from '@theia/core/shared/@lumino/coreutils';
28
25
  import { PreferenceSchema } from '@theia/core';
26
+ import { PluginIdentifiers } from './plugin-identifiers';
27
+ import {
28
+ getPluginId,
29
+ toPluginUrl as toPluginUrlFromUtils
30
+ } from '@theia/plugin-utils/lib/common/plugin-model';
31
+ import {
32
+ PLUGIN_HOST_BACKEND,
33
+ PluginEntryPoint,
34
+ PluginLifecycle,
35
+ PluginManifest,
36
+ PluginMetadata,
37
+ PluginModel,
38
+ PluginPackageCapabilities,
39
+ PluginType,
40
+ DeployedPlugin as DeployedPluginBase,
41
+ } from '@theia/plugin-utils/lib/common/manifest-types';
42
+ import {
43
+ AutoClosingPair,
44
+ AutoClosingPairConditional,
45
+ CustomEditorPriority,
46
+ CustomEditorSelector,
47
+ EnterAction,
48
+ FoldingMarkers,
49
+ FoldingRules,
50
+ IndentationRules,
51
+ OnEnterRule,
52
+ PluginColorContribution,
53
+ PluginIconContribution,
54
+ PluginIconThemeContribution,
55
+ PluginJsonValidationContribution,
56
+ PluginManifestContribution,
57
+ PluginNotebookRendererContribution,
58
+ PluginPackageAuthenticationProvider,
59
+ PluginPackageCommand,
60
+ PluginPackageCustomEditor,
61
+ PluginPackageDebuggersContribution,
62
+ PluginPackageGrammarsContribution,
63
+ PluginPackageKeybinding,
64
+ PluginPackageLanguageContribution,
65
+ PluginPackageLanguageContributionConfiguration,
66
+ PluginPackageLanguageModelToolContribution,
67
+ PluginPackageLocalization,
68
+ PluginPackageMcpServerDefinitionProviderContribution,
69
+ PluginPackageMenu,
70
+ PluginPackageNotebook,
71
+ PluginPackageNotebookPreload,
72
+ PluginPackageSnippetsContribution,
73
+ PluginPackageSubmenu,
74
+ PluginPackageTerminal,
75
+ PluginPackageTerminalProfile,
76
+ PluginPackageTranslation,
77
+ PluginPackageView,
78
+ PluginPackageViewContainer,
79
+ PluginPackageViewWelcome,
80
+ PluginPackageWalkthrough,
81
+ PluginPackageWalkthroughStep,
82
+ PluginPackageWalkthroughStepMedia,
83
+ PluginTaskDefinitionContribution,
84
+ PluginThemeContribution,
85
+ PluginUiTheme,
86
+ PluginViewType,
87
+ PlatformSpecificAdapterContribution,
88
+ RegExpOptions,
89
+ ScopeMap,
90
+ type GrammarsContribution,
91
+ type IconUrl,
92
+ type JSONObject,
93
+ type NormalizedCommand,
94
+ type NormalizedCustomEditor,
95
+ type NormalizedIcon,
96
+ type NormalizedIconTheme,
97
+ type NormalizedKeybinding,
98
+ type NormalizedLanguage,
99
+ type NormalizedLanguageConfiguration,
100
+ type NormalizedLocalization,
101
+ type NormalizedPluginContribution,
102
+ type NormalizedSnippet,
103
+ type NormalizedSubmenu,
104
+ type NormalizedTerminalProfile,
105
+ type NormalizedTheme,
106
+ type NormalizedTranslation,
107
+ type NormalizedViewContainer,
108
+ type NormalizedViewWelcome,
109
+ type WalkthroughContribution,
110
+ type WalkthroughStepContribution,
111
+ type WalkthroughStepMedia,
112
+ } from '@theia/plugin-utils/lib/common/contribution-types';
29
113
 
30
114
  export { PluginIdentifiers };
115
+ export { getPluginId };
116
+ export { toPluginUrlFromUtils as toPluginUrl };
117
+ export {
118
+ PLUGIN_HOST_BACKEND,
119
+ PluginEntryPoint,
120
+ PluginLifecycle,
121
+ PluginManifest,
122
+ PluginModel,
123
+ PluginPackageCapabilities,
124
+ PluginMetadata,
125
+ PluginType
126
+ };
31
127
  export const hostedServicePath = '/services/hostedPlugin';
32
128
 
33
129
  /**
@@ -36,359 +132,85 @@ export const hostedServicePath = '/services/hostedPlugin';
36
132
  export type PluginEngine = string;
37
133
 
38
134
  /**
39
- * This interface describes a package.json object.
135
+ * Loaded plugin package with stricter fields used by `@theia/plugin-ext`.
40
136
  */
41
- export interface PluginPackage {
42
- name: string;
137
+ export interface PluginPackage extends PluginManifest {
43
138
  // The publisher is not guaranteed to be defined for unpublished plugins. https://github.com/microsoft/vscode-vsce/commit/a38657ece04c20e4fbde15d5ac1ed39ca51cb856
44
139
  publisher: string | undefined;
45
- version: string;
46
140
  engines: {
47
141
  [type in PluginEngine]: string;
48
142
  };
49
- theiaPlugin?: {
50
- frontend?: string;
51
- backend?: string;
52
- /* Requires the `@theia/plugin-ext-headless` extension. */
53
- headless?: string;
54
- };
55
- main?: string;
56
- browser?: string;
57
143
  displayName: string;
58
144
  description: string;
59
145
  contributes?: PluginPackageContribution;
60
- packagePath: string;
61
- activationEvents?: string[];
62
- extensionDependencies?: string[];
63
- extensionPack?: string[];
64
- l10n?: string;
65
- icon?: string;
66
- type?: 'module' | 'commonjs';
67
- extensionKind?: Array<'ui' | 'workspace'>;
68
- capabilities?: {
69
- untrustedWorkspaces?: {
70
- supported: boolean | 'limited';
71
- description?: string;
72
- restrictedConfigurations?: string[];
73
- };
74
- };
75
146
  }
76
147
  export namespace PluginPackage {
77
- export function toPluginUrl(pck: PluginPackage | PluginModel, relativePath: string): string {
78
- return `hostedPlugin/${getPluginId(pck)}/${encodeURIComponent(relativePath)}`;
79
- }
80
- }
148
+ export const toPluginUrl = toPluginUrlFromUtils;
149
+ }
150
+
151
+ export {
152
+ AutoClosingPair,
153
+ AutoClosingPairConditional,
154
+ CustomEditorPriority,
155
+ CustomEditorSelector,
156
+ EnterAction,
157
+ FoldingMarkers,
158
+ FoldingRules,
159
+ type GrammarsContribution,
160
+ IndentationRules,
161
+ OnEnterRule,
162
+ PluginColorContribution,
163
+ PluginIconContribution,
164
+ PluginIconThemeContribution,
165
+ PluginJsonValidationContribution,
166
+ PluginManifestContribution,
167
+ PluginNotebookRendererContribution,
168
+ PluginPackageAuthenticationProvider,
169
+ PluginPackageCommand,
170
+ PluginPackageCustomEditor,
171
+ PluginPackageDebuggersContribution,
172
+ PluginPackageGrammarsContribution,
173
+ PluginPackageKeybinding,
174
+ PluginPackageLanguageContribution,
175
+ PluginPackageLanguageContributionConfiguration,
176
+ PluginPackageLanguageModelToolContribution,
177
+ PluginPackageLocalization,
178
+ PluginPackageMcpServerDefinitionProviderContribution,
179
+ PluginPackageMenu,
180
+ PluginPackageNotebook,
181
+ PluginPackageNotebookPreload,
182
+ PluginPackageSnippetsContribution,
183
+ PluginPackageSubmenu,
184
+ PluginPackageTerminal,
185
+ PluginPackageTerminalProfile,
186
+ PluginPackageTranslation,
187
+ PluginPackageView,
188
+ PluginPackageViewContainer,
189
+ PluginPackageViewWelcome,
190
+ PluginPackageWalkthrough,
191
+ PluginPackageWalkthroughStep,
192
+ PluginPackageWalkthroughStepMedia,
193
+ PluginTaskDefinitionContribution,
194
+ PluginThemeContribution,
195
+ PluginUiTheme,
196
+ PluginViewType,
197
+ PlatformSpecificAdapterContribution,
198
+ RegExpOptions,
199
+ ScopeMap,
200
+ type IconUrl,
201
+ type JSONObject,
202
+ type WalkthroughContribution,
203
+ type WalkthroughStepContribution,
204
+ type WalkthroughStepMedia,
205
+ };
81
206
 
82
207
  /**
83
- * This interface describes a package.json contribution section object.
208
+ * Strict `contributes` typing for scanned plugin packages.
84
209
  */
85
- export interface PluginPackageContribution {
86
- authentication?: PluginPackageAuthenticationProvider[];
87
- configuration?: JSONObject | JSONObject[];
88
- configurationDefaults?: JSONObject;
89
- languages?: PluginPackageLanguageContribution[];
90
- grammars?: PluginPackageGrammarsContribution[];
91
- customEditors?: PluginPackageCustomEditor[];
92
- viewsContainers?: { [location: string]: PluginPackageViewContainer[] };
93
- views?: { [location: string]: PluginPackageView[] };
94
- viewsWelcome?: PluginPackageViewWelcome[];
95
- commands?: PluginPackageCommand | PluginPackageCommand[];
96
- menus?: { [location: string]: PluginPackageMenu[] };
97
- submenus?: PluginPackageSubmenu[];
98
- keybindings?: PluginPackageKeybinding | PluginPackageKeybinding[];
99
- debuggers?: PluginPackageDebuggersContribution[];
100
- snippets?: PluginPackageSnippetsContribution[];
101
- themes?: PluginThemeContribution[];
102
- iconThemes?: PluginIconThemeContribution[];
103
- icons?: PluginIconContribution[];
104
- colors?: PluginColorContribution[];
105
- taskDefinitions?: PluginTaskDefinitionContribution[];
210
+ export interface PluginPackageContribution extends PluginManifestContribution {
106
211
  problemMatchers?: PluginProblemMatcherContribution[];
107
212
  problemPatterns?: PluginProblemPatternContribution[];
108
- jsonValidation?: PluginJsonValidationContribution[];
109
213
  resourceLabelFormatters?: ResourceLabelFormatter[];
110
- localizations?: PluginPackageLocalization[];
111
- terminal?: PluginPackageTerminal;
112
- notebooks?: PluginPackageNotebook[];
113
- notebookRenderer?: PluginNotebookRendererContribution[];
114
- notebookPreload?: PluginPackageNotebookPreload[];
115
- mcpServerDefinitionProviders?: PluginPackageMcpServerDefinitionProviderContribution[];
116
- languageModelTools?: PluginPackageLanguageModelToolContribution[];
117
- walkthroughs?: PluginPackageWalkthrough[];
118
- }
119
-
120
- /**
121
- * Media of a walkthrough step as contributed in `package.json`. Only the light and dark variant of an
122
- * image are mandatory, the high contrast ones were added to the VS Code schema later.
123
- */
124
- export type PluginPackageWalkthroughStepMedia =
125
- { markdown: string }
126
- | { image: string | { dark: string; light: string; hc?: string; hcLight?: string }; altText?: string }
127
- | { svg: string; altText?: string };
128
-
129
- export interface PluginPackageWalkthroughStep {
130
- id: string;
131
- title: string;
132
- description: string;
133
- media?: PluginPackageWalkthroughStepMedia;
134
- completionEvents?: string[];
135
- when?: string;
136
- }
137
-
138
- export interface PluginPackageWalkthrough {
139
- id: string;
140
- title: string;
141
- description: string;
142
- steps: PluginPackageWalkthroughStep[];
143
- when?: string;
144
- icon?: string;
145
- }
146
-
147
- export interface PluginPackageNotebook {
148
- type: string;
149
- displayName: string;
150
- selector?: readonly { filenamePattern?: string; excludeFileNamePattern?: string }[];
151
- priority?: string;
152
- }
153
-
154
- export interface PluginNotebookRendererContribution {
155
- readonly id: string;
156
- readonly displayName: string;
157
- readonly mimeTypes: string[];
158
- readonly entrypoint: string | { readonly extends: string; readonly path: string };
159
- readonly requiresMessaging?: 'always' | 'optional' | 'never'
160
- }
161
-
162
- export interface PluginPackageNotebookPreload {
163
- type: string;
164
- entrypoint: string;
165
- }
166
-
167
- export interface PluginPackageMcpServerDefinitionProviderContribution {
168
- id: string;
169
- label: string;
170
- description?: string;
171
- }
172
-
173
- export interface PluginPackageLanguageModelToolContribution {
174
- name: string;
175
- modelDescription?: string;
176
- userDescription?: string;
177
- inputSchema?: object;
178
- tags?: string[];
179
- }
180
-
181
- export interface PluginPackageAuthenticationProvider {
182
- id: string;
183
- label: string;
184
- }
185
-
186
- export interface PluginPackageTerminalProfile {
187
- title: string;
188
- id: string;
189
- icon?: string;
190
- }
191
-
192
- export interface PluginPackageTerminal {
193
- profiles: PluginPackageTerminalProfile[];
194
- }
195
-
196
- export interface PluginPackageLocalization {
197
- languageId: string;
198
- languageName?: string;
199
- localizedLanguageName?: string;
200
- translations: PluginPackageTranslation[];
201
- minimalTranslations?: { [key: string]: string };
202
- }
203
-
204
- export interface PluginPackageTranslation {
205
- id: string;
206
- path: string;
207
- }
208
-
209
- export interface PluginPackageCustomEditor {
210
- viewType: string;
211
- displayName: string;
212
- selector?: CustomEditorSelector[];
213
- priority?: CustomEditorPriority;
214
- }
215
-
216
- export interface CustomEditorSelector {
217
- readonly filenamePattern?: string;
218
- }
219
-
220
- export enum CustomEditorPriority {
221
- default = 'default',
222
- builtin = 'builtin',
223
- option = 'option',
224
- }
225
-
226
- export interface PluginPackageViewContainer {
227
- id: string;
228
- title: string;
229
- icon: string;
230
- when?: string;
231
- }
232
-
233
- export enum PluginViewType {
234
- Tree = 'tree',
235
- Webview = 'webview'
236
- }
237
-
238
- export interface PluginPackageView {
239
- id: string;
240
- name: string;
241
- when?: string;
242
- type?: string;
243
- }
244
-
245
- export interface PluginPackageViewWelcome {
246
- view: string;
247
- contents: string;
248
- when?: string;
249
- enablement?: string;
250
- }
251
-
252
- export interface PluginPackageCommand {
253
- command: string;
254
- title: string;
255
- shortTitle?: string;
256
- original?: string;
257
- category?: string;
258
- icon?: string | { light: string; dark: string; };
259
- enablement?: string;
260
- }
261
-
262
- export interface PluginPackageMenu {
263
- command?: string;
264
- submenu?: string;
265
- alt?: string;
266
- group?: string;
267
- when?: string;
268
- }
269
-
270
- export interface PluginPackageSubmenu {
271
- id: string;
272
- label: string;
273
- icon: IconUrl;
274
- }
275
-
276
- export interface PluginPackageKeybinding {
277
- key?: string;
278
- command: string;
279
- when?: string;
280
- mac?: string;
281
- linux?: string;
282
- win?: string;
283
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
284
- args?: any;
285
- }
286
-
287
- export interface PluginPackageGrammarsContribution {
288
- language?: string;
289
- scopeName: string;
290
- path: string;
291
- embeddedLanguages?: ScopeMap;
292
- tokenTypes?: ScopeMap;
293
- injectTo?: string[];
294
- }
295
-
296
- export interface ScopeMap {
297
- [scopeName: string]: string;
298
- }
299
-
300
- export interface PluginPackageSnippetsContribution {
301
- language?: string;
302
- path?: string;
303
- }
304
-
305
- export interface PluginColorContribution {
306
- id?: string;
307
- description?: string;
308
- defaults?: { light?: string, dark?: string, highContrast?: string };
309
- }
310
-
311
- export type PluginUiTheme = 'vs' | 'vs-dark' | 'hc-black';
312
-
313
- export interface PluginThemeContribution {
314
- id?: string;
315
- label?: string;
316
- description?: string;
317
- path?: string;
318
- uiTheme?: PluginUiTheme;
319
- }
320
-
321
- export interface PluginIconThemeContribution {
322
- id?: string;
323
- label?: string;
324
- description?: string;
325
- path?: string;
326
- uiTheme?: PluginUiTheme;
327
- }
328
-
329
- export interface PluginIconContribution {
330
- [id: string]: {
331
- description: string;
332
- default: { fontPath: string; fontCharacter: string } | string;
333
- };
334
- }
335
-
336
- export interface PlatformSpecificAdapterContribution {
337
- program?: string;
338
- args?: string[];
339
- runtime?: string;
340
- runtimeArgs?: string[];
341
- }
342
-
343
- /**
344
- * This interface describes a package.json debuggers contribution section object.
345
- */
346
- export interface PluginPackageDebuggersContribution extends PlatformSpecificAdapterContribution {
347
- type: string;
348
- label?: string;
349
- languages?: string[];
350
- enableBreakpointsFor?: { languageIds: string[] };
351
- configurationAttributes: { [request: string]: IJSONSchema };
352
- configurationSnippets: IJSONSchemaSnippet[];
353
- variables?: ScopeMap;
354
- adapterExecutableCommand?: string;
355
- win?: PlatformSpecificAdapterContribution;
356
- winx86?: PlatformSpecificAdapterContribution;
357
- windows?: PlatformSpecificAdapterContribution;
358
- osx?: PlatformSpecificAdapterContribution;
359
- linux?: PlatformSpecificAdapterContribution;
360
- }
361
-
362
- /**
363
- * This interface describes a package.json languages contribution section object.
364
- */
365
- export interface PluginPackageLanguageContribution {
366
- id: string;
367
- extensions?: string[];
368
- filenames?: string[];
369
- filenamePatterns?: string[];
370
- firstLine?: string;
371
- aliases?: string[];
372
- mimetypes?: string[];
373
- configuration?: string;
374
- icon?: IconUrl;
375
- }
376
-
377
- export interface PluginPackageLanguageContributionConfiguration {
378
- comments?: CommentRule;
379
- brackets?: CharacterPair[];
380
- autoClosingPairs?: (CharacterPair | AutoClosingPairConditional)[];
381
- surroundingPairs?: (CharacterPair | AutoClosingPair)[];
382
- wordPattern?: string;
383
- indentationRules?: IndentationRules;
384
- folding?: FoldingRules;
385
- onEnterRules?: OnEnterRule[];
386
- }
387
-
388
- export interface PluginTaskDefinitionContribution {
389
- type: string;
390
- required: string[];
391
- properties?: IJSONSchema['properties'];
392
214
  }
393
215
 
394
216
  export interface PluginProblemMatcherContribution extends ProblemMatcherContribution {
@@ -399,11 +221,6 @@ export interface PluginProblemPatternContribution extends ProblemPatternContribu
399
221
  name: string;
400
222
  }
401
223
 
402
- export interface PluginJsonValidationContribution {
403
- fileMatch: string | string[];
404
- url: string;
405
- }
406
-
407
224
  export const PluginScanner = Symbol('PluginScanner');
408
225
  /**
409
226
  * This scanner process package.json object and returns plugin metadata objects.
@@ -513,14 +330,6 @@ export enum PluginDeployerEntryType {
513
330
  HEADLESS // Deployed in the Theia Node server outside the context of a frontend/backend connection
514
331
  }
515
332
 
516
- /**
517
- * Whether a plugin installed by a user or system.
518
- */
519
- export enum PluginType {
520
- System,
521
- User
522
- };
523
-
524
333
  export interface UnresolvedPluginEntry {
525
334
  id: string;
526
335
  type?: PluginType;
@@ -607,185 +416,47 @@ export interface PluginDeployerDirectoryHandlerContext {
607
416
  }
608
417
 
609
418
  /**
610
- * This interface describes a plugin model object, which is populated from package.json.
419
+ * Static plugin contributions after normalization.
420
+ * Narrows shim/`unknown` fields from {@link NormalizedPluginContribution} to core/task types.
611
421
  */
612
- export interface PluginModel {
613
- id: string;
614
- name: string;
615
- publisher: string;
616
- version: string;
617
- displayName: string;
618
- description: string;
619
- engine: {
620
- type: PluginEngine;
621
- version: string;
622
- };
623
- entryPoint: PluginEntryPoint;
624
- packageUri: string;
625
- /**
626
- * @deprecated since 1.1.0 - because it lead to problems with getting a relative path
627
- * needed by Icon Themes to correctly load Fonts, use packageUri instead.
628
- */
629
- packagePath: string;
630
- iconUrl?: string;
631
- l10n?: string;
632
- readmeUrl?: string;
633
- licenseUrl?: string;
634
- untrustedWorkspacesSupport?: boolean | 'limited';
635
- }
636
-
637
- export interface PluginEntryPoint {
638
- frontend?: string;
639
- backend?: string;
640
- headless?: string;
641
- }
642
-
643
- /**
644
- * This interface describes some static plugin contributions.
645
- */
646
- export interface PluginContribution {
647
- activationEvents?: string[];
648
- authentication?: AuthenticationProviderInformation[];
422
+ export type PluginContribution = Omit<NormalizedPluginContribution,
423
+ 'configuration' | 'colors' | 'taskDefinitions' | 'problemMatchers' | 'problemPatterns' | 'resourceLabelFormatters'
424
+ > & {
649
425
  configuration?: PreferenceSchema[];
650
- configurationDefaults?: JSONObject;
651
- languages?: LanguageContribution[];
652
- grammars?: GrammarsContribution[];
653
- customEditors?: CustomEditor[];
654
- viewsContainers?: { [location: string]: ViewContainer[] };
655
- views?: { [location: string]: View[] };
656
- viewsWelcome?: ViewWelcome[];
657
- commands?: PluginCommand[];
658
- menus?: { [location: string]: Menu[] };
659
- submenus?: Submenu[];
660
- keybindings?: Keybinding[];
661
- debuggers?: DebuggerContribution[];
662
- snippets?: SnippetContribution[];
663
- themes?: ThemeContribution[];
664
- iconThemes?: IconThemeContribution[];
665
- icons?: IconContribution[];
666
426
  colors?: ColorDefinition[];
667
427
  taskDefinitions?: TaskDefinition[];
668
428
  problemMatchers?: ProblemMatcherContribution[];
669
429
  problemPatterns?: ProblemPatternContribution[];
670
430
  resourceLabelFormatters?: ResourceLabelFormatter[];
671
- localizations?: Localization[];
672
- terminalProfiles?: TerminalProfile[];
673
- notebooks?: NotebookContribution[];
674
- notebookRenderer?: NotebookRendererContribution[];
675
- notebookPreload?: notebookPreloadContribution[];
676
- walkthroughs?: WalkthroughContribution[];
677
- }
678
- export interface NotebookContribution {
679
- type: string;
680
- displayName: string;
681
- selector?: readonly { filenamePattern?: string; excludeFileNamePattern?: string }[];
682
- priority?: string;
683
- }
684
-
685
- export interface NotebookRendererContribution {
686
- readonly id: string;
687
- readonly displayName: string;
688
- readonly mimeTypes: string[];
689
- readonly entrypoint: string | { readonly extends: string; readonly path: string };
690
- readonly requiresMessaging?: 'always' | 'optional' | 'never'
691
- }
692
-
693
- export interface notebookPreloadContribution {
694
- type: string;
695
- entrypoint: string;
696
- }
431
+ };
697
432
 
698
- /**
699
- * Media of a walkthrough step with every path resolved and every image variant filled in.
700
- */
701
- export type WalkthroughStepMedia =
702
- { markdown: string }
703
- | { image: string | { dark: string; light: string; hc: string; hcLight: string }; altText?: string }
704
- | { svg: string; altText?: string };
433
+ export type NotebookContribution = PluginPackageNotebook;
705
434
 
706
- export interface WalkthroughStepContribution {
707
- id: string;
708
- title: string;
709
- description: string;
710
- media?: WalkthroughStepMedia;
711
- completionEvents?: string[];
712
- when?: string;
713
- }
435
+ export type NotebookRendererContribution = PluginNotebookRendererContribution;
714
436
 
715
- export interface WalkthroughContribution {
716
- id: string;
717
- title: string;
718
- description: string;
719
- steps: WalkthroughStepContribution[];
720
- when?: string;
721
- icon?: string;
722
- pluginId: string;
723
- /** Icon of the contributing extension, as a backend relative path. */
724
- pluginIcon?: string;
725
- }
437
+ export type notebookPreloadContribution = PluginPackageNotebookPreload;
726
438
 
727
- export interface AuthenticationProviderInformation {
728
- id: string;
729
- label: string;
730
- }
439
+ export type AuthenticationProviderInformation = PluginPackageAuthenticationProvider;
731
440
 
732
- export interface TerminalProfile {
733
- title: string,
734
- id: string,
735
- icon?: string
736
- }
441
+ export type TerminalProfile = NormalizedTerminalProfile;
737
442
 
738
- export interface Localization {
739
- languageId: string;
740
- languageName?: string;
741
- localizedLanguageName?: string;
742
- translations: Translation[];
743
- minimalTranslations?: { [key: string]: string };
744
- }
443
+ export type Localization = NormalizedLocalization;
745
444
 
746
- export interface Translation {
747
- id: string;
748
- path: string;
749
- cachedContents?: { [scope: string]: { [key: string]: string } };
750
- }
445
+ export type Translation = NormalizedTranslation;
751
446
 
752
- export interface SnippetContribution {
753
- uri: string
754
- source: string
755
- language?: string
756
- }
447
+ export type SnippetContribution = NormalizedSnippet;
757
448
 
758
- export type UiTheme = 'vs' | 'vs-dark' | 'hc-black';
449
+ export type UiTheme = PluginUiTheme;
759
450
 
760
- export interface ThemeContribution {
761
- id?: string;
762
- label?: string;
763
- description?: string;
764
- uri: string;
765
- uiTheme?: UiTheme;
766
- }
451
+ export type ThemeContribution = NormalizedTheme;
767
452
 
768
- export interface IconThemeContribution {
769
- id: string;
770
- label?: string;
771
- description?: string;
772
- uri: string;
773
- uiTheme?: UiTheme;
774
- }
453
+ export type IconThemeContribution = NormalizedIconTheme;
775
454
 
776
- export interface IconDefinition {
777
- fontCharacter: string;
778
- location: string;
779
- }
455
+ export type IconDefinition = Extract<NormalizedIcon['defaults'], { fontCharacter: string }>;
780
456
 
781
- export type IconDefaults = ThemeIcon | IconDefinition;
457
+ export type IconDefaults = NormalizedIcon['defaults'];
782
458
 
783
- export interface IconContribution {
784
- id: string;
785
- extensionId: string;
786
- description: string | undefined;
787
- defaults: IconDefaults;
788
- }
459
+ export type IconContribution = NormalizedIcon;
789
460
 
790
461
  export namespace IconContribution {
791
462
  export function isIconDefinition(defaults: IconDefaults): defaults is IconDefinition {
@@ -793,219 +464,48 @@ export namespace IconContribution {
793
464
  }
794
465
  }
795
466
 
796
- export interface GrammarsContribution {
797
- format: 'json' | 'plist';
798
- language?: string;
799
- scope: string;
800
- grammar?: string | object;
801
- grammarLocation?: string;
802
- embeddedLanguages?: ScopeMap;
803
- tokenTypes?: ScopeMap;
804
- injectTo?: string[];
805
- balancedBracketScopes?: string[];
806
- unbalancedBracketScopes?: string[];
807
- }
808
-
809
467
  /**
810
468
  * The language contribution
811
469
  */
812
- export interface LanguageContribution {
813
- id: string;
814
- extensions?: string[];
815
- filenames?: string[];
816
- filenamePatterns?: string[];
817
- firstLine?: string;
818
- aliases?: string[];
819
- mimetypes?: string[];
820
- configuration?: LanguageConfiguration;
821
- /**
822
- * @internal
823
- */
824
- icon?: IconUrl;
825
- }
826
-
827
- export interface RegExpOptions {
828
- pattern: string;
829
- flags?: string;
830
- }
831
-
832
- export interface LanguageConfiguration {
833
- brackets?: CharacterPair[];
834
- indentationRules?: IndentationRules;
835
- surroundingPairs?: AutoClosingPair[];
836
- autoClosingPairs?: AutoClosingPairConditional[];
837
- comments?: CommentRule;
838
- folding?: FoldingRules;
839
- wordPattern?: string | RegExpOptions;
840
- onEnterRules?: OnEnterRule[];
841
- }
842
-
843
- /**
844
- * This interface describes a package.json debuggers contribution section object.
845
- */
846
- export interface DebuggerContribution extends PlatformSpecificAdapterContribution {
847
- type: string,
848
- label?: string,
849
- languages?: string[],
850
- enableBreakpointsFor?: {
851
- languageIds: string[]
852
- },
853
- configurationAttributes?: {
854
- [request: string]: IJSONSchema
855
- },
856
- configurationSnippets?: IJSONSchemaSnippet[],
857
- variables?: ScopeMap,
858
- adapterExecutableCommand?: string
859
- win?: PlatformSpecificAdapterContribution;
860
- winx86?: PlatformSpecificAdapterContribution;
861
- windows?: PlatformSpecificAdapterContribution;
862
- osx?: PlatformSpecificAdapterContribution;
863
- linux?: PlatformSpecificAdapterContribution;
864
- }
470
+ export type LanguageContribution = NormalizedLanguage;
865
471
 
866
- export interface IndentationRules {
867
- increaseIndentPattern: string | RegExpOptions;
868
- decreaseIndentPattern: string | RegExpOptions;
869
- unIndentedLinePattern?: string | RegExpOptions;
870
- indentNextLinePattern?: string | RegExpOptions;
871
- }
872
- export interface AutoClosingPair {
873
- close: string;
874
- open: string;
875
- }
876
-
877
- export interface AutoClosingPairConditional extends AutoClosingPair {
878
- notIn?: string[];
879
- }
472
+ export type LanguageConfiguration = NormalizedLanguageConfiguration;
880
473
 
881
- export interface FoldingMarkers {
882
- start: string | RegExpOptions;
883
- end: string | RegExpOptions;
884
- }
885
-
886
- export interface FoldingRules {
887
- offSide?: boolean;
888
- markers?: FoldingMarkers;
889
- }
890
-
891
- export interface OnEnterRule {
892
- beforeText: string | RegExpOptions;
893
- afterText?: string | RegExpOptions;
894
- previousLineText?: string | RegExpOptions;
895
- action: EnterAction;
896
- }
897
-
898
- export interface EnterAction {
899
- indent: 'none' | 'indent' | 'outdent' | 'indentOutdent';
900
- appendText?: string;
901
- removeText?: number;
902
- }
474
+ export type DebuggerContribution = PluginPackageDebuggersContribution;
903
475
 
904
476
  /**
905
477
  * Custom Editors contribution
906
478
  */
907
- export interface CustomEditor {
908
- viewType: string;
909
- displayName: string;
910
- selector: CustomEditorSelector[];
911
- priority: CustomEditorPriority;
912
- }
479
+ export type CustomEditor = NormalizedCustomEditor;
913
480
 
914
481
  /**
915
482
  * Views Containers contribution
916
483
  */
917
- export interface ViewContainer {
918
- id: string;
919
- title: string;
920
- iconUrl: string;
921
- themeIcon?: string;
922
- when?: string;
923
- }
484
+ export type ViewContainer = NormalizedViewContainer;
924
485
 
925
486
  /**
926
487
  * View contribution
927
488
  */
928
- export interface View {
929
- id: string;
930
- name: string;
931
- when?: string;
932
- type?: string;
933
- }
489
+ export type View = PluginPackageView;
934
490
 
935
491
  /**
936
492
  * View Welcome contribution
937
493
  */
938
- export interface ViewWelcome {
939
- view: string;
940
- content: string;
941
- when?: string;
942
- enablement?: string;
943
- order: number;
944
- }
945
-
946
- export interface PluginCommand {
947
- command: string;
948
- title: string;
949
- shortTitle?: string;
950
- originalTitle?: string;
951
- category?: string;
952
- iconUrl?: IconUrl;
953
- themeIcon?: string;
954
- enablement?: string;
955
- }
494
+ export type ViewWelcome = NormalizedViewWelcome;
956
495
 
957
- export type IconUrl = string | { light: string; dark: string; };
496
+ export type PluginCommand = NormalizedCommand;
958
497
 
959
498
  /**
960
499
  * Menu contribution
961
500
  */
962
- export interface Menu {
963
- command?: string;
964
- submenu?: string
965
- alt?: string;
966
- group?: string;
967
- when?: string;
968
- }
501
+ export type Menu = PluginPackageMenu;
969
502
 
970
- export interface Submenu {
971
- id: string;
972
- label: string;
973
- icon?: IconUrl;
974
- }
503
+ export type Submenu = NormalizedSubmenu;
975
504
 
976
505
  /**
977
506
  * Keybinding contribution
978
507
  */
979
- export interface Keybinding {
980
- keybinding?: string;
981
- command: string;
982
- when?: string;
983
- mac?: string;
984
- linux?: string;
985
- win?: string;
986
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
987
- args?: any;
988
- }
989
-
990
- /**
991
- * This interface describes a plugin lifecycle object.
992
- */
993
- export interface PluginLifecycle {
994
- startMethod: string;
995
- stopMethod: string;
996
- /**
997
- * Frontend module name, frontend plugin should expose this name.
998
- */
999
- frontendModuleName?: string;
1000
- /**
1001
- * Path to the script which should do some initialization before frontend plugin is loaded.
1002
- */
1003
- frontendInitPath?: string;
1004
- /**
1005
- * Path to the script which should do some initialization before backend plugin is loaded.
1006
- */
1007
- backendInitPath?: string;
1008
- }
508
+ export type Keybinding = NormalizedKeybinding;
1009
509
 
1010
510
  /**
1011
511
  * The export function of initialization module of backend plugin.
@@ -1026,27 +526,11 @@ export interface ExtensionContext {
1026
526
  subscriptions: Disposable[];
1027
527
  }
1028
528
 
1029
- export interface PluginMetadata {
1030
- host: string;
1031
- model: PluginModel;
1032
- lifecycle: PluginLifecycle;
1033
- isUnderDevelopment?: boolean;
1034
- outOfSync: boolean;
1035
- }
1036
-
1037
529
  export const MetadataProcessor = Symbol('MetadataProcessor');
1038
530
  export interface MetadataProcessor {
1039
531
  process(pluginMetadata: PluginMetadata): void;
1040
532
  }
1041
533
 
1042
- export function getPluginId(plugin: PluginPackage | PluginModel): string {
1043
- return `${plugin.publisher}_${plugin.name}`.replace(/\W/g, '_');
1044
- }
1045
-
1046
- export function buildFrontendModuleName(plugin: PluginPackage | PluginModel): string {
1047
- return `${plugin.publisher}_${plugin.name}`.replace(/\W/g, '_');
1048
- }
1049
-
1050
534
  export const HostedPluginClient = Symbol('HostedPluginClient');
1051
535
  export interface HostedPluginClient {
1052
536
  postMessage(pluginHost: string, buffer: Uint8Array): Promise<void>;
@@ -1107,14 +591,7 @@ export interface PluginDeployerHandler {
1107
591
 
1108
592
  }
1109
593
 
1110
- export interface DeployedPlugin {
1111
- /**
1112
- * defaults to system
1113
- */
1114
- type?: PluginType;
1115
- metadata: PluginMetadata;
1116
- contributes?: PluginContribution;
1117
- }
594
+ export type DeployedPlugin = DeployedPluginBase<PluginContribution>;
1118
595
 
1119
596
  export const HostedPluginServer = Symbol('HostedPluginServer');
1120
597
  export interface HostedPluginServer extends RpcServer<HostedPluginClient> {
@@ -1135,8 +612,6 @@ export interface HostedPluginServer extends RpcServer<HostedPluginClient> {
1135
612
 
1136
613
  }
1137
614
 
1138
- export const PLUGIN_HOST_BACKEND = 'main';
1139
-
1140
615
  export interface WorkspaceStorageKind {
1141
616
  workspace?: string | undefined;
1142
617
  roots: string[];