@codingame/monaco-vscode-api 1.67.17 → 1.67.18
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 +15 -2
- package/dist/configuration.d.ts +248 -2
- package/dist/configuration.js +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Usage:
|
|
|
58
58
|
import { StandaloneService } from 'vscode/services'
|
|
59
59
|
import getModelEditorServiceOverride from 'vscode/service-override/modelEditor'
|
|
60
60
|
import getMessageServiceOverride from 'vscode/service-override/messages'
|
|
61
|
-
import getConfigurationServiceOverride from 'vscode/service-override/configuration'
|
|
61
|
+
import getConfigurationServiceOverride, { updateUserConfiguration, configurationRegistry } from 'vscode/service-override/configuration'
|
|
62
62
|
|
|
63
63
|
StandaloneServices.initialize({
|
|
64
64
|
...getModelEditorServiceOverride((model, input, sideBySide) => {
|
|
@@ -66,8 +66,21 @@ StandaloneServices.initialize({
|
|
|
66
66
|
// It will be called when for instance the user ctrl+click on an import
|
|
67
67
|
}),
|
|
68
68
|
...getMessageServiceOverride(document.body),
|
|
69
|
-
...getConfigurationServiceOverride(
|
|
69
|
+
...getConfigurationServiceOverride()
|
|
70
70
|
})
|
|
71
|
+
|
|
72
|
+
configurationRegistry.registerDefaultConfigurations([{
|
|
73
|
+
overrides: {
|
|
74
|
+
'editor.fontSize': 10
|
|
75
|
+
}
|
|
76
|
+
}])
|
|
77
|
+
|
|
78
|
+
updateUserConfiguration(`{
|
|
79
|
+
"editor.fontSize": 12,
|
|
80
|
+
"[java]": {
|
|
81
|
+
"editor.fontSize": 15,
|
|
82
|
+
}
|
|
83
|
+
}`)
|
|
71
84
|
```
|
|
72
85
|
|
|
73
86
|
Note: using `vscode/service-override/modelEditor`, you'll be able to use the `vscode.workspace.registerTextDocumentContentProvider` api
|
package/dist/configuration.d.ts
CHANGED
|
@@ -285,8 +285,254 @@ interface UriComponents {
|
|
|
285
285
|
fragment: string;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
declare type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'array' | 'object';
|
|
289
|
+
interface IJSONSchema {
|
|
290
|
+
id?: string;
|
|
291
|
+
$id?: string;
|
|
292
|
+
$schema?: string;
|
|
293
|
+
type?: JSONSchemaType | JSONSchemaType[];
|
|
294
|
+
title?: string;
|
|
295
|
+
default?: any;
|
|
296
|
+
definitions?: IJSONSchemaMap;
|
|
297
|
+
description?: string;
|
|
298
|
+
properties?: IJSONSchemaMap;
|
|
299
|
+
patternProperties?: IJSONSchemaMap;
|
|
300
|
+
additionalProperties?: boolean | IJSONSchema;
|
|
301
|
+
minProperties?: number;
|
|
302
|
+
maxProperties?: number;
|
|
303
|
+
dependencies?: IJSONSchemaMap | {
|
|
304
|
+
[prop: string]: string[];
|
|
305
|
+
};
|
|
306
|
+
items?: IJSONSchema | IJSONSchema[];
|
|
307
|
+
minItems?: number;
|
|
308
|
+
maxItems?: number;
|
|
309
|
+
uniqueItems?: boolean;
|
|
310
|
+
additionalItems?: boolean | IJSONSchema;
|
|
311
|
+
pattern?: string;
|
|
312
|
+
minLength?: number;
|
|
313
|
+
maxLength?: number;
|
|
314
|
+
minimum?: number;
|
|
315
|
+
maximum?: number;
|
|
316
|
+
exclusiveMinimum?: boolean | number;
|
|
317
|
+
exclusiveMaximum?: boolean | number;
|
|
318
|
+
multipleOf?: number;
|
|
319
|
+
required?: string[];
|
|
320
|
+
$ref?: string;
|
|
321
|
+
anyOf?: IJSONSchema[];
|
|
322
|
+
allOf?: IJSONSchema[];
|
|
323
|
+
oneOf?: IJSONSchema[];
|
|
324
|
+
not?: IJSONSchema;
|
|
325
|
+
enum?: any[];
|
|
326
|
+
format?: string;
|
|
327
|
+
const?: any;
|
|
328
|
+
contains?: IJSONSchema;
|
|
329
|
+
propertyNames?: IJSONSchema;
|
|
330
|
+
$comment?: string;
|
|
331
|
+
if?: IJSONSchema;
|
|
332
|
+
then?: IJSONSchema;
|
|
333
|
+
else?: IJSONSchema;
|
|
334
|
+
defaultSnippets?: IJSONSchemaSnippet[];
|
|
335
|
+
errorMessage?: string;
|
|
336
|
+
patternErrorMessage?: string;
|
|
337
|
+
deprecationMessage?: string;
|
|
338
|
+
markdownDeprecationMessage?: string;
|
|
339
|
+
enumDescriptions?: string[];
|
|
340
|
+
markdownEnumDescriptions?: string[];
|
|
341
|
+
markdownDescription?: string;
|
|
342
|
+
doNotSuggest?: boolean;
|
|
343
|
+
suggestSortText?: string;
|
|
344
|
+
allowComments?: boolean;
|
|
345
|
+
allowTrailingCommas?: boolean;
|
|
346
|
+
}
|
|
347
|
+
interface IJSONSchemaMap {
|
|
348
|
+
[name: string]: IJSONSchema;
|
|
349
|
+
}
|
|
350
|
+
interface IJSONSchemaSnippet {
|
|
351
|
+
label?: string;
|
|
352
|
+
description?: string;
|
|
353
|
+
body?: any;
|
|
354
|
+
bodyText?: string;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* An interface for a JavaScript object that
|
|
359
|
+
* acts a dictionary. The keys are strings.
|
|
360
|
+
*/
|
|
361
|
+
declare type IStringDictionary<V> = Record<string, V>;
|
|
362
|
+
|
|
363
|
+
declare enum EditPresentationTypes {
|
|
364
|
+
Multiline = "multilineText",
|
|
365
|
+
Singleline = "singlelineText"
|
|
366
|
+
}
|
|
367
|
+
interface IConfigurationRegistry {
|
|
368
|
+
/**
|
|
369
|
+
* Register a configuration to the registry.
|
|
370
|
+
*/
|
|
371
|
+
registerConfiguration(configuration: IConfigurationNode): void;
|
|
372
|
+
/**
|
|
373
|
+
* Register multiple configurations to the registry.
|
|
374
|
+
*/
|
|
375
|
+
registerConfigurations(configurations: IConfigurationNode[], validate?: boolean): void;
|
|
376
|
+
/**
|
|
377
|
+
* Deregister multiple configurations from the registry.
|
|
378
|
+
*/
|
|
379
|
+
deregisterConfigurations(configurations: IConfigurationNode[]): void;
|
|
380
|
+
/**
|
|
381
|
+
* update the configuration registry by
|
|
382
|
+
* - registering the configurations to add
|
|
383
|
+
* - dereigstering the configurations to remove
|
|
384
|
+
*/
|
|
385
|
+
updateConfigurations(configurations: {
|
|
386
|
+
add: IConfigurationNode[];
|
|
387
|
+
remove: IConfigurationNode[];
|
|
388
|
+
}): void;
|
|
389
|
+
/**
|
|
390
|
+
* Register multiple default configurations to the registry.
|
|
391
|
+
*/
|
|
392
|
+
registerDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void;
|
|
393
|
+
/**
|
|
394
|
+
* Deregister multiple default configurations from the registry.
|
|
395
|
+
*/
|
|
396
|
+
deregisterDefaultConfigurations(defaultConfigurations: IConfigurationDefaults[]): void;
|
|
397
|
+
/**
|
|
398
|
+
* Return the registered configuration defaults overrides
|
|
399
|
+
*/
|
|
400
|
+
getConfigurationDefaultsOverrides(): Map<string, IConfigurationDefaultOverride>;
|
|
401
|
+
/**
|
|
402
|
+
* Signal that the schema of a configuration setting has changes. It is currently only supported to change enumeration values.
|
|
403
|
+
* Property or default value changes are not allowed.
|
|
404
|
+
*/
|
|
405
|
+
notifyConfigurationSchemaUpdated(...configurations: IConfigurationNode[]): void;
|
|
406
|
+
/**
|
|
407
|
+
* Event that fires whenever a configuration has been
|
|
408
|
+
* registered.
|
|
409
|
+
*/
|
|
410
|
+
readonly onDidSchemaChange: Event<void>;
|
|
411
|
+
/**
|
|
412
|
+
* Event that fires whenever a configuration has been
|
|
413
|
+
* registered.
|
|
414
|
+
*/
|
|
415
|
+
readonly onDidUpdateConfiguration: Event<{
|
|
416
|
+
properties: string[];
|
|
417
|
+
defaultsOverrides?: boolean;
|
|
418
|
+
}>;
|
|
419
|
+
/**
|
|
420
|
+
* Returns all configuration nodes contributed to this registry.
|
|
421
|
+
*/
|
|
422
|
+
getConfigurations(): IConfigurationNode[];
|
|
423
|
+
/**
|
|
424
|
+
* Returns all configurations settings of all configuration nodes contributed to this registry.
|
|
425
|
+
*/
|
|
426
|
+
getConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema>;
|
|
427
|
+
/**
|
|
428
|
+
* Returns all excluded configurations settings of all configuration nodes contributed to this registry.
|
|
429
|
+
*/
|
|
430
|
+
getExcludedConfigurationProperties(): IStringDictionary<IRegisteredConfigurationPropertySchema>;
|
|
431
|
+
/**
|
|
432
|
+
* Register the identifiers for editor configurations
|
|
433
|
+
*/
|
|
434
|
+
registerOverrideIdentifiers(identifiers: string[]): void;
|
|
435
|
+
}
|
|
436
|
+
declare const enum ConfigurationScope {
|
|
437
|
+
/**
|
|
438
|
+
* Application specific configuration, which can be configured only in local user settings.
|
|
439
|
+
*/
|
|
440
|
+
APPLICATION = 1,
|
|
441
|
+
/**
|
|
442
|
+
* Machine specific configuration, which can be configured only in local and remote user settings.
|
|
443
|
+
*/
|
|
444
|
+
MACHINE = 2,
|
|
445
|
+
/**
|
|
446
|
+
* Window specific configuration, which can be configured in the user or workspace settings.
|
|
447
|
+
*/
|
|
448
|
+
WINDOW = 3,
|
|
449
|
+
/**
|
|
450
|
+
* Resource specific configuration, which can be configured in the user, workspace or folder settings.
|
|
451
|
+
*/
|
|
452
|
+
RESOURCE = 4,
|
|
453
|
+
/**
|
|
454
|
+
* Resource specific configuration that can be configured in language specific settings
|
|
455
|
+
*/
|
|
456
|
+
LANGUAGE_OVERRIDABLE = 5,
|
|
457
|
+
/**
|
|
458
|
+
* Machine specific configuration that can also be configured in workspace or folder settings.
|
|
459
|
+
*/
|
|
460
|
+
MACHINE_OVERRIDABLE = 6
|
|
461
|
+
}
|
|
462
|
+
interface IConfigurationPropertySchema extends IJSONSchema {
|
|
463
|
+
scope?: ConfigurationScope;
|
|
464
|
+
/**
|
|
465
|
+
* When restricted, value of this configuration will be read only from trusted sources.
|
|
466
|
+
* For eg., If the workspace is not trusted, then the value of this configuration is not read from workspace settings file.
|
|
467
|
+
*/
|
|
468
|
+
restricted?: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* When `false` this property is excluded from the registry. Default is to include.
|
|
471
|
+
*/
|
|
472
|
+
included?: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* List of tags associated to the property.
|
|
475
|
+
* - A tag can be used for filtering
|
|
476
|
+
* - Use `experimental` tag for marking the setting as experimental. **Note:** Defaults of experimental settings can be changed by the running experiments.
|
|
477
|
+
*/
|
|
478
|
+
tags?: string[];
|
|
479
|
+
/**
|
|
480
|
+
* When enabled this setting is ignored during sync and user can override this.
|
|
481
|
+
*/
|
|
482
|
+
ignoreSync?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* When enabled this setting is ignored during sync and user cannot override this.
|
|
485
|
+
*/
|
|
486
|
+
disallowSyncIgnore?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Labels for enumeration items
|
|
489
|
+
*/
|
|
490
|
+
enumItemLabels?: string[];
|
|
491
|
+
/**
|
|
492
|
+
* When specified, controls the presentation format of string settings.
|
|
493
|
+
* Otherwise, the presentation format defaults to `singleline`.
|
|
494
|
+
*/
|
|
495
|
+
editPresentation?: EditPresentationTypes;
|
|
496
|
+
/**
|
|
497
|
+
* When specified, gives an order number for the setting
|
|
498
|
+
* within the settings editor. Otherwise, the setting is placed at the end.
|
|
499
|
+
*/
|
|
500
|
+
order?: number;
|
|
501
|
+
}
|
|
502
|
+
interface IExtensionInfo {
|
|
503
|
+
id: string;
|
|
504
|
+
displayName?: string;
|
|
505
|
+
}
|
|
506
|
+
interface IConfigurationNode {
|
|
507
|
+
id?: string;
|
|
508
|
+
order?: number;
|
|
509
|
+
type?: string | string[];
|
|
510
|
+
title?: string;
|
|
511
|
+
description?: string;
|
|
512
|
+
properties?: IStringDictionary<IConfigurationPropertySchema>;
|
|
513
|
+
allOf?: IConfigurationNode[];
|
|
514
|
+
scope?: ConfigurationScope;
|
|
515
|
+
extensionInfo?: IExtensionInfo;
|
|
516
|
+
restrictedProperties?: string[];
|
|
517
|
+
}
|
|
518
|
+
interface IConfigurationDefaults {
|
|
519
|
+
overrides: IStringDictionary<any>;
|
|
520
|
+
source?: IExtensionInfo | string;
|
|
521
|
+
}
|
|
522
|
+
declare type IRegisteredConfigurationPropertySchema = IConfigurationPropertySchema & {
|
|
523
|
+
defaultDefaultValue?: any;
|
|
524
|
+
source?: IExtensionInfo;
|
|
525
|
+
defaultValueSource?: IExtensionInfo | string;
|
|
526
|
+
};
|
|
527
|
+
declare type IConfigurationDefaultOverride = {
|
|
528
|
+
value: any;
|
|
529
|
+
source?: IExtensionInfo | string;
|
|
530
|
+
};
|
|
531
|
+
|
|
288
532
|
type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
|
|
289
533
|
|
|
290
|
-
declare function
|
|
534
|
+
declare function updateUserConfiguration(configurationJson: string): void;
|
|
535
|
+
declare const configurationRegistry: IConfigurationRegistry;
|
|
536
|
+
declare function getServiceOverride(settingsResource?: URI): IEditorOverrideServices;
|
|
291
537
|
|
|
292
|
-
export { getServiceOverride as default };
|
|
538
|
+
export { configurationRegistry, getServiceOverride as default, updateUserConfiguration };
|
package/dist/configuration.js
CHANGED
|
@@ -2162,10 +2162,17 @@ function createConfigurationFileSystemProvider(settingsResource, readConfigurati
|
|
|
2162
2162
|
};
|
|
2163
2163
|
return provider;
|
|
2164
2164
|
}
|
|
2165
|
-
|
|
2165
|
+
let userConfigurationJson = '{}';
|
|
2166
|
+
const userConfigurationChangeEmitter = new Emitter();
|
|
2167
|
+
function updateUserConfiguration(configurationJson) {
|
|
2168
|
+
userConfigurationJson = configurationJson;
|
|
2169
|
+
userConfigurationChangeEmitter.fire(undefined);
|
|
2170
|
+
}
|
|
2171
|
+
const configurationRegistry = Registry.as(Extensions.Configuration);
|
|
2172
|
+
function getServiceOverride(settingsResource = URI.file('/userSettings.json')) {
|
|
2166
2173
|
const logService = StandaloneServices.get(ILogService);
|
|
2167
2174
|
const fileService = new FileService(logService);
|
|
2168
|
-
fileService.registerProvider(Schemas.file, createConfigurationFileSystemProvider(settingsResource,
|
|
2175
|
+
fileService.registerProvider(Schemas.file, createConfigurationFileSystemProvider(settingsResource, () => userConfigurationJson, userConfigurationChangeEmitter.event));
|
|
2169
2176
|
const configurationService = new ConfigurationService(settingsResource, fileService);
|
|
2170
2177
|
configurationService.initialize().catch(error => {
|
|
2171
2178
|
logService.error(error);
|
|
@@ -2175,4 +2182,4 @@ function getServiceOverride(readConfiguration, onChange, settingsResource = URI.
|
|
|
2175
2182
|
[ITextResourceConfigurationService.toString()]: new SyncDescriptor(TextResourceConfigurationService)
|
|
2176
2183
|
};
|
|
2177
2184
|
}
|
|
2178
|
-
export { getServiceOverride as default };
|
|
2185
|
+
export { configurationRegistry, getServiceOverride as default, updateUserConfiguration };
|