@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,441 @@
1
+ import { E as Emitter } from './services2.js';
2
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
3
+ import { getLanguageTagSettingPlainKey } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
4
+ import { isString, isUndefinedOrNull, isUndefined } from 'monaco-editor/esm/vs/base/common/types.js';
5
+ import { distinct } from 'monaco-editor/esm/vs/base/common/arrays.js';
6
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
7
+ import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
8
+ var ConfigurationScope;
9
+ ( (function(ConfigurationScope) {
10
+ ConfigurationScope[ConfigurationScope["APPLICATION"] = 1] = "APPLICATION";
11
+ ConfigurationScope[ConfigurationScope["MACHINE"] = 2] = "MACHINE";
12
+ ConfigurationScope[ConfigurationScope["WINDOW"] = 3] = "WINDOW";
13
+ ConfigurationScope[ConfigurationScope["RESOURCE"] = 4] = "RESOURCE";
14
+ ConfigurationScope[ConfigurationScope["LANGUAGE_OVERRIDABLE"] = 5] = "LANGUAGE_OVERRIDABLE";
15
+ ConfigurationScope[ConfigurationScope["MACHINE_OVERRIDABLE"] = 6] = "MACHINE_OVERRIDABLE";
16
+ })(ConfigurationScope || (ConfigurationScope = {})));
17
+ const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';
18
+ const configurationDefaultsSchemaId = 'vscode://schemas/settings/configurationDefaults';
19
+ const contributionRegistry = ( Registry.as(Extensions.JSONContribution));
20
+ class ConfigurationRegistry {
21
+ constructor() {
22
+ this.overrideIdentifiers = ( new Set());
23
+ this._onDidSchemaChange = ( new Emitter());
24
+ this.onDidSchemaChange = this._onDidSchemaChange.event;
25
+ this._onDidUpdateConfiguration = ( new Emitter());
26
+ this.onDidUpdateConfiguration = this._onDidUpdateConfiguration.event;
27
+ this.configurationDefaultsOverrides = ( new Map());
28
+ this.defaultLanguageConfigurationOverridesNode = {
29
+ id: 'defaultOverrides',
30
+ title: ( localize(
31
+ 'defaultLanguageConfigurationOverrides.title',
32
+ "Default Language Configuration Overrides"
33
+ )),
34
+ properties: {}
35
+ };
36
+ this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];
37
+ this.resourceLanguageSettingsSchema = {
38
+ properties: {},
39
+ patternProperties: {},
40
+ additionalProperties: true,
41
+ allowTrailingCommas: true,
42
+ allowComments: true
43
+ };
44
+ this.configurationProperties = {};
45
+ this.policyConfigurations = ( new Map());
46
+ this.excludedConfigurationProperties = {};
47
+ contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
48
+ this.registerOverridePropertyPatternKey();
49
+ }
50
+ registerConfiguration(configuration, validate = true) {
51
+ this.registerConfigurations([configuration], validate);
52
+ }
53
+ registerConfigurations(configurations, validate = true) {
54
+ const properties = ( new Set());
55
+ this.doRegisterConfigurations(configurations, validate, properties);
56
+ contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
57
+ this._onDidSchemaChange.fire();
58
+ this._onDidUpdateConfiguration.fire({ properties });
59
+ }
60
+ deregisterConfigurations(configurations) {
61
+ const properties = ( new Set());
62
+ this.doDeregisterConfigurations(configurations, properties);
63
+ contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
64
+ this._onDidSchemaChange.fire();
65
+ this._onDidUpdateConfiguration.fire({ properties });
66
+ }
67
+ updateConfigurations({ add, remove }) {
68
+ const properties = ( new Set());
69
+ this.doDeregisterConfigurations(remove, properties);
70
+ this.doRegisterConfigurations(add, false, properties);
71
+ contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
72
+ this._onDidSchemaChange.fire();
73
+ this._onDidUpdateConfiguration.fire({ properties });
74
+ }
75
+ registerDefaultConfigurations(configurationDefaults) {
76
+ const properties = ( new Set());
77
+ this.doRegisterDefaultConfigurations(configurationDefaults, properties);
78
+ this._onDidSchemaChange.fire();
79
+ this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
80
+ }
81
+ doRegisterDefaultConfigurations(configurationDefaults, bucket) {
82
+ const overrideIdentifiers = [];
83
+ for (const { overrides, source } of configurationDefaults) {
84
+ for (const key in overrides) {
85
+ bucket.add(key);
86
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
87
+ const configurationDefaultOverride = this.configurationDefaultsOverrides.get(key);
88
+ const valuesSources = configurationDefaultOverride?.valuesSources ?? ( new Map());
89
+ if (source) {
90
+ for (const configuration of ( Object.keys(overrides[key]))) {
91
+ valuesSources.set(configuration, source);
92
+ }
93
+ }
94
+ const defaultValue = { ...(configurationDefaultOverride?.value || {}), ...overrides[key] };
95
+ this.configurationDefaultsOverrides.set(key, { source, value: defaultValue, valuesSources });
96
+ const plainKey = getLanguageTagSettingPlainKey(key);
97
+ const property = {
98
+ type: 'object',
99
+ default: defaultValue,
100
+ description: ( localize(
101
+ 'defaultLanguageConfiguration.description',
102
+ "Configure settings to be overridden for the {0} language.",
103
+ plainKey
104
+ )),
105
+ $ref: resourceLanguageSettingsSchemaId,
106
+ defaultDefaultValue: defaultValue,
107
+ source: isString(source) ? undefined : source,
108
+ defaultValueSource: source
109
+ };
110
+ overrideIdentifiers.push(...overrideIdentifiersFromKey(key));
111
+ this.configurationProperties[key] = property;
112
+ this.defaultLanguageConfigurationOverridesNode.properties[key] = property;
113
+ }
114
+ else {
115
+ this.configurationDefaultsOverrides.set(key, { value: overrides[key], source });
116
+ const property = this.configurationProperties[key];
117
+ if (property) {
118
+ this.updatePropertyDefaultValue(key, property);
119
+ this.updateSchema(key, property);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ this.doRegisterOverrideIdentifiers(overrideIdentifiers);
125
+ }
126
+ deregisterDefaultConfigurations(defaultConfigurations) {
127
+ const properties = ( new Set());
128
+ this.doDeregisterDefaultConfigurations(defaultConfigurations, properties);
129
+ this._onDidSchemaChange.fire();
130
+ this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
131
+ }
132
+ doDeregisterDefaultConfigurations(defaultConfigurations, bucket) {
133
+ for (const { overrides, source } of defaultConfigurations) {
134
+ for (const key in overrides) {
135
+ const configurationDefaultsOverride = this.configurationDefaultsOverrides.get(key);
136
+ const id = isString(source) ? source : source?.id;
137
+ const configurationDefaultsOverrideSourceId = isString(configurationDefaultsOverride?.source) ? configurationDefaultsOverride?.source : configurationDefaultsOverride?.source?.id;
138
+ if (id !== configurationDefaultsOverrideSourceId) {
139
+ continue;
140
+ }
141
+ bucket.add(key);
142
+ this.configurationDefaultsOverrides.delete(key);
143
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
144
+ delete this.configurationProperties[key];
145
+ delete this.defaultLanguageConfigurationOverridesNode.properties[key];
146
+ }
147
+ else {
148
+ const property = this.configurationProperties[key];
149
+ if (property) {
150
+ this.updatePropertyDefaultValue(key, property);
151
+ this.updateSchema(key, property);
152
+ }
153
+ }
154
+ }
155
+ }
156
+ this.updateOverridePropertyPatternKey();
157
+ }
158
+ deltaConfiguration(delta) {
159
+ let defaultsOverrides = false;
160
+ const properties = ( new Set());
161
+ if (delta.removedDefaults) {
162
+ this.doDeregisterDefaultConfigurations(delta.removedDefaults, properties);
163
+ defaultsOverrides = true;
164
+ }
165
+ if (delta.addedDefaults) {
166
+ this.doRegisterDefaultConfigurations(delta.addedDefaults, properties);
167
+ defaultsOverrides = true;
168
+ }
169
+ if (delta.removedConfigurations) {
170
+ this.doDeregisterConfigurations(delta.removedConfigurations, properties);
171
+ }
172
+ if (delta.addedConfigurations) {
173
+ this.doRegisterConfigurations(delta.addedConfigurations, false, properties);
174
+ }
175
+ this._onDidSchemaChange.fire();
176
+ this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides });
177
+ }
178
+ notifyConfigurationSchemaUpdated(...configurations) {
179
+ this._onDidSchemaChange.fire();
180
+ }
181
+ registerOverrideIdentifiers(overrideIdentifiers) {
182
+ this.doRegisterOverrideIdentifiers(overrideIdentifiers);
183
+ this._onDidSchemaChange.fire();
184
+ }
185
+ doRegisterOverrideIdentifiers(overrideIdentifiers) {
186
+ for (const overrideIdentifier of overrideIdentifiers) {
187
+ this.overrideIdentifiers.add(overrideIdentifier);
188
+ }
189
+ this.updateOverridePropertyPatternKey();
190
+ }
191
+ doRegisterConfigurations(configurations, validate, bucket) {
192
+ configurations.forEach(configuration => {
193
+ this.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties, undefined, bucket);
194
+ this.configurationContributors.push(configuration);
195
+ this.registerJSONConfiguration(configuration);
196
+ });
197
+ }
198
+ doDeregisterConfigurations(configurations, bucket) {
199
+ const deregisterConfiguration = (configuration) => {
200
+ if (configuration.properties) {
201
+ for (const key in configuration.properties) {
202
+ bucket.add(key);
203
+ const property = this.configurationProperties[key];
204
+ if (property?.policy?.name) {
205
+ this.policyConfigurations.delete(property.policy.name);
206
+ }
207
+ delete this.configurationProperties[key];
208
+ this.removeFromSchema(key, configuration.properties[key]);
209
+ }
210
+ }
211
+ configuration.allOf?.forEach(node => deregisterConfiguration(node));
212
+ };
213
+ for (const configuration of configurations) {
214
+ deregisterConfiguration(configuration);
215
+ const index = this.configurationContributors.indexOf(configuration);
216
+ if (index !== -1) {
217
+ this.configurationContributors.splice(index, 1);
218
+ }
219
+ }
220
+ }
221
+ validateAndRegisterProperties(configuration, validate = true, extensionInfo, restrictedProperties, scope = 3 , bucket) {
222
+ scope = isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;
223
+ const properties = configuration.properties;
224
+ if (properties) {
225
+ for (const key in properties) {
226
+ const property = properties[key];
227
+ if (validate && validateProperty(key, property)) {
228
+ delete properties[key];
229
+ continue;
230
+ }
231
+ property.source = extensionInfo;
232
+ property.defaultDefaultValue = properties[key].default;
233
+ this.updatePropertyDefaultValue(key, property);
234
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
235
+ property.scope = undefined;
236
+ }
237
+ else {
238
+ property.scope = isUndefinedOrNull(property.scope) ? scope : property.scope;
239
+ property.restricted = isUndefinedOrNull(property.restricted) ? !!restrictedProperties?.includes(key) : property.restricted;
240
+ }
241
+ if (properties[key].hasOwnProperty('included') && !properties[key].included) {
242
+ this.excludedConfigurationProperties[key] = properties[key];
243
+ delete properties[key];
244
+ continue;
245
+ }
246
+ else {
247
+ this.configurationProperties[key] = properties[key];
248
+ if (properties[key].policy?.name) {
249
+ this.policyConfigurations.set(properties[key].policy.name, key);
250
+ }
251
+ }
252
+ if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {
253
+ properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;
254
+ }
255
+ bucket.add(key);
256
+ }
257
+ }
258
+ const subNodes = configuration.allOf;
259
+ if (subNodes) {
260
+ for (const node of subNodes) {
261
+ this.validateAndRegisterProperties(node, validate, extensionInfo, restrictedProperties, scope, bucket);
262
+ }
263
+ }
264
+ }
265
+ getConfigurations() {
266
+ return this.configurationContributors;
267
+ }
268
+ getConfigurationProperties() {
269
+ return this.configurationProperties;
270
+ }
271
+ getPolicyConfigurations() {
272
+ return this.policyConfigurations;
273
+ }
274
+ getExcludedConfigurationProperties() {
275
+ return this.excludedConfigurationProperties;
276
+ }
277
+ getConfigurationDefaultsOverrides() {
278
+ return this.configurationDefaultsOverrides;
279
+ }
280
+ registerJSONConfiguration(configuration) {
281
+ const register = (configuration) => {
282
+ const properties = configuration.properties;
283
+ if (properties) {
284
+ for (const key in properties) {
285
+ this.updateSchema(key, properties[key]);
286
+ }
287
+ }
288
+ const subNodes = configuration.allOf;
289
+ subNodes?.forEach(register);
290
+ };
291
+ register(configuration);
292
+ }
293
+ updateSchema(key, property) {
294
+ switch (property.scope) {
295
+ case 1 :
296
+ break;
297
+ case 2 :
298
+ break;
299
+ case 6 :
300
+ break;
301
+ case 3 :
302
+ break;
303
+ case 4 :
304
+ break;
305
+ case 5 :
306
+ this.resourceLanguageSettingsSchema.properties[key] = property;
307
+ break;
308
+ }
309
+ }
310
+ removeFromSchema(key, property) {
311
+ switch (property.scope) {
312
+ case 1 :
313
+ break;
314
+ case 2 :
315
+ break;
316
+ case 6 :
317
+ break;
318
+ case 3 :
319
+ break;
320
+ case 4 :
321
+ case 5 :
322
+ delete this.resourceLanguageSettingsSchema.properties[key];
323
+ break;
324
+ }
325
+ }
326
+ updateOverridePropertyPatternKey() {
327
+ for (const overrideIdentifier of ( this.overrideIdentifiers.values())) {
328
+ const overrideIdentifierProperty = `[${overrideIdentifier}]`;
329
+ const resourceLanguagePropertiesSchema = {
330
+ type: 'object',
331
+ description: ( localize(
332
+ 'overrideSettings.defaultDescription',
333
+ "Configure editor settings to be overridden for a language."
334
+ )),
335
+ errorMessage: ( localize(
336
+ 'overrideSettings.errorMessage',
337
+ "This setting does not support per-language configuration."
338
+ )),
339
+ $ref: resourceLanguageSettingsSchemaId,
340
+ };
341
+ this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);
342
+ }
343
+ }
344
+ registerOverridePropertyPatternKey() {
345
+ this._onDidSchemaChange.fire();
346
+ }
347
+ updatePropertyDefaultValue(key, property) {
348
+ const configurationdefaultOverride = this.configurationDefaultsOverrides.get(key);
349
+ let defaultValue = configurationdefaultOverride?.value;
350
+ let defaultSource = configurationdefaultOverride?.source;
351
+ if (isUndefined(defaultValue)) {
352
+ defaultValue = property.defaultDefaultValue;
353
+ defaultSource = undefined;
354
+ }
355
+ if (isUndefined(defaultValue)) {
356
+ defaultValue = getDefaultValue(property.type);
357
+ }
358
+ property.default = defaultValue;
359
+ property.defaultValueSource = defaultSource;
360
+ }
361
+ }
362
+ const OVERRIDE_IDENTIFIER_PATTERN = `\\[([^\\]]+)\\]`;
363
+ const OVERRIDE_IDENTIFIER_REGEX = ( new RegExp(OVERRIDE_IDENTIFIER_PATTERN, 'g'));
364
+ const OVERRIDE_PROPERTY_PATTERN = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;
365
+ const OVERRIDE_PROPERTY_REGEX = ( new RegExp(OVERRIDE_PROPERTY_PATTERN));
366
+ function overrideIdentifiersFromKey(key) {
367
+ const identifiers = [];
368
+ if (OVERRIDE_PROPERTY_REGEX.test(key)) {
369
+ let matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
370
+ while (matches?.length) {
371
+ const identifier = matches[1].trim();
372
+ if (identifier) {
373
+ identifiers.push(identifier);
374
+ }
375
+ matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
376
+ }
377
+ }
378
+ return distinct(identifiers);
379
+ }
380
+ function keyFromOverrideIdentifiers(overrideIdentifiers) {
381
+ return overrideIdentifiers.reduce((result, overrideIdentifier) => `${result}[${overrideIdentifier}]`, '');
382
+ }
383
+ function getDefaultValue(type) {
384
+ const t = Array.isArray(type) ? type[0] : type;
385
+ switch (t) {
386
+ case 'boolean':
387
+ return false;
388
+ case 'integer':
389
+ case 'number':
390
+ return 0;
391
+ case 'string':
392
+ return '';
393
+ case 'array':
394
+ return [];
395
+ case 'object':
396
+ return {};
397
+ default:
398
+ return null;
399
+ }
400
+ }
401
+ const configurationRegistry = ( new ConfigurationRegistry());
402
+ function validateProperty(property, schema) {
403
+ if (!property.trim()) {
404
+ return ( localize('config.property.empty', "Cannot register an empty property"));
405
+ }
406
+ if (OVERRIDE_PROPERTY_REGEX.test(property)) {
407
+ return ( localize(
408
+ 'config.property.languageDefault',
409
+ "Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",
410
+ property
411
+ ));
412
+ }
413
+ if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {
414
+ return ( localize(
415
+ 'config.property.duplicate',
416
+ "Cannot register '{0}'. This property is already registered.",
417
+ property
418
+ ));
419
+ }
420
+ if (schema.policy?.name && configurationRegistry.getPolicyConfigurations().get(schema.policy?.name) !== undefined) {
421
+ return ( localize(
422
+ 'config.policy.duplicate',
423
+ "Cannot register '{0}'. The associated policy {1} is already registered with {2}.",
424
+ property,
425
+ schema.policy?.name,
426
+ configurationRegistry.getPolicyConfigurations().get(schema.policy?.name)
427
+ ));
428
+ }
429
+ return null;
430
+ }
431
+ function getScopes() {
432
+ const scopes = [];
433
+ const configurationProperties = configurationRegistry.getConfigurationProperties();
434
+ for (const key of ( Object.keys(configurationProperties))) {
435
+ scopes.push([key, configurationProperties[key].scope]);
436
+ }
437
+ scopes.push(['launch', 4 ]);
438
+ scopes.push(['task', 4 ]);
439
+ return scopes;
440
+ }
441
+ export { ConfigurationScope as C, configurationDefaultsSchemaId as c, getScopes as g, keyFromOverrideIdentifiers as k };
@@ -0,0 +1,211 @@
1
+ import { registerColor, editorBackground, widgetBorder, contrastBorder, editorWidgetBackground, lighten, darken } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
2
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
3
+ import { _ as __decorate, a as __param, n as IFileService } from './services2.js';
4
+ import { RawContextKey, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
5
+ import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
6
+ import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
7
+ import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
8
+ import { isEqual, basename, dirname, extname } from 'monaco-editor/esm/vs/base/common/resources.js';
9
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
10
+ function isErrorWithActions(obj) {
11
+ const candidate = obj;
12
+ return candidate instanceof Error && Array.isArray(candidate.actions);
13
+ }
14
+ function createErrorWithActions(messageOrError, actions) {
15
+ let error;
16
+ if (typeof messageOrError === 'string') {
17
+ error = ( new Error(messageOrError));
18
+ }
19
+ else {
20
+ error = messageOrError;
21
+ }
22
+ error.actions = actions;
23
+ return error;
24
+ }
25
+ const PANEL_BACKGROUND = ( registerColor('panel.background', {
26
+ dark: editorBackground,
27
+ light: editorBackground,
28
+ hcDark: editorBackground,
29
+ hcLight: editorBackground
30
+ }, ( localize(
31
+ 'panelBackground',
32
+ "Panel background color. Panels are shown below the editor area and contain views like output and integrated terminal."
33
+ ))));
34
+ const SIDE_BAR_BACKGROUND = ( registerColor('sideBar.background', {
35
+ dark: '#252526',
36
+ light: '#F3F3F3',
37
+ hcDark: '#000000',
38
+ hcLight: '#FFFFFF'
39
+ }, ( localize(
40
+ 'sideBarBackground',
41
+ "Side bar background color. The side bar is the container for views like explorer and search."
42
+ ))));
43
+ const NOTIFICATIONS_CENTER_BORDER = ( registerColor('notificationCenter.border', {
44
+ dark: widgetBorder,
45
+ light: widgetBorder,
46
+ hcDark: contrastBorder,
47
+ hcLight: contrastBorder
48
+ }, ( localize(
49
+ 'notificationCenterBorder',
50
+ "Notifications center border color. Notifications slide in from the bottom right of the window."
51
+ ))));
52
+ const NOTIFICATIONS_TOAST_BORDER = ( registerColor('notificationToast.border', {
53
+ dark: widgetBorder,
54
+ light: widgetBorder,
55
+ hcDark: contrastBorder,
56
+ hcLight: contrastBorder
57
+ }, ( localize(
58
+ 'notificationToastBorder',
59
+ "Notification toast border color. Notifications slide in from the bottom right of the window."
60
+ ))));
61
+ const NOTIFICATIONS_BACKGROUND = ( registerColor('notifications.background', {
62
+ dark: editorWidgetBackground,
63
+ light: editorWidgetBackground,
64
+ hcDark: editorWidgetBackground,
65
+ hcLight: editorWidgetBackground
66
+ }, ( localize(
67
+ 'notificationsBackground',
68
+ "Notifications background color. Notifications slide in from the bottom right of the window."
69
+ ))));
70
+ const NOTIFICATIONS_CENTER_HEADER_FOREGROUND = ( registerColor('notificationCenterHeader.foreground', {
71
+ dark: null,
72
+ light: null,
73
+ hcDark: null,
74
+ hcLight: null
75
+ }, ( localize(
76
+ 'notificationCenterHeaderForeground',
77
+ "Notifications center header foreground color. Notifications slide in from the bottom right of the window."
78
+ ))));
79
+ const NOTIFICATIONS_CENTER_HEADER_BACKGROUND = ( registerColor('notificationCenterHeader.background', {
80
+ dark: ( lighten(NOTIFICATIONS_BACKGROUND, 0.3)),
81
+ light: ( darken(NOTIFICATIONS_BACKGROUND, 0.05)),
82
+ hcDark: NOTIFICATIONS_BACKGROUND,
83
+ hcLight: NOTIFICATIONS_BACKGROUND
84
+ }, ( localize(
85
+ 'notificationCenterHeaderBackground',
86
+ "Notifications center header background color. Notifications slide in from the bottom right of the window."
87
+ ))));
88
+ const NotificationFocusedContext = ( new RawContextKey('notificationFocus', true, ( localize('notificationFocus', "Whether a notification has keyboard focus"))));
89
+ const NotificationsCenterVisibleContext = ( new RawContextKey('notificationCenterVisible', false, ( localize('notificationCenterVisible', "Whether the notifications center is visible"))));
90
+ const NotificationsToastsVisibleContext = ( new RawContextKey('notificationToastsVisible', false, ( localize('notificationToastsVisible', "Whether a notification toast is visible"))));
91
+ const PanelFocusContext = ( new RawContextKey('panelFocus', false, ( localize('panelFocus', "Whether the panel has keyboard focus"))));
92
+ let ResourceContextKey = class ResourceContextKey {
93
+ constructor(_contextKeyService, _fileService, _languageService, _modelService) {
94
+ this._contextKeyService = _contextKeyService;
95
+ this._fileService = _fileService;
96
+ this._languageService = _languageService;
97
+ this._modelService = _modelService;
98
+ this._disposables = ( new DisposableStore());
99
+ this._schemeKey = ResourceContextKey.Scheme.bindTo(this._contextKeyService);
100
+ this._filenameKey = ResourceContextKey.Filename.bindTo(this._contextKeyService);
101
+ this._dirnameKey = ResourceContextKey.Dirname.bindTo(this._contextKeyService);
102
+ this._pathKey = ResourceContextKey.Path.bindTo(this._contextKeyService);
103
+ this._langIdKey = ResourceContextKey.LangId.bindTo(this._contextKeyService);
104
+ this._resourceKey = ResourceContextKey.Resource.bindTo(this._contextKeyService);
105
+ this._extensionKey = ResourceContextKey.Extension.bindTo(this._contextKeyService);
106
+ this._hasResource = ResourceContextKey.HasResource.bindTo(this._contextKeyService);
107
+ this._isFileSystemResource = ResourceContextKey.IsFileSystemResource.bindTo(this._contextKeyService);
108
+ this._disposables.add(_fileService.onDidChangeFileSystemProviderRegistrations(() => {
109
+ const resource = this.get();
110
+ this._isFileSystemResource.set(Boolean(resource && _fileService.hasProvider(resource)));
111
+ }));
112
+ this._disposables.add(_modelService.onModelAdded(model => {
113
+ if (isEqual(model.uri, this.get())) {
114
+ this._setLangId();
115
+ }
116
+ }));
117
+ this._disposables.add(_modelService.onModelLanguageChanged(e => {
118
+ if (isEqual(e.model.uri, this.get())) {
119
+ this._setLangId();
120
+ }
121
+ }));
122
+ }
123
+ dispose() {
124
+ this._disposables.dispose();
125
+ }
126
+ _setLangId() {
127
+ const value = this.get();
128
+ if (!value) {
129
+ this._langIdKey.set(null);
130
+ return;
131
+ }
132
+ const langId = this._modelService.getModel(value)?.getLanguageId() ?? this._languageService.guessLanguageIdByFilepathOrFirstLine(value);
133
+ this._langIdKey.set(langId);
134
+ }
135
+ set(value) {
136
+ value = value ?? undefined;
137
+ if (isEqual(this._value, value)) {
138
+ return;
139
+ }
140
+ this._value = value;
141
+ this._contextKeyService.bufferChangeEvents(() => {
142
+ this._resourceKey.set(value ? ( value.toString()) : null);
143
+ this._schemeKey.set(value ? value.scheme : null);
144
+ this._filenameKey.set(value ? basename(value) : null);
145
+ this._dirnameKey.set(value ? this.uriToPath(dirname(value)) : null);
146
+ this._pathKey.set(value ? this.uriToPath(value) : null);
147
+ this._setLangId();
148
+ this._extensionKey.set(value ? extname(value) : null);
149
+ this._hasResource.set(Boolean(value));
150
+ this._isFileSystemResource.set(value ? this._fileService.hasProvider(value) : false);
151
+ });
152
+ }
153
+ uriToPath(uri) {
154
+ if (uri.scheme === Schemas.file) {
155
+ return uri.fsPath;
156
+ }
157
+ return uri.path;
158
+ }
159
+ reset() {
160
+ this._value = undefined;
161
+ this._contextKeyService.bufferChangeEvents(() => {
162
+ this._resourceKey.reset();
163
+ this._schemeKey.reset();
164
+ this._filenameKey.reset();
165
+ this._dirnameKey.reset();
166
+ this._pathKey.reset();
167
+ this._langIdKey.reset();
168
+ this._extensionKey.reset();
169
+ this._hasResource.reset();
170
+ this._isFileSystemResource.reset();
171
+ });
172
+ }
173
+ get() {
174
+ return this._value;
175
+ }
176
+ };
177
+ ResourceContextKey.Scheme = ( new RawContextKey('resourceScheme', undefined, { type: 'string', description: ( localize('resourceScheme', "The scheme of the resource")) }));
178
+ ResourceContextKey.Filename = ( new RawContextKey(
179
+ 'resourceFilename',
180
+ undefined,
181
+ { type: 'string', description: ( localize('resourceFilename', "The file name of the resource")) }
182
+ ));
183
+ ResourceContextKey.Dirname = ( new RawContextKey(
184
+ 'resourceDirname',
185
+ undefined,
186
+ { type: 'string', description: ( localize('resourceDirname', "The folder name the resource is contained in")) }
187
+ ));
188
+ ResourceContextKey.Path = ( new RawContextKey('resourcePath', undefined, { type: 'string', description: ( localize('resourcePath', "The full path of the resource")) }));
189
+ ResourceContextKey.LangId = ( new RawContextKey('resourceLangId', undefined, { type: 'string', description: ( localize('resourceLangId', "The language identifier of the resource")) }));
190
+ ResourceContextKey.Resource = ( new RawContextKey('resource', undefined, { type: 'URI', description: ( localize('resource', "The full value of the resource including scheme and path")) }));
191
+ ResourceContextKey.Extension = ( new RawContextKey(
192
+ 'resourceExtname',
193
+ undefined,
194
+ { type: 'string', description: ( localize('resourceExtname', "The extension name of the resource")) }
195
+ ));
196
+ ResourceContextKey.HasResource = ( new RawContextKey('resourceSet', undefined, { type: 'boolean', description: ( localize('resourceSet', "Whether a resource is present or not")) }));
197
+ ResourceContextKey.IsFileSystemResource = ( new RawContextKey(
198
+ 'isFileSystemResource',
199
+ undefined,
200
+ { type: 'boolean', description: ( localize(
201
+ 'isFileSystemResource',
202
+ "Whether the resource is backed by a file system provider"
203
+ )) }
204
+ ));
205
+ ResourceContextKey = ( __decorate([
206
+ ( __param(0, IContextKeyService)),
207
+ ( __param(1, IFileService)),
208
+ ( __param(2, ILanguageService)),
209
+ ( __param(3, IModelService))
210
+ ], ResourceContextKey));
211
+ export { NotificationsToastsVisibleContext as N, PanelFocusContext as P, SIDE_BAR_BACKGROUND as S, NOTIFICATIONS_BACKGROUND as a, NOTIFICATIONS_TOAST_BORDER as b, NotificationsCenterVisibleContext as c, NOTIFICATIONS_CENTER_BORDER as d, NOTIFICATIONS_CENTER_HEADER_FOREGROUND as e, NOTIFICATIONS_CENTER_HEADER_BACKGROUND as f, NotificationFocusedContext as g, PANEL_BACKGROUND as h, isErrorWithActions as i, createErrorWithActions as j };
@@ -0,0 +1,22 @@
1
+ import * as monaco from 'monaco-editor';
2
+
3
+ type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
4
+
5
+ interface IRawLanguageExtensionPoint {
6
+ id: string;
7
+ extensions: string[];
8
+ filenames: string[];
9
+ filenamePatterns: string[];
10
+ firstLine: string;
11
+ aliases: string[];
12
+ mimetypes: string[];
13
+ configuration: string;
14
+ icon: {
15
+ light: string;
16
+ dark: string;
17
+ };
18
+ }
19
+
20
+ declare function getServiceOverride(): IEditorOverrideServices;
21
+
22
+ export { IRawLanguageExtensionPoint, getServiceOverride as default };