@codingame/monaco-vscode-api 1.68.7 → 1.69.2

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.
@@ -0,0 +1,488 @@
1
+ import * as monaco from 'monaco-editor';
2
+ import * as vscode from 'vscode';
3
+
4
+ interface IDisposable {
5
+ dispose(): void;
6
+ }
7
+ declare class DisposableStore implements IDisposable {
8
+ static DISABLE_DISPOSED_WARNING: boolean;
9
+ private _toDispose;
10
+ private _isDisposed;
11
+ constructor();
12
+ /**
13
+ * Dispose of all registered disposables and mark this object as disposed.
14
+ *
15
+ * Any future disposables added to this object will be disposed of on `add`.
16
+ */
17
+ dispose(): void;
18
+ /**
19
+ * Returns `true` if this object has been disposed
20
+ */
21
+ get isDisposed(): boolean;
22
+ /**
23
+ * Dispose of all registered disposables but do not mark this object as disposed.
24
+ */
25
+ clear(): void;
26
+ add<T extends IDisposable>(o: T): T;
27
+ }
28
+
29
+ interface IObservable<T, TChange = void> {
30
+ readonly TChange: TChange;
31
+ /**
32
+ * Reads the current value.
33
+ *
34
+ * Must not be called from {@link IObserver.handleChange}.
35
+ */
36
+ get(): T;
37
+ /**
38
+ * Adds an observer.
39
+ */
40
+ addObserver(observer: IObserver): void;
41
+ removeObserver(observer: IObserver): void;
42
+ /**
43
+ * Subscribes the reader to this observable and returns the current value of this observable.
44
+ */
45
+ read(reader: IReader): T;
46
+ map<TNew>(fn: (value: T) => TNew): IObservable<TNew>;
47
+ readonly debugName: string;
48
+ }
49
+ interface IReader {
50
+ /**
51
+ * Reports an observable that was read.
52
+ *
53
+ * Is called by {@link IObservable.read}.
54
+ */
55
+ subscribeTo<T>(observable: IObservable<T, any>): void;
56
+ }
57
+ interface IObserver {
58
+ /**
59
+ * Indicates that an update operation is about to begin.
60
+ *
61
+ * During an update, invariants might not hold for subscribed observables and
62
+ * change events might be delayed.
63
+ * However, all changes must be reported before all update operations are over.
64
+ */
65
+ beginUpdate<T>(observable: IObservable<T>): void;
66
+ /**
67
+ * Is called by a subscribed observable immediately after it notices a change.
68
+ *
69
+ * When {@link IObservable.get} returns and no change has been reported,
70
+ * there has been no change for that observable.
71
+ *
72
+ * Implementations must not call into other observables!
73
+ * The change should be processed when {@link IObserver.endUpdate} is called.
74
+ */
75
+ handleChange<T, TChange>(observable: IObservable<T, TChange>, change: TChange): void;
76
+ /**
77
+ * Indicates that an update operation has completed.
78
+ */
79
+ endUpdate<T>(observable: IObservable<T>): void;
80
+ }
81
+
82
+ /**
83
+ * To an event a function with one or zero parameters
84
+ * can be subscribed. The event is the subscriber function itself.
85
+ */
86
+ type Event<T> = vscode.Event<T>
87
+ declare namespace Event {
88
+ const None: Event<any>;
89
+ /**
90
+ * Given an event, returns another event which only fires once.
91
+ */
92
+ function once<T>(event: Event<T>): Event<T>;
93
+ /**
94
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
95
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
96
+ * returned event causes this utility to leak a listener on the original event.
97
+ */
98
+ function map<I, O>(event: Event<I>, map: (i: I) => O, disposable?: DisposableStore): Event<O>;
99
+ /**
100
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
101
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
102
+ * returned event causes this utility to leak a listener on the original event.
103
+ */
104
+ function forEach<I>(event: Event<I>, each: (i: I) => void, disposable?: DisposableStore): Event<I>;
105
+ /**
106
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
107
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
108
+ * returned event causes this utility to leak a listener on the original event.
109
+ */
110
+ function filter<T, U>(event: Event<T | U>, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event<T>;
111
+ function filter<T>(event: Event<T>, filter: (e: T) => boolean, disposable?: DisposableStore): Event<T>;
112
+ function filter<T, R>(event: Event<T | R>, filter: (e: T | R) => e is R, disposable?: DisposableStore): Event<R>;
113
+ /**
114
+ * Given an event, returns the same event but typed as `Event<void>`.
115
+ */
116
+ function signal<T>(event: Event<T>): Event<void>;
117
+ /**
118
+ * Given a collection of events, returns a single event which emits
119
+ * whenever any of the provided events emit.
120
+ */
121
+ function any<T>(...events: Event<T>[]): Event<T>;
122
+ function any(...events: Event<any>[]): Event<void>;
123
+ /**
124
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
125
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
126
+ * returned event causes this utility to leak a listener on the original event.
127
+ */
128
+ function reduce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event<O>;
129
+ /**
130
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
131
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
132
+ * returned event causes this utility to leak a listener on the original event.
133
+ */
134
+ function debounce<T>(event: Event<T>, merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<T>;
135
+ /**
136
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
137
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
138
+ * returned event causes this utility to leak a listener on the original event.
139
+ */
140
+ function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay?: number, leading?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<O>;
141
+ /**
142
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
143
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
144
+ * returned event causes this utility to leak a listener on the original event.
145
+ */
146
+ function latch<T>(event: Event<T>, equals?: (a: T, b: T) => boolean, disposable?: DisposableStore): Event<T>;
147
+ /**
148
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
149
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
150
+ * returned event causes this utility to leak a listener on the original event.
151
+ */
152
+ function split<T, U>(event: Event<T | U>, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event<T>, Event<U>];
153
+ /**
154
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
155
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
156
+ * returned event causes this utility to leak a listener on the original event.
157
+ */
158
+ function buffer<T>(event: Event<T>, flushAfterTimeout?: boolean, _buffer?: T[]): Event<T>;
159
+ interface IChainableEvent<T> extends IDisposable {
160
+ event: Event<T>;
161
+ map<O>(fn: (i: T) => O): IChainableEvent<O>;
162
+ forEach(fn: (i: T) => void): IChainableEvent<T>;
163
+ filter(fn: (e: T) => boolean): IChainableEvent<T>;
164
+ filter<R>(fn: (e: T | R) => e is R): IChainableEvent<R>;
165
+ reduce<R>(merge: (last: R | undefined, event: T) => R, initial?: R): IChainableEvent<R>;
166
+ latch(): IChainableEvent<T>;
167
+ debounce(merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent<T>;
168
+ debounce<R>(merge: (last: R | undefined, event: T) => R, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent<R>;
169
+ on(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;
170
+ once(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
171
+ }
172
+ function chain<T>(event: Event<T>): IChainableEvent<T>;
173
+ interface NodeEventEmitter {
174
+ on(event: string | symbol, listener: Function): unknown;
175
+ removeListener(event: string | symbol, listener: Function): unknown;
176
+ }
177
+ function fromNodeEventEmitter<T>(emitter: NodeEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
178
+ interface DOMEventEmitter {
179
+ addEventListener(event: string | symbol, listener: Function): void;
180
+ removeEventListener(event: string | symbol, listener: Function): void;
181
+ }
182
+ function fromDOMEventEmitter<T>(emitter: DOMEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
183
+ function toPromise<T>(event: Event<T>): Promise<T>;
184
+ function runAndSubscribe<T>(event: Event<T>, handler: (e: T | undefined) => any): IDisposable;
185
+ function runAndSubscribeWithStore<T>(event: Event<T>, handler: (e: T | undefined, disposableStore: DisposableStore) => any): IDisposable;
186
+ function fromObservable<T>(obs: IObservable<T, any>, store?: DisposableStore): Event<T>;
187
+ }
188
+
189
+ declare type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'array' | 'object';
190
+ interface IJSONSchema {
191
+ id?: string;
192
+ $id?: string;
193
+ $schema?: string;
194
+ type?: JSONSchemaType | JSONSchemaType[];
195
+ title?: string;
196
+ default?: any;
197
+ definitions?: IJSONSchemaMap;
198
+ description?: string;
199
+ properties?: IJSONSchemaMap;
200
+ patternProperties?: IJSONSchemaMap;
201
+ additionalProperties?: boolean | IJSONSchema;
202
+ minProperties?: number;
203
+ maxProperties?: number;
204
+ dependencies?: IJSONSchemaMap | {
205
+ [prop: string]: string[];
206
+ };
207
+ items?: IJSONSchema | IJSONSchema[];
208
+ minItems?: number;
209
+ maxItems?: number;
210
+ uniqueItems?: boolean;
211
+ additionalItems?: boolean | IJSONSchema;
212
+ pattern?: string;
213
+ minLength?: number;
214
+ maxLength?: number;
215
+ minimum?: number;
216
+ maximum?: number;
217
+ exclusiveMinimum?: boolean | number;
218
+ exclusiveMaximum?: boolean | number;
219
+ multipleOf?: number;
220
+ required?: string[];
221
+ $ref?: string;
222
+ anyOf?: IJSONSchema[];
223
+ allOf?: IJSONSchema[];
224
+ oneOf?: IJSONSchema[];
225
+ not?: IJSONSchema;
226
+ enum?: any[];
227
+ format?: string;
228
+ const?: any;
229
+ contains?: IJSONSchema;
230
+ propertyNames?: IJSONSchema;
231
+ examples?: any[];
232
+ $comment?: string;
233
+ if?: IJSONSchema;
234
+ then?: IJSONSchema;
235
+ else?: IJSONSchema;
236
+ unevaluatedProperties?: boolean | IJSONSchema;
237
+ unevaluatedItems?: boolean | IJSONSchema;
238
+ minContains?: number;
239
+ maxContains?: number;
240
+ deprecated?: boolean;
241
+ dependentRequired?: {
242
+ [prop: string]: string[];
243
+ };
244
+ dependentSchemas?: IJSONSchemaMap;
245
+ $defs?: {
246
+ [name: string]: IJSONSchema;
247
+ };
248
+ $anchor?: string;
249
+ $recursiveRef?: string;
250
+ $recursiveAnchor?: string;
251
+ $vocabulary?: any;
252
+ prefixItems?: IJSONSchema[];
253
+ $dynamicRef?: string;
254
+ $dynamicAnchor?: string;
255
+ defaultSnippets?: IJSONSchemaSnippet[];
256
+ errorMessage?: string;
257
+ patternErrorMessage?: string;
258
+ deprecationMessage?: string;
259
+ markdownDeprecationMessage?: string;
260
+ enumDescriptions?: string[];
261
+ markdownEnumDescriptions?: string[];
262
+ markdownDescription?: string;
263
+ doNotSuggest?: boolean;
264
+ suggestSortText?: string;
265
+ allowComments?: boolean;
266
+ allowTrailingCommas?: boolean;
267
+ }
268
+ interface IJSONSchemaMap {
269
+ [name: string]: IJSONSchema;
270
+ }
271
+ interface IJSONSchemaSnippet {
272
+ label?: string;
273
+ description?: string;
274
+ body?: any;
275
+ bodyText?: string;
276
+ }
277
+
278
+ /**
279
+ * An interface for a JavaScript object that
280
+ * acts a dictionary. The keys are strings.
281
+ */
282
+ declare type IStringDictionary<V> = Record<string, V>;
283
+
284
+ declare type PolicyName = string;
285
+
286
+ declare enum EditPresentationTypes {
287
+ Multiline = "multilineText",
288
+ Singleline = "singlelineText"
289
+ }
290
+ interface IConfigurationRegistry {
291
+ /**
292
+ * Register a configuration to the registry.
293
+ */
294
+ registerConfiguration(configuration: IConfigurationNode): void;
295
+ /**
296
+ * Register multiple configurations to the registry.
297
+ */
298
+ registerConfigurations(configurations: IConfigurationNode[], validate?: boolean): void;
299
+ /**
300
+ * Deregister multiple configurations from the registry.
301
+ */
302
+ deregisterConfigurations(configurations: IConfigurationNode[]): void;
303
+ /**
304
+ * update the configuration registry by
305
+ * - registering the configurations to add
306
+ * - dereigstering the configurations to remove
307
+ */
308
+ updateConfigurations(configurations: {
309
+ add: IConfigurationNode[];
310
+ remove: IConfigurationNode[];
311
+ }): void;
312
+ /**
313
+ * Register multiple default configurations to the registry.
314
+ */
315
+ registerDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void;
316
+ /**
317
+ * Deregister multiple default configurations from the registry.
318
+ */
319
+ deregisterDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void;
320
+ /**
321
+ * Return the registered configuration defaults overrides
322
+ */
323
+ getConfigurationDefaultsOverrides(): Map<string, IConfigurationDefaultOverride>;
324
+ /**
325
+ * Signal that the schema of a configuration setting has changes. It is currently only supported to change enumeration values.
326
+ * Property or default value changes are not allowed.
327
+ */
328
+ notifyConfigurationSchemaUpdated(...configurations: IConfigurationNode[]): void;
329
+ /**
330
+ * Event that fires whenever a configuration has been
331
+ * registered.
332
+ */
333
+ readonly onDidSchemaChange: Event<void>;
334
+ /**
335
+ * Event that fires whenever a configuration has been
336
+ * registered.
337
+ */
338
+ readonly onDidUpdateConfiguration: Event<{
339
+ properties: string[];
340
+ defaultsOverrides?: boolean;
341
+ }>;
342
+ /**
343
+ * Returns all configuration nodes contributed to this registry.
344
+ */
345
+ getConfigurations(): IConfigurationNode[];
346
+ /**
347
+ * Returns all configurations settings of all configuration nodes contributed to this registry.
348
+ */
349
+ getConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema>;
350
+ /**
351
+ * Return all configurations by policy name
352
+ */
353
+ getPolicyConfigurations(): Map<PolicyName, string>;
354
+ /**
355
+ * Returns all excluded configurations settings of all configuration nodes contributed to this registry.
356
+ */
357
+ getExcludedConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema>;
358
+ /**
359
+ * Register the identifiers for editor configurations
360
+ */
361
+ registerOverrideIdentifiers(identifiers: string[]): void;
362
+ }
363
+ declare const enum ConfigurationScope {
364
+ /**
365
+ * Application specific configuration, which can be configured only in local user settings.
366
+ */
367
+ APPLICATION = 1,
368
+ /**
369
+ * Machine specific configuration, which can be configured only in local and remote user settings.
370
+ */
371
+ MACHINE = 2,
372
+ /**
373
+ * Window specific configuration, which can be configured in the user or workspace settings.
374
+ */
375
+ WINDOW = 3,
376
+ /**
377
+ * Resource specific configuration, which can be configured in the user, workspace or folder settings.
378
+ */
379
+ RESOURCE = 4,
380
+ /**
381
+ * Resource specific configuration that can be configured in language specific settings
382
+ */
383
+ LANGUAGE_OVERRIDABLE = 5,
384
+ /**
385
+ * Machine specific configuration that can also be configured in workspace or folder settings.
386
+ */
387
+ MACHINE_OVERRIDABLE = 6
388
+ }
389
+ interface IPolicy {
390
+ /**
391
+ * The policy name.
392
+ */
393
+ readonly name: PolicyName;
394
+ /**
395
+ * The Code version in which this policy was introduced.
396
+ */
397
+ readonly minimumVersion: `${number}.${number}`;
398
+ }
399
+ interface IConfigurationPropertySchema extends IJSONSchema {
400
+ scope?: ConfigurationScope;
401
+ /**
402
+ * When restricted, value of this configuration will be read only from trusted sources.
403
+ * For eg., If the workspace is not trusted, then the value of this configuration is not read from workspace settings file.
404
+ */
405
+ restricted?: boolean;
406
+ /**
407
+ * When `false` this property is excluded from the registry. Default is to include.
408
+ */
409
+ included?: boolean;
410
+ /**
411
+ * List of tags associated to the property.
412
+ * - A tag can be used for filtering
413
+ * - Use `experimental` tag for marking the setting as experimental. **Note:** Defaults of experimental settings can be changed by the running experiments.
414
+ */
415
+ tags?: string[];
416
+ /**
417
+ * When enabled this setting is ignored during sync and user can override this.
418
+ */
419
+ ignoreSync?: boolean;
420
+ /**
421
+ * When enabled this setting is ignored during sync and user cannot override this.
422
+ */
423
+ disallowSyncIgnore?: boolean;
424
+ /**
425
+ * Labels for enumeration items
426
+ */
427
+ enumItemLabels?: string[];
428
+ /**
429
+ * When specified, controls the presentation format of string settings.
430
+ * Otherwise, the presentation format defaults to `singleline`.
431
+ */
432
+ editPresentation?: EditPresentationTypes;
433
+ /**
434
+ * When specified, gives an order number for the setting
435
+ * within the settings editor. Otherwise, the setting is placed at the end.
436
+ */
437
+ order?: number;
438
+ /**
439
+ * When specified, this setting's value can always be overwritten by
440
+ * a system-wide policy.
441
+ */
442
+ policy?: IPolicy;
443
+ }
444
+ interface IExtensionInfo {
445
+ id: string;
446
+ displayName?: string;
447
+ }
448
+ interface IConfigurationNode {
449
+ id?: string;
450
+ order?: number;
451
+ type?: string | string[];
452
+ title?: string;
453
+ description?: string;
454
+ properties?: IStringDictionary<IConfigurationPropertySchema>;
455
+ allOf?: IConfigurationNode[];
456
+ scope?: ConfigurationScope;
457
+ extensionInfo?: IExtensionInfo;
458
+ restrictedProperties?: string[];
459
+ }
460
+ interface IConfigurationDefaults {
461
+ overrides: IStringDictionary<any>;
462
+ source?: IExtensionInfo | string;
463
+ }
464
+ declare type IRegisteredConfigurationPropertySchema = IConfigurationPropertySchema & {
465
+ defaultDefaultValue?: any;
466
+ source?: IExtensionInfo;
467
+ defaultValueSource?: IExtensionInfo | string;
468
+ };
469
+ declare type IConfigurationDefaultOverride = {
470
+ readonly value: any;
471
+ readonly source?: IExtensionInfo | string;
472
+ readonly valuesSources?: Map<string, IExtensionInfo | string>;
473
+ };
474
+
475
+ type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
476
+
477
+ interface IThemeScopedColorCustomizations {
478
+ [colorId: string]: string;
479
+ }
480
+ interface IColorCustomizations {
481
+ [colorIdOrThemeScope: string]: IThemeScopedColorCustomizations | string;
482
+ }
483
+
484
+ declare function updateUserConfiguration(configurationJson: string): void;
485
+ declare const configurationRegistry: IConfigurationRegistry;
486
+ declare function getServiceOverride(): IEditorOverrideServices;
487
+
488
+ export { ConfigurationScope, IColorCustomizations, IConfigurationDefaults, IConfigurationNode, IThemeScopedColorCustomizations, configurationRegistry, getServiceOverride as default, updateUserConfiguration };