@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
@@ -1,18 +1,18 @@
1
- import { E as Emitter, _ as __decorate, a as __param } from './contextkey.js';
2
- import { I as IPolicyService, N as NullPolicyService, b as NullPolicyConfiguration, P as PolicyConfiguration, U as UserSettings, c as parseTree, d as findNodeAtLocation, e as createScanner } from './polyfill.js';
3
- import { c as IExtensionService, I as ILifecycleService } from './missing-services.js';
1
+ import { J as IUserDataProfilesService, n as IFileService, E as Emitter, _ as __decorate, a as __param, o as IWorkbenchEnvironmentService } from './services2.js';
2
+ import { o as onServicesInitialized, P as Position, I as IPolicyService, k as NullPolicyService, l as NullPolicyConfiguration, q as PolicyConfiguration, U as UserSettings } from './polyfill.js';
3
+ import { bp as IExtensionService, bL as ILifecycleService } from './missing-services.js';
4
4
  import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
5
5
  import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
6
6
  import { DefaultConfiguration } from 'monaco-editor/esm/vs/platform/configuration/common/configurations.js';
7
7
  import { extUriBiasedIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
8
8
  import { Configuration, ConfigurationModel, ConfigurationChangeEvent } from 'monaco-editor/esm/vs/platform/configuration/common/configurationModels.js';
9
9
  import { RunOnceScheduler, Delayer } from 'monaco-editor/esm/vs/base/common/async.js';
10
- import { bn as Position$2, bo as keyFromOverrideIdentifiers, bp as configurationDefaultsSchemaId } from './extHost.js';
11
- export { bq as ConfigurationScope } from './extHost.js';
12
10
  import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
13
11
  import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
14
12
  import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
15
- import { r as IUserDataProfilesService, c as IFileService, l as IWorkbenchEnvironmentService } from './services2.js';
13
+ import { d as defaultSettingsSchemaId, u as userSettingsSchemaId, p as profileSettingsSchemaId, m as machineSettingsSchemaId, w as workspaceSettingsSchemaId, f as folderSettingsSchemaId, s as setProperty } from './configuration2.js';
14
+ import { k as keyFromOverrideIdentifiers, c as configurationDefaultsSchemaId } from './configurationRegistry.js';
15
+ export { C as ConfigurationScope } from './configurationRegistry.js';
16
16
  import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
17
17
  import { Extensions, applicationSettings, windowSettings, resourceSettings, allSettings, machineSettings, machineOverridableSettings, OVERRIDE_PROPERTY_PATTERN, resourceLanguageSettingsSchemaId } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
18
18
  import { localize } from 'monaco-editor/esm/vs/nls.js';
@@ -22,7 +22,6 @@ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform
22
22
  import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
23
23
  import { g as getServiceOverride$2 } from './workspaceContext.js';
24
24
  import { g as getServiceOverride$1 } from './files.js';
25
- import { o as onServicesInitialized } from './tools.js';
26
25
  import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
27
26
  import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
28
27
  import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
@@ -42,328 +41,6 @@ function isConfigurationUpdateOverrides(thing) {
42
41
  && !thing.overrideIdentifier
43
42
  && (!thing.resource || thing.resource instanceof URI);
44
43
  }
45
- function format(documentText, range, options) {
46
- let initialIndentLevel;
47
- let formatText;
48
- let formatTextStart;
49
- let rangeStart;
50
- let rangeEnd;
51
- if (range) {
52
- rangeStart = range.offset;
53
- rangeEnd = rangeStart + range.length;
54
- formatTextStart = rangeStart;
55
- while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
56
- formatTextStart--;
57
- }
58
- let endOffset = rangeEnd;
59
- while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
60
- endOffset++;
61
- }
62
- formatText = documentText.substring(formatTextStart, endOffset);
63
- initialIndentLevel = computeIndentLevel(formatText, options);
64
- }
65
- else {
66
- formatText = documentText;
67
- initialIndentLevel = 0;
68
- formatTextStart = 0;
69
- rangeStart = 0;
70
- rangeEnd = documentText.length;
71
- }
72
- const eol = getEOL(options, documentText);
73
- let lineBreak = false;
74
- let indentLevel = 0;
75
- let indentValue;
76
- if (options.insertSpaces) {
77
- indentValue = repeat(' ', options.tabSize || 4);
78
- }
79
- else {
80
- indentValue = '\t';
81
- }
82
- const scanner = createScanner(formatText, false);
83
- let hasError = false;
84
- function newLineAndIndent() {
85
- return eol + repeat(indentValue, initialIndentLevel + indentLevel);
86
- }
87
- function scanNext() {
88
- let token = scanner.scan();
89
- lineBreak = false;
90
- while (token === 15 || token === 14 ) {
91
- lineBreak = lineBreak || ((token === 14) );
92
- token = scanner.scan();
93
- }
94
- hasError = token === 16 || scanner.getTokenError() !== 0 ;
95
- return token;
96
- }
97
- const editOperations = [];
98
- function addEdit(text, startOffset, endOffset) {
99
- if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
100
- editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
101
- }
102
- }
103
- let firstToken = scanNext();
104
- if (firstToken !== 17 ) {
105
- const firstTokenStart = scanner.getTokenOffset() + formatTextStart;
106
- const initialIndent = repeat(indentValue, initialIndentLevel);
107
- addEdit(initialIndent, formatTextStart, firstTokenStart);
108
- }
109
- while (firstToken !== 17 ) {
110
- let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
111
- let secondToken = scanNext();
112
- let replaceContent = '';
113
- while (!lineBreak && ((secondToken === 12 || secondToken === 13) )) {
114
- const commentTokenStart = scanner.getTokenOffset() + formatTextStart;
115
- addEdit(' ', firstTokenEnd, commentTokenStart);
116
- firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
117
- replaceContent = secondToken === 12 ? newLineAndIndent() : '';
118
- secondToken = scanNext();
119
- }
120
- if (secondToken === 2 ) {
121
- if (firstToken !== 1 ) {
122
- indentLevel--;
123
- replaceContent = newLineAndIndent();
124
- }
125
- }
126
- else if (secondToken === 4 ) {
127
- if (firstToken !== 3 ) {
128
- indentLevel--;
129
- replaceContent = newLineAndIndent();
130
- }
131
- }
132
- else {
133
- switch (firstToken) {
134
- case 3 :
135
- case 1 :
136
- indentLevel++;
137
- replaceContent = newLineAndIndent();
138
- break;
139
- case 5 :
140
- case 12 :
141
- replaceContent = newLineAndIndent();
142
- break;
143
- case 13 :
144
- if (lineBreak) {
145
- replaceContent = newLineAndIndent();
146
- }
147
- else {
148
- replaceContent = ' ';
149
- }
150
- break;
151
- case 6 :
152
- replaceContent = ' ';
153
- break;
154
- case 10 :
155
- if (secondToken === 6 ) {
156
- replaceContent = '';
157
- break;
158
- }
159
- case 7 :
160
- case 8 :
161
- case 9 :
162
- case 11 :
163
- case 2 :
164
- case 4 :
165
- if (secondToken === 12 || secondToken === 13 ) {
166
- replaceContent = ' ';
167
- }
168
- else if (secondToken !== 5 && secondToken !== 17 ) {
169
- hasError = true;
170
- }
171
- break;
172
- case 16 :
173
- hasError = true;
174
- break;
175
- }
176
- if (lineBreak && ((secondToken === 12 || secondToken === 13) )) {
177
- replaceContent = newLineAndIndent();
178
- }
179
- }
180
- const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
181
- addEdit(replaceContent, firstTokenEnd, secondTokenStart);
182
- firstToken = secondToken;
183
- }
184
- return editOperations;
185
- }
186
- function repeat(s, count) {
187
- let result = '';
188
- for (let i = 0; i < count; i++) {
189
- result += s;
190
- }
191
- return result;
192
- }
193
- function computeIndentLevel(content, options) {
194
- let i = 0;
195
- let nChars = 0;
196
- const tabSize = options.tabSize || 4;
197
- while (i < content.length) {
198
- const ch = content.charAt(i);
199
- if (ch === ' ') {
200
- nChars++;
201
- }
202
- else if (ch === '\t') {
203
- nChars += tabSize;
204
- }
205
- else {
206
- break;
207
- }
208
- i++;
209
- }
210
- return Math.floor(nChars / tabSize);
211
- }
212
- function getEOL(options, text) {
213
- for (let i = 0; i < text.length; i++) {
214
- const ch = text.charAt(i);
215
- if (ch === '\r') {
216
- if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
217
- return '\r\n';
218
- }
219
- return '\r';
220
- }
221
- else if (ch === '\n') {
222
- return '\n';
223
- }
224
- }
225
- return (options && options.eol) || '\n';
226
- }
227
- function isEOL(text, offset) {
228
- return '\r\n'.indexOf(text.charAt(offset)) !== -1;
229
- }
230
- function setProperty(text, originalPath, value, formattingOptions, getInsertionIndex) {
231
- const path = originalPath.slice();
232
- const errors = [];
233
- const root = parseTree(text, errors);
234
- let parent = undefined;
235
- let lastSegment = undefined;
236
- while (path.length > 0) {
237
- lastSegment = path.pop();
238
- parent = findNodeAtLocation(root, path);
239
- if (parent === undefined && value !== undefined) {
240
- if (typeof lastSegment === 'string') {
241
- value = { [lastSegment]: value };
242
- }
243
- else {
244
- value = [value];
245
- }
246
- }
247
- else {
248
- break;
249
- }
250
- }
251
- if (!parent) {
252
- if (value === undefined) {
253
- throw new Error('Can not delete in empty document');
254
- }
255
- return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, formattingOptions);
256
- }
257
- else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {
258
- const existing = findNodeAtLocation(parent, [lastSegment]);
259
- if (existing !== undefined) {
260
- if (value === undefined) {
261
- if (!existing.parent) {
262
- throw new Error('Malformed AST');
263
- }
264
- const propertyIndex = parent.children.indexOf(existing.parent);
265
- let removeBegin;
266
- let removeEnd = existing.parent.offset + existing.parent.length;
267
- if (propertyIndex > 0) {
268
- const previous = parent.children[propertyIndex - 1];
269
- removeBegin = previous.offset + previous.length;
270
- }
271
- else {
272
- removeBegin = parent.offset + 1;
273
- if (parent.children.length > 1) {
274
- const next = parent.children[1];
275
- removeEnd = next.offset;
276
- }
277
- }
278
- return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, formattingOptions);
279
- }
280
- else {
281
- return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, formattingOptions);
282
- }
283
- }
284
- else {
285
- if (value === undefined) {
286
- return [];
287
- }
288
- const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
289
- const index = getInsertionIndex ? getInsertionIndex(parent.children.map(p => p.children[0].value)) : parent.children.length;
290
- let edit;
291
- if (index > 0) {
292
- const previous = parent.children[index - 1];
293
- edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
294
- }
295
- else if (parent.children.length === 0) {
296
- edit = { offset: parent.offset + 1, length: 0, content: newProperty };
297
- }
298
- else {
299
- edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };
300
- }
301
- return withFormatting(text, edit, formattingOptions);
302
- }
303
- }
304
- else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {
305
- if (value !== undefined) {
306
- const newProperty = `${JSON.stringify(value)}`;
307
- let edit;
308
- if (parent.children.length === 0 || lastSegment === 0) {
309
- edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };
310
- }
311
- else {
312
- const index = lastSegment === -1 || lastSegment > parent.children.length ? parent.children.length : lastSegment;
313
- const previous = parent.children[index - 1];
314
- edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
315
- }
316
- return withFormatting(text, edit, formattingOptions);
317
- }
318
- else {
319
- const removalIndex = lastSegment;
320
- const toRemove = parent.children[removalIndex];
321
- let edit;
322
- if (parent.children.length === 1) {
323
- edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };
324
- }
325
- else if (parent.children.length - 1 === removalIndex) {
326
- const previous = parent.children[removalIndex - 1];
327
- const offset = previous.offset + previous.length;
328
- const parentEndOffset = parent.offset + parent.length;
329
- edit = { offset, length: parentEndOffset - 2 - offset, content: '' };
330
- }
331
- else {
332
- edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };
333
- }
334
- return withFormatting(text, edit, formattingOptions);
335
- }
336
- }
337
- else {
338
- throw new Error(`Can not add ${typeof lastSegment !== 'number' ? 'index' : 'property'} to parent of type ${parent.type}`);
339
- }
340
- }
341
- function withFormatting(text, edit, formattingOptions) {
342
- let newText = applyEdit(text, edit);
343
- let begin = edit.offset;
344
- let end = edit.offset + edit.content.length;
345
- if (edit.length === 0 || edit.content.length === 0) {
346
- while (begin > 0 && !isEOL(newText, begin - 1)) {
347
- begin--;
348
- }
349
- while (end < newText.length && !isEOL(newText, end)) {
350
- end++;
351
- }
352
- }
353
- const edits = format(newText, { offset: begin, length: end - begin }, formattingOptions);
354
- for (let i = edits.length - 1; i >= 0; i--) {
355
- const curr = edits[i];
356
- newText = applyEdit(newText, curr);
357
- begin = Math.min(begin, curr.offset);
358
- end = Math.max(end, curr.offset + curr.length);
359
- end += curr.content.length - curr.length;
360
- }
361
- const editLength = text.length - (newText.length - end) - begin;
362
- return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
363
- }
364
- function applyEdit(text, edit) {
365
- return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
366
- }
367
44
  class ConfigurationService extends Disposable {
368
45
  constructor(settingsResource, fileService, policyService, logService) {
369
46
  super();
@@ -459,7 +136,7 @@ let TextResourceConfigurationService = class TextResourceConfigurationService ex
459
136
  }
460
137
  getValue(resource, arg2, arg3) {
461
138
  if (typeof arg3 === 'string') {
462
- return this._getValue(resource, Position$2.isIPosition(arg2) ? arg2 : null, arg3);
139
+ return this._getValue(resource, Position.isIPosition(arg2) ? arg2 : null, arg3);
463
140
  }
464
141
  return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined);
465
142
  }
@@ -551,20 +228,6 @@ TextResourceConfigurationService = ( (__decorate([
551
228
  ( (__param(1, IModelService))),
552
229
  ( (__param(2, ILanguageService)))
553
230
  ], TextResourceConfigurationService)));
554
- const FOLDER_CONFIG_FOLDER_NAME = '.vscode';
555
- const defaultSettingsSchemaId = 'vscode://schemas/settings/default';
556
- const userSettingsSchemaId = 'vscode://schemas/settings/user';
557
- const profileSettingsSchemaId = 'vscode://schemas/settings/profile';
558
- const machineSettingsSchemaId = 'vscode://schemas/settings/machine';
559
- const workspaceSettingsSchemaId = 'vscode://schemas/settings/workspace';
560
- const folderSettingsSchemaId = 'vscode://schemas/settings/folder';
561
- const TASKS_CONFIGURATION_KEY = 'tasks';
562
- const LAUNCH_CONFIGURATION_KEY = 'launch';
563
- const WORKSPACE_STANDALONE_CONFIGURATIONS = Object.create(null);
564
- WORKSPACE_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${FOLDER_CONFIG_FOLDER_NAME}/${TASKS_CONFIGURATION_KEY}.json`;
565
- WORKSPACE_STANDALONE_CONFIGURATIONS[LAUNCH_CONFIGURATION_KEY] = `${FOLDER_CONFIG_FOLDER_NAME}/${LAUNCH_CONFIGURATION_KEY}.json`;
566
- const USER_STANDALONE_CONFIGURATIONS = Object.create(null);
567
- USER_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${TASKS_CONFIGURATION_KEY}.json`;
568
231
  let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchemasContribution extends Disposable {
569
232
  constructor(workspaceContextService, environmentService, workspaceTrustManagementService, extensionService, lifecycleService) {
570
233
  super();