@codingame/monaco-vscode-api 1.76.1 → 1.76.3-next.0

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 (59) hide show
  1. package/README.md +2 -1
  2. package/dist/api.js +3 -860
  3. package/dist/{extHost.js → api2.js} +16555 -13467
  4. package/dist/async.js +107 -2
  5. package/dist/audioCue.js +105 -103
  6. package/dist/button.js +1 -1
  7. package/dist/cancellation.js +3 -0
  8. package/dist/configuration.js +7 -344
  9. package/dist/configuration2.js +339 -0
  10. package/dist/configurationRegistry.js +441 -0
  11. package/dist/contextkeys.js +211 -0
  12. package/dist/debug.d.ts +22 -0
  13. package/dist/debug.js +15842 -0
  14. package/dist/dialogs.js +855 -9
  15. package/dist/extensionResourceLoader.js +96 -0
  16. package/dist/extensions.d.ts +491 -0
  17. package/dist/extensions.js +70 -0
  18. package/dist/{tools.js → extensionsRegistry.js} +2 -30
  19. package/dist/files.js +1407 -334
  20. package/dist/iconv.js +43 -0
  21. package/dist/injection.js +1 -1
  22. package/dist/jschardet.js +7 -0
  23. package/dist/keybindings.d.ts +1 -485
  24. package/dist/keybindings.js +666 -679
  25. package/dist/labels.js +14 -0
  26. package/dist/languageConfiguration.d.ts +1 -2
  27. package/dist/languageConfiguration.js +9 -16
  28. package/dist/languageService.js +112 -8
  29. package/dist/languages.d.ts +1 -473
  30. package/dist/languages.js +2 -12
  31. package/dist/layout.js +4 -3
  32. package/dist/layoutService.js +1 -1
  33. package/dist/missing-services.js +4710 -74
  34. package/dist/modelEditor.d.ts +324 -2
  35. package/dist/modelEditor.js +15 -228
  36. package/dist/monaco.js +7 -72
  37. package/dist/notifications.js +75 -232
  38. package/dist/polyfill.js +10715 -2459
  39. package/dist/resources.js +197 -0
  40. package/dist/services.d.ts +924 -3
  41. package/dist/services.js +1 -2
  42. package/dist/services2.js +2436 -18
  43. package/dist/snippets.d.ts +1 -473
  44. package/dist/snippets.js +8 -867
  45. package/dist/snippetsService.js +868 -0
  46. package/dist/textFileEditorModel.js +2985 -0
  47. package/dist/textmate.d.ts +3 -475
  48. package/dist/textmate.js +19 -29
  49. package/dist/theme.d.ts +1 -3
  50. package/dist/theme.js +24 -70
  51. package/dist/tokenClassification.d.ts +1 -475
  52. package/dist/tokenClassification.js +11 -37
  53. package/dist/tokenClassificationRegistry.js +8 -4
  54. package/dist/variableResolver.js +1711 -0
  55. package/dist/workbenchThemeService.js +1 -1
  56. package/dist/workspaceContext.js +1 -3
  57. package/package.json +27 -12
  58. package/dist/contextkey.js +0 -419
  59. package/dist/dialog.web.contribution.js +0 -945
@@ -0,0 +1,96 @@
1
+ import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
2
+ import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
3
+ import { cq as getRemoteServerRootPath, h as format2, s as supportsTelemetry, cr as getTelemetryLevel } from './missing-services.js';
4
+ import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
5
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
6
+ import { RemoteAuthorities } from 'monaco-editor/esm/vs/base/common/network.js';
7
+ import { isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
8
+ const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9
+ function isUUID(value) {
10
+ return _UUIDPattern.test(value);
11
+ }
12
+ async function getServiceMachineId(environmentService, fileService, storageService) {
13
+ let uuid = storageService ? storageService.get('storage.serviceMachineId', -1 ) || null : null;
14
+ if (uuid) {
15
+ return uuid;
16
+ }
17
+ try {
18
+ const contents = await fileService.readFile(environmentService.serviceMachineIdResource);
19
+ const value = ( contents.value.toString());
20
+ uuid = isUUID(value) ? value : null;
21
+ }
22
+ catch (e) {
23
+ uuid = null;
24
+ }
25
+ if (!uuid) {
26
+ uuid = generateUuid();
27
+ try {
28
+ await fileService.writeFile(environmentService.serviceMachineIdResource, VSBuffer.fromString(uuid));
29
+ }
30
+ catch (error) {
31
+ }
32
+ }
33
+ storageService?.store('storage.serviceMachineId', uuid, -1 , 1 );
34
+ return uuid;
35
+ }
36
+ const WEB_EXTENSION_RESOURCE_END_POINT = 'web-extension-resource';
37
+ const IExtensionResourceLoaderService = ( createDecorator('extensionResourceLoaderService'));
38
+ class AbstractExtensionResourceLoaderService {
39
+ constructor(_fileService, _storageService, _productService, _environmentService, _configurationService) {
40
+ this._fileService = _fileService;
41
+ this._storageService = _storageService;
42
+ this._productService = _productService;
43
+ this._environmentService = _environmentService;
44
+ this._configurationService = _configurationService;
45
+ this._webExtensionResourceEndPoint = `${getRemoteServerRootPath(_productService)}/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
46
+ if (_productService.extensionsGallery) {
47
+ this._extensionGalleryResourceUrlTemplate = _productService.extensionsGallery.resourceUrlTemplate;
48
+ this._extensionGalleryAuthority = this._extensionGalleryResourceUrlTemplate ? this._getExtensionGalleryAuthority(( URI.parse(this._extensionGalleryResourceUrlTemplate))) : undefined;
49
+ }
50
+ }
51
+ get supportsExtensionGalleryResources() {
52
+ return this._extensionGalleryResourceUrlTemplate !== undefined;
53
+ }
54
+ getExtensionGalleryResourceURL(galleryExtension, path) {
55
+ if (this._extensionGalleryResourceUrlTemplate) {
56
+ const uri = ( URI.parse(
57
+ format2(this._extensionGalleryResourceUrlTemplate, { publisher: galleryExtension.publisher, name: galleryExtension.name, version: galleryExtension.version, path: 'extension' })
58
+ ));
59
+ return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;
60
+ }
61
+ return undefined;
62
+ }
63
+ isExtensionGalleryResource(uri) {
64
+ return this._extensionGalleryAuthority && this._extensionGalleryAuthority === this._getExtensionGalleryAuthority(uri);
65
+ }
66
+ async getExtensionGalleryRequestHeaders() {
67
+ const headers = {
68
+ 'X-Client-Name': `${this._productService.applicationName}${isWeb ? '-web' : ''}`,
69
+ 'X-Client-Version': this._productService.version
70
+ };
71
+ if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === 3 ) {
72
+ headers['X-Machine-Id'] = await this._getServiceMachineId();
73
+ }
74
+ if (this._productService.commit) {
75
+ headers['X-Client-Commit'] = this._productService.commit;
76
+ }
77
+ return headers;
78
+ }
79
+ _getServiceMachineId() {
80
+ if (!this._serviceMachineIdPromise) {
81
+ this._serviceMachineIdPromise = getServiceMachineId(this._environmentService, this._fileService, this._storageService);
82
+ }
83
+ return this._serviceMachineIdPromise;
84
+ }
85
+ _getExtensionGalleryAuthority(uri) {
86
+ if (this._isWebExtensionResourceEndPoint(uri)) {
87
+ return uri.authority;
88
+ }
89
+ const index = uri.authority.indexOf('.');
90
+ return index !== -1 ? uri.authority.substring(index + 1) : undefined;
91
+ }
92
+ _isWebExtensionResourceEndPoint(uri) {
93
+ return uri.path.startsWith(this._webExtensionResourceEndPoint);
94
+ }
95
+ }
96
+ export { AbstractExtensionResourceLoaderService as A, IExtensionResourceLoaderService as I };
@@ -0,0 +1,491 @@
1
+ import * as vscode from 'vscode';
2
+
3
+ /**
4
+ * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
5
+ * This class is a simple parser which creates the basic component parts
6
+ * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
7
+ * and encoding.
8
+ *
9
+ * ```txt
10
+ * foo://example.com:8042/over/there?name=ferret#nose
11
+ * \_/ \______________/\_________/ \_________/ \__/
12
+ * | | | | |
13
+ * scheme authority path query fragment
14
+ * | _____________________|__
15
+ * / \ / \
16
+ * urn:example:animal:ferret:nose
17
+ * ```
18
+ */
19
+ declare class URI implements UriComponents {
20
+ static isUri(thing: any): thing is URI;
21
+ /**
22
+ * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.
23
+ * The part before the first colon.
24
+ */
25
+ readonly scheme: string;
26
+ /**
27
+ * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.
28
+ * The part between the first double slashes and the next slash.
29
+ */
30
+ readonly authority: string;
31
+ /**
32
+ * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.
33
+ */
34
+ readonly path: string;
35
+ /**
36
+ * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.
37
+ */
38
+ readonly query: string;
39
+ /**
40
+ * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.
41
+ */
42
+ readonly fragment: string;
43
+ /**
44
+ * @internal
45
+ */
46
+ protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);
47
+ /**
48
+ * @internal
49
+ */
50
+ protected constructor(components: UriComponents);
51
+ /**
52
+ * Returns a string representing the corresponding file system path of this URI.
53
+ * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
54
+ * platform specific path separator.
55
+ *
56
+ * * Will *not* validate the path for invalid characters and semantics.
57
+ * * Will *not* look at the scheme of this URI.
58
+ * * The result shall *not* be used for display purposes but for accessing a file on disk.
59
+ *
60
+ *
61
+ * The *difference* to `URI#path` is the use of the platform specific separator and the handling
62
+ * of UNC paths. See the below sample of a file-uri with an authority (UNC path).
63
+ *
64
+ * ```ts
65
+ const u = URI.parse('file://server/c$/folder/file.txt')
66
+ u.authority === 'server'
67
+ u.path === '/shares/c$/file.txt'
68
+ u.fsPath === '\\server\c$\folder\file.txt'
69
+ ```
70
+ *
71
+ * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
72
+ * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
73
+ * with URIs that represent files on disk (`file` scheme).
74
+ */
75
+ get fsPath(): string;
76
+ with(change: {
77
+ scheme?: string;
78
+ authority?: string | null;
79
+ path?: string | null;
80
+ query?: string | null;
81
+ fragment?: string | null;
82
+ }): URI;
83
+ /**
84
+ * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,
85
+ * `file:///usr/home`, or `scheme:with/path`.
86
+ *
87
+ * @param value A string which represents an URI (see `URI#toString`).
88
+ */
89
+ static parse(value: string, _strict?: boolean): URI;
90
+ /**
91
+ * Creates a new URI from a file system path, e.g. `c:\my\files`,
92
+ * `/usr/home`, or `\\server\share\some\path`.
93
+ *
94
+ * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
95
+ * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
96
+ * `URI.parse('file://' + path)` because the path might contain characters that are
97
+ * interpreted (# and ?). See the following sample:
98
+ * ```ts
99
+ const good = URI.file('/coding/c#/project1');
100
+ good.scheme === 'file';
101
+ good.path === '/coding/c#/project1';
102
+ good.fragment === '';
103
+ const bad = URI.parse('file://' + '/coding/c#/project1');
104
+ bad.scheme === 'file';
105
+ bad.path === '/coding/c'; // path is now broken
106
+ bad.fragment === '/project1';
107
+ ```
108
+ *
109
+ * @param path A file system path (see `URI#fsPath`)
110
+ */
111
+ static file(path: string): URI;
112
+ static from(components: {
113
+ scheme: string;
114
+ authority?: string;
115
+ path?: string;
116
+ query?: string;
117
+ fragment?: string;
118
+ }): URI;
119
+ /**
120
+ * Join a URI path with path fragments and normalizes the resulting path.
121
+ *
122
+ * @param uri The input URI.
123
+ * @param pathFragment The path fragment to add to the URI path.
124
+ * @returns The resulting URI.
125
+ */
126
+ static joinPath(uri: URI, ...pathFragment: string[]): URI;
127
+ /**
128
+ * Creates a string representation for this URI. It's guaranteed that calling
129
+ * `URI.parse` with the result of this function creates an URI which is equal
130
+ * to this URI.
131
+ *
132
+ * * The result shall *not* be used for display purposes but for externalization or transport.
133
+ * * The result will be encoded using the percentage encoding and encoding happens mostly
134
+ * ignore the scheme-specific encoding rules.
135
+ *
136
+ * @param skipEncoding Do not encode the result, default is `false`
137
+ */
138
+ toString(skipEncoding?: boolean): string;
139
+ toJSON(): UriComponents;
140
+ static revive(data: UriComponents | URI): URI;
141
+ static revive(data: UriComponents | URI | undefined): URI | undefined;
142
+ static revive(data: UriComponents | URI | null): URI | null;
143
+ static revive(data: UriComponents | URI | undefined | null): URI | undefined | null;
144
+ }
145
+ interface UriComponents {
146
+ scheme: string;
147
+ authority: string;
148
+ path: string;
149
+ query: string;
150
+ fragment: string;
151
+ }
152
+
153
+ interface ILocalizedString {
154
+ /**
155
+ * The localized value of the string.
156
+ */
157
+ value: string;
158
+ /**
159
+ * The original (non localized value of the string)
160
+ */
161
+ original: string;
162
+ }
163
+
164
+ /**
165
+ * Type of extension.
166
+ *
167
+ * **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.
168
+ */
169
+ type ExtensionKind = 'ui' | 'workspace' | 'web';
170
+
171
+ interface ICommand {
172
+ command: string;
173
+ title: string | ILocalizedString;
174
+ category?: string | ILocalizedString;
175
+ }
176
+ interface IConfigurationProperty {
177
+ description: string;
178
+ type: string | string[];
179
+ default?: any;
180
+ }
181
+ interface IConfiguration {
182
+ id?: string;
183
+ order?: number;
184
+ title?: string;
185
+ properties: {
186
+ [key: string]: IConfigurationProperty;
187
+ };
188
+ }
189
+ interface IDebugger {
190
+ label?: string;
191
+ type: string;
192
+ runtime?: string;
193
+ }
194
+ interface IGrammar {
195
+ language: string;
196
+ }
197
+ interface IJSONValidation {
198
+ fileMatch: string | string[];
199
+ url: string;
200
+ }
201
+ interface IKeyBinding {
202
+ command: string;
203
+ key: string;
204
+ when?: string;
205
+ mac?: string;
206
+ linux?: string;
207
+ win?: string;
208
+ }
209
+ interface ILanguage {
210
+ id: string;
211
+ extensions: string[];
212
+ aliases: string[];
213
+ }
214
+ interface IMenu {
215
+ command: string;
216
+ alt?: string;
217
+ when?: string;
218
+ group?: string;
219
+ }
220
+ interface ISnippet {
221
+ language: string;
222
+ }
223
+ interface ITheme {
224
+ label: string;
225
+ }
226
+ interface IViewContainer {
227
+ id: string;
228
+ title: string;
229
+ }
230
+ interface IView {
231
+ id: string;
232
+ name: string;
233
+ }
234
+ interface IColor {
235
+ id: string;
236
+ description: string;
237
+ defaults: {
238
+ light: string;
239
+ dark: string;
240
+ highContrast: string;
241
+ };
242
+ }
243
+ interface IWebviewEditor {
244
+ readonly viewType: string;
245
+ readonly priority: string;
246
+ readonly selector: readonly {
247
+ readonly filenamePattern?: string;
248
+ }[];
249
+ }
250
+ interface ICodeActionContributionAction {
251
+ readonly kind: string;
252
+ readonly title: string;
253
+ readonly description?: string;
254
+ }
255
+ interface ICodeActionContribution {
256
+ readonly languages: readonly string[];
257
+ readonly actions: readonly ICodeActionContributionAction[];
258
+ }
259
+ interface IAuthenticationContribution {
260
+ readonly id: string;
261
+ readonly label: string;
262
+ }
263
+ interface IWalkthroughStep {
264
+ readonly id: string;
265
+ readonly title: string;
266
+ readonly description: string | undefined;
267
+ readonly media: {
268
+ image: string | {
269
+ dark: string;
270
+ light: string;
271
+ hc: string;
272
+ };
273
+ altText: string;
274
+ markdown?: never;
275
+ svg?: never;
276
+ } | {
277
+ markdown: string;
278
+ image?: never;
279
+ svg?: never;
280
+ } | {
281
+ svg: string;
282
+ altText: string;
283
+ markdown?: never;
284
+ image?: never;
285
+ };
286
+ readonly completionEvents?: string[];
287
+ /** @deprecated use `completionEvents: 'onCommand:...'` */
288
+ readonly doneOn?: {
289
+ command: string;
290
+ };
291
+ readonly when?: string;
292
+ }
293
+ interface IWalkthrough {
294
+ readonly id: string;
295
+ readonly title: string;
296
+ readonly icon?: string;
297
+ readonly description: string;
298
+ readonly steps: IWalkthroughStep[];
299
+ readonly featuredFor: string[] | undefined;
300
+ readonly when?: string;
301
+ }
302
+ interface IStartEntry {
303
+ readonly title: string;
304
+ readonly description: string;
305
+ readonly command: string;
306
+ readonly when?: string;
307
+ readonly category: 'file' | 'folder' | 'notebook';
308
+ }
309
+ interface INotebookEntry {
310
+ readonly type: string;
311
+ readonly displayName: string;
312
+ }
313
+ interface INotebookRendererContribution {
314
+ readonly id: string;
315
+ readonly displayName: string;
316
+ readonly mimeTypes: string[];
317
+ }
318
+ interface ITranslation {
319
+ id: string;
320
+ path: string;
321
+ }
322
+ interface ILocalizationContribution {
323
+ languageId: string;
324
+ languageName?: string;
325
+ localizedLanguageName?: string;
326
+ translations: ITranslation[];
327
+ minimalTranslations?: {
328
+ [key: string]: string;
329
+ };
330
+ }
331
+ interface IExtensionContributions {
332
+ commands?: ICommand[];
333
+ configuration?: IConfiguration | IConfiguration[];
334
+ debuggers?: IDebugger[];
335
+ grammars?: IGrammar[];
336
+ jsonValidation?: IJSONValidation[];
337
+ keybindings?: IKeyBinding[];
338
+ languages?: ILanguage[];
339
+ menus?: {
340
+ [context: string]: IMenu[];
341
+ };
342
+ snippets?: ISnippet[];
343
+ themes?: ITheme[];
344
+ iconThemes?: ITheme[];
345
+ productIconThemes?: ITheme[];
346
+ viewsContainers?: {
347
+ [location: string]: IViewContainer[];
348
+ };
349
+ views?: {
350
+ [location: string]: IView[];
351
+ };
352
+ colors?: IColor[];
353
+ localizations?: ILocalizationContribution[];
354
+ readonly customEditors?: readonly IWebviewEditor[];
355
+ readonly codeActions?: readonly ICodeActionContribution[];
356
+ authentication?: IAuthenticationContribution[];
357
+ walkthroughs?: IWalkthrough[];
358
+ startEntries?: IStartEntry[];
359
+ readonly notebooks?: INotebookEntry[];
360
+ readonly notebookRenderer?: INotebookRendererContribution[];
361
+ }
362
+ interface IExtensionCapabilities {
363
+ readonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;
364
+ readonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;
365
+ }
366
+ type LimitedWorkspaceSupportType = 'limited';
367
+ type ExtensionUntrustedWorkspaceSupport = {
368
+ supported: true;
369
+ } | {
370
+ supported: false;
371
+ description: string;
372
+ } | {
373
+ supported: LimitedWorkspaceSupportType;
374
+ description: string;
375
+ restrictedConfigurations?: string[];
376
+ };
377
+ type ExtensionVirtualWorkspaceSupport = boolean | {
378
+ supported: true;
379
+ } | {
380
+ supported: false | LimitedWorkspaceSupportType;
381
+ description: string;
382
+ };
383
+ interface IRelaxedExtensionManifest {
384
+ name: string;
385
+ displayName?: string;
386
+ publisher: string;
387
+ version: string;
388
+ engines: {
389
+ readonly vscode: string;
390
+ };
391
+ description?: string;
392
+ main?: string;
393
+ browser?: string;
394
+ preview?: boolean;
395
+ l10n?: string;
396
+ icon?: string;
397
+ categories?: string[];
398
+ keywords?: string[];
399
+ activationEvents?: string[];
400
+ extensionDependencies?: string[];
401
+ extensionPack?: string[];
402
+ extensionKind?: ExtensionKind | ExtensionKind[];
403
+ contributes?: IExtensionContributions;
404
+ repository?: {
405
+ url: string;
406
+ };
407
+ bugs?: {
408
+ url: string;
409
+ };
410
+ enabledApiProposals?: readonly string[];
411
+ api?: string;
412
+ scripts?: {
413
+ [key: string]: string;
414
+ };
415
+ capabilities?: IExtensionCapabilities;
416
+ }
417
+ type IExtensionManifest = Readonly<IRelaxedExtensionManifest>;
418
+ declare const enum TargetPlatform {
419
+ WIN32_X64 = "win32-x64",
420
+ WIN32_IA32 = "win32-ia32",
421
+ WIN32_ARM64 = "win32-arm64",
422
+ LINUX_X64 = "linux-x64",
423
+ LINUX_ARM64 = "linux-arm64",
424
+ LINUX_ARMHF = "linux-armhf",
425
+ ALPINE_X64 = "alpine-x64",
426
+ ALPINE_ARM64 = "alpine-arm64",
427
+ DARWIN_X64 = "darwin-x64",
428
+ DARWIN_ARM64 = "darwin-arm64",
429
+ WEB = "web",
430
+ UNIVERSAL = "universal",
431
+ UNKNOWN = "unknown",
432
+ UNDEFINED = "undefined"
433
+ }
434
+ /**
435
+ * **!Do not construct directly!**
436
+ *
437
+ * **!Only static methods because it gets serialized!**
438
+ *
439
+ * This represents the "canonical" version for an extension identifier. Extension ids
440
+ * have to be case-insensitive (due to the marketplace), but we must ensure case
441
+ * preservation because the extension API is already public at this time.
442
+ *
443
+ * For example, given an extension with the publisher `"Hello"` and the name `"World"`,
444
+ * its canonical extension identifier is `"Hello.World"`. This extension could be
445
+ * referenced in some other extension's dependencies using the string `"hello.world"`.
446
+ *
447
+ * To make matters more complicated, an extension can optionally have an UUID. When two
448
+ * extensions have the same UUID, they are considered equal even if their identifier is different.
449
+ */
450
+ declare class ExtensionIdentifier {
451
+ readonly value: string;
452
+ private readonly _lower;
453
+ constructor(value: string);
454
+ static equals(a: ExtensionIdentifier | string | null | undefined, b: ExtensionIdentifier | string | null | undefined): boolean;
455
+ /**
456
+ * Gives the value by which to index (for equality).
457
+ */
458
+ static toKey(id: ExtensionIdentifier | string): string;
459
+ }
460
+ interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest {
461
+ id?: string;
462
+ identifier: ExtensionIdentifier;
463
+ uuid?: string;
464
+ targetPlatform: TargetPlatform;
465
+ isBuiltin: boolean;
466
+ isUserBuiltin: boolean;
467
+ isUnderDevelopment: boolean;
468
+ extensionLocation: URI;
469
+ browserNlsBundleUris?: {
470
+ [language: string]: URI;
471
+ };
472
+ }
473
+ type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
474
+
475
+ declare class Disposable {
476
+ #private;
477
+ static from(...inDisposables: {
478
+ dispose(): any;
479
+ }[]): Disposable;
480
+ constructor(callOnDispose: () => any);
481
+ dispose(): any;
482
+ }
483
+
484
+ declare function createApi(extension: IExtensionDescription): typeof vscode;
485
+ interface RegisterExtensionResult {
486
+ api: typeof vscode;
487
+ registerFile: (path: string, getContent: () => Promise<string>) => Disposable;
488
+ }
489
+ declare function registerExtension(manifest: IExtensionManifest): RegisterExtensionResult;
490
+
491
+ export { IExtensionManifest, createApi, registerExtension };
@@ -0,0 +1,70 @@
1
+ import { E as ExtensionsRegistry, a as ExtensionMessageCollector } from './extensionsRegistry.js';
2
+ import { t as toExtensionDescription, g as getExtensionId } from './missing-services.js';
3
+ import { bM as api$1, bN as create, bO as create$1, bP as create$2, bQ as create$5, bR as create$3, bS as create$4, bT as create$6, bU as IExtHostExtensionService } from './api2.js';
4
+ import { c as consoleExtensionMessageHandler } from './polyfill.js';
5
+ import { r as registerExtensionFile } from './files.js';
6
+ import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
7
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
8
+ import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
9
+ function createApi(extension) {
10
+ const workspace = create$4(() => extension);
11
+ return {
12
+ ...api$1,
13
+ extensions: create(() => extension),
14
+ debug: create$1(() => extension),
15
+ env: create$2(() => extension),
16
+ commands: create$5(() => extension),
17
+ window: create$3(() => extension, workspace),
18
+ workspace: create$4(() => extension),
19
+ languages: create$6(() => extension)
20
+ };
21
+ }
22
+ const hasOwnProperty = Object.hasOwnProperty;
23
+ function handleExtensionPoint(extensionPoint, availableExtensions, messageHandler) {
24
+ const users = [];
25
+ for (const desc of availableExtensions) {
26
+ if ((desc.contributes != null) && hasOwnProperty.call(desc.contributes, extensionPoint.name)) {
27
+ users.push({
28
+ description: desc,
29
+ value: desc.contributes[extensionPoint.name],
30
+ collector: new ExtensionMessageCollector(messageHandler, desc, extensionPoint.name)
31
+ });
32
+ }
33
+ }
34
+ extensionPoint.acceptUsers(users);
35
+ }
36
+ function registerExtension(manifest) {
37
+ const uuid = generateUuid();
38
+ const location = ( URI.from({ scheme: 'extension', path: `/${uuid}` }));
39
+ const extension = {
40
+ manifest,
41
+ type: 1 ,
42
+ isBuiltin: false,
43
+ identifier: {
44
+ id: getExtensionId(manifest.publisher, manifest.name),
45
+ uuid
46
+ },
47
+ location,
48
+ targetPlatform: "web" ,
49
+ isValid: true,
50
+ validations: []
51
+ };
52
+ const extensionDescription = toExtensionDescription(extension);
53
+ void StandaloneServices.get(IExtHostExtensionService).getExtensionRegistry().then(extensionRegistry => {
54
+ extensionRegistry.deltaExtensions([extensionDescription], []);
55
+ const availableExtensions = extensionRegistry.getAllExtensionDescriptions();
56
+ const extensionPoints = ExtensionsRegistry.getExtensionPoints();
57
+ for (const extensionPoint of extensionPoints) {
58
+ if (Object.hasOwnProperty.call(extensionDescription.contributes, extensionPoint.name)) {
59
+ handleExtensionPoint(extensionPoint, availableExtensions, consoleExtensionMessageHandler);
60
+ }
61
+ }
62
+ });
63
+ return {
64
+ api: createApi(extensionDescription),
65
+ registerFile: (path, getContent) => {
66
+ return registerExtensionFile(location, path, getContent);
67
+ }
68
+ };
69
+ }
70
+ export { createApi, registerExtension };
@@ -1,12 +1,10 @@
1
- import { R as productSchemaId } from './services2.js';
1
+ import { aT as productSchemaId } from './services2.js';
2
2
  import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
3
3
  import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
4
4
  import { localize } from 'monaco-editor/esm/vs/nls.js';
5
5
  import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
6
6
  import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
7
7
  import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
8
- import { E as Emitter } from './contextkey.js';
9
- import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
10
8
  const EXTENSION_CATEGORIES = [
11
9
  'Azure',
12
10
  'Data Science',
@@ -897,30 +895,4 @@ schemaRegistry.registerSchema(productSchemaId, {
897
895
  }
898
896
  }
899
897
  });
900
- function consoleExtensionMessageHandler(msg) {
901
- if (msg.type === Severity.Error) {
902
- console.error(msg);
903
- }
904
- else if (msg.type === Severity.Warning) {
905
- console.warn(msg);
906
- }
907
- else {
908
- console.log(msg);
909
- }
910
- }
911
- function getExtensionPoint(extensionPoint) {
912
- return ExtensionsRegistry.getExtensionPoints().find(ep => ep.name === extensionPoint);
913
- }
914
- const emitter = new Emitter();
915
- const onServicesInitialized = emitter.event;
916
- let initialized = false;
917
- const original = StandaloneServices.initialize;
918
- StandaloneServices.initialize = (overrides) => {
919
- const instantiationService = original.call(StandaloneServices, overrides);
920
- if (!initialized) {
921
- initialized = true;
922
- emitter.fire(instantiationService);
923
- }
924
- return instantiationService;
925
- };
926
- export { ExtensionsRegistry as E, ExtensionMessageCollector as a, consoleExtensionMessageHandler as c, getExtensionPoint as g, onServicesInitialized as o };
898
+ export { ExtensionsRegistry as E, ExtensionMessageCollector as a };