markstream-vue2 0.0.21 → 0.0.22

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 (39) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/cssMode-2e2be6eb.cjs +1 -0
  3. package/dist/chunks/cssMode-32774a06.js +2044 -0
  4. package/dist/chunks/htmlMode-076e483c.js +2060 -0
  5. package/dist/chunks/htmlMode-b62439a8.cjs +1 -0
  6. package/dist/{index6.js → chunks/index-292bb72c.js} +1 -1
  7. package/dist/chunks/index-2a7bea2c.js +7 -0
  8. package/dist/chunks/index-42252d16.js +7 -0
  9. package/dist/chunks/index-8693b3db.cjs +1 -0
  10. package/dist/chunks/index-87cdc60f.js +7 -0
  11. package/dist/chunks/index-91325ae4.cjs +1 -0
  12. package/dist/chunks/index-b8d5777d.cjs +1 -0
  13. package/dist/chunks/index-c6f74f2d.cjs +1 -0
  14. package/dist/chunks/index-e0a22210.js +7 -0
  15. package/dist/chunks/index-e1315bc2.cjs +1 -0
  16. package/dist/chunks/index.legacy-1c6de434.js +125497 -0
  17. package/dist/chunks/index.legacy-bcde4164.cjs +1 -0
  18. package/dist/chunks/jsonMode-186d141c.js +2759 -0
  19. package/dist/chunks/jsonMode-bb4aa400.cjs +1 -0
  20. package/dist/chunks/languageIconExtended-feb078ee.js +65 -0
  21. package/dist/chunks/mhchem-5e563c97.js +13397 -0
  22. package/dist/chunks/performance-monitor-d79527de.js +128 -0
  23. package/dist/chunks/tsMode-1535ecd2.cjs +1 -0
  24. package/dist/chunks/tsMode-6444eb2b.js +1315 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.css +1 -1
  27. package/dist/index.js +11706 -1
  28. package/dist/index.px.css +1 -1
  29. package/dist/index.tailwind.css +1 -1
  30. package/dist/tailwind.ts +1 -1
  31. package/package.json +5 -4
  32. package/dist/index.legacy.js +0 -1
  33. package/dist/index2.js +0 -1
  34. package/dist/index3.js +0 -1
  35. package/dist/index4.js +0 -1
  36. package/dist/index5.js +0 -1
  37. /package/dist/{languageIconExtended.js → chunks/languageIconExtended-4baf8bdb.cjs} +0 -0
  38. /package/dist/{mhchem.js → chunks/mhchem-4785e7bc.cjs} +0 -0
  39. /package/dist/{performance-monitor.js → chunks/performance-monitor-698d0e66.cjs} +0 -0
@@ -0,0 +1,2060 @@
1
+ import { m as monaco_editor_core_star } from "./index.legacy-1c6de434.js";
2
+ import "shiki";
3
+ /*!-----------------------------------------------------------------------------
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
6
+ * Released under the MIT license
7
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
8
+ *-----------------------------------------------------------------------------*/
9
+ var __defProp = Object.defineProperty;
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
22
+ var monaco_editor_core_exports = {};
23
+ __reExport(monaco_editor_core_exports, monaco_editor_core_star);
24
+ var STOP_WHEN_IDLE_FOR = 2 * 60 * 1e3;
25
+ var WorkerManager = class {
26
+ constructor(defaults) {
27
+ this._defaults = defaults;
28
+ this._worker = null;
29
+ this._client = null;
30
+ this._idleCheckInterval = window.setInterval(() => this._checkIfIdle(), 30 * 1e3);
31
+ this._lastUsedTime = 0;
32
+ this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
33
+ }
34
+ _stopWorker() {
35
+ if (this._worker) {
36
+ this._worker.dispose();
37
+ this._worker = null;
38
+ }
39
+ this._client = null;
40
+ }
41
+ dispose() {
42
+ clearInterval(this._idleCheckInterval);
43
+ this._configChangeListener.dispose();
44
+ this._stopWorker();
45
+ }
46
+ _checkIfIdle() {
47
+ if (!this._worker) {
48
+ return;
49
+ }
50
+ let timePassedSinceLastUsed = Date.now() - this._lastUsedTime;
51
+ if (timePassedSinceLastUsed > STOP_WHEN_IDLE_FOR) {
52
+ this._stopWorker();
53
+ }
54
+ }
55
+ _getClient() {
56
+ this._lastUsedTime = Date.now();
57
+ if (!this._client) {
58
+ this._worker = monaco_editor_core_exports.editor.createWebWorker({
59
+ // module that exports the create() method and returns a `HTMLWorker` instance
60
+ moduleId: "vs/language/html/htmlWorker",
61
+ // passed in to the create() method
62
+ createData: {
63
+ languageSettings: this._defaults.options,
64
+ languageId: this._defaults.languageId
65
+ },
66
+ label: this._defaults.languageId
67
+ });
68
+ this._client = this._worker.getProxy();
69
+ }
70
+ return this._client;
71
+ }
72
+ getLanguageServiceWorker(...resources) {
73
+ let _client;
74
+ return this._getClient().then((client) => {
75
+ _client = client;
76
+ }).then((_) => {
77
+ if (this._worker) {
78
+ return this._worker.withSyncedResources(resources);
79
+ }
80
+ }).then((_) => _client);
81
+ }
82
+ };
83
+ var DocumentUri;
84
+ (function(DocumentUri2) {
85
+ function is(value) {
86
+ return typeof value === "string";
87
+ }
88
+ DocumentUri2.is = is;
89
+ })(DocumentUri || (DocumentUri = {}));
90
+ var URI;
91
+ (function(URI2) {
92
+ function is(value) {
93
+ return typeof value === "string";
94
+ }
95
+ URI2.is = is;
96
+ })(URI || (URI = {}));
97
+ var integer;
98
+ (function(integer2) {
99
+ integer2.MIN_VALUE = -2147483648;
100
+ integer2.MAX_VALUE = 2147483647;
101
+ function is(value) {
102
+ return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE;
103
+ }
104
+ integer2.is = is;
105
+ })(integer || (integer = {}));
106
+ var uinteger;
107
+ (function(uinteger2) {
108
+ uinteger2.MIN_VALUE = 0;
109
+ uinteger2.MAX_VALUE = 2147483647;
110
+ function is(value) {
111
+ return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE;
112
+ }
113
+ uinteger2.is = is;
114
+ })(uinteger || (uinteger = {}));
115
+ var Position;
116
+ (function(Position3) {
117
+ function create(line, character) {
118
+ if (line === Number.MAX_VALUE) {
119
+ line = uinteger.MAX_VALUE;
120
+ }
121
+ if (character === Number.MAX_VALUE) {
122
+ character = uinteger.MAX_VALUE;
123
+ }
124
+ return { line, character };
125
+ }
126
+ Position3.create = create;
127
+ function is(value) {
128
+ let candidate = value;
129
+ return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
130
+ }
131
+ Position3.is = is;
132
+ })(Position || (Position = {}));
133
+ var Range;
134
+ (function(Range3) {
135
+ function create(one, two, three, four) {
136
+ if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
137
+ return { start: Position.create(one, two), end: Position.create(three, four) };
138
+ } else if (Position.is(one) && Position.is(two)) {
139
+ return { start: one, end: two };
140
+ } else {
141
+ throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);
142
+ }
143
+ }
144
+ Range3.create = create;
145
+ function is(value) {
146
+ let candidate = value;
147
+ return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
148
+ }
149
+ Range3.is = is;
150
+ })(Range || (Range = {}));
151
+ var Location;
152
+ (function(Location2) {
153
+ function create(uri, range) {
154
+ return { uri, range };
155
+ }
156
+ Location2.create = create;
157
+ function is(value) {
158
+ let candidate = value;
159
+ return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
160
+ }
161
+ Location2.is = is;
162
+ })(Location || (Location = {}));
163
+ var LocationLink;
164
+ (function(LocationLink2) {
165
+ function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
166
+ return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
167
+ }
168
+ LocationLink2.create = create;
169
+ function is(value) {
170
+ let candidate = value;
171
+ return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
172
+ }
173
+ LocationLink2.is = is;
174
+ })(LocationLink || (LocationLink = {}));
175
+ var Color;
176
+ (function(Color2) {
177
+ function create(red, green, blue, alpha) {
178
+ return {
179
+ red,
180
+ green,
181
+ blue,
182
+ alpha
183
+ };
184
+ }
185
+ Color2.create = create;
186
+ function is(value) {
187
+ const candidate = value;
188
+ return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
189
+ }
190
+ Color2.is = is;
191
+ })(Color || (Color = {}));
192
+ var ColorInformation;
193
+ (function(ColorInformation2) {
194
+ function create(range, color) {
195
+ return {
196
+ range,
197
+ color
198
+ };
199
+ }
200
+ ColorInformation2.create = create;
201
+ function is(value) {
202
+ const candidate = value;
203
+ return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);
204
+ }
205
+ ColorInformation2.is = is;
206
+ })(ColorInformation || (ColorInformation = {}));
207
+ var ColorPresentation;
208
+ (function(ColorPresentation2) {
209
+ function create(label, textEdit, additionalTextEdits) {
210
+ return {
211
+ label,
212
+ textEdit,
213
+ additionalTextEdits
214
+ };
215
+ }
216
+ ColorPresentation2.create = create;
217
+ function is(value) {
218
+ const candidate = value;
219
+ return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
220
+ }
221
+ ColorPresentation2.is = is;
222
+ })(ColorPresentation || (ColorPresentation = {}));
223
+ var FoldingRangeKind;
224
+ (function(FoldingRangeKind2) {
225
+ FoldingRangeKind2.Comment = "comment";
226
+ FoldingRangeKind2.Imports = "imports";
227
+ FoldingRangeKind2.Region = "region";
228
+ })(FoldingRangeKind || (FoldingRangeKind = {}));
229
+ var FoldingRange;
230
+ (function(FoldingRange2) {
231
+ function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {
232
+ const result = {
233
+ startLine,
234
+ endLine
235
+ };
236
+ if (Is.defined(startCharacter)) {
237
+ result.startCharacter = startCharacter;
238
+ }
239
+ if (Is.defined(endCharacter)) {
240
+ result.endCharacter = endCharacter;
241
+ }
242
+ if (Is.defined(kind)) {
243
+ result.kind = kind;
244
+ }
245
+ if (Is.defined(collapsedText)) {
246
+ result.collapsedText = collapsedText;
247
+ }
248
+ return result;
249
+ }
250
+ FoldingRange2.create = create;
251
+ function is(value) {
252
+ const candidate = value;
253
+ return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
254
+ }
255
+ FoldingRange2.is = is;
256
+ })(FoldingRange || (FoldingRange = {}));
257
+ var DiagnosticRelatedInformation;
258
+ (function(DiagnosticRelatedInformation2) {
259
+ function create(location, message) {
260
+ return {
261
+ location,
262
+ message
263
+ };
264
+ }
265
+ DiagnosticRelatedInformation2.create = create;
266
+ function is(value) {
267
+ let candidate = value;
268
+ return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
269
+ }
270
+ DiagnosticRelatedInformation2.is = is;
271
+ })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
272
+ var DiagnosticSeverity;
273
+ (function(DiagnosticSeverity2) {
274
+ DiagnosticSeverity2.Error = 1;
275
+ DiagnosticSeverity2.Warning = 2;
276
+ DiagnosticSeverity2.Information = 3;
277
+ DiagnosticSeverity2.Hint = 4;
278
+ })(DiagnosticSeverity || (DiagnosticSeverity = {}));
279
+ var DiagnosticTag;
280
+ (function(DiagnosticTag2) {
281
+ DiagnosticTag2.Unnecessary = 1;
282
+ DiagnosticTag2.Deprecated = 2;
283
+ })(DiagnosticTag || (DiagnosticTag = {}));
284
+ var CodeDescription;
285
+ (function(CodeDescription2) {
286
+ function is(value) {
287
+ const candidate = value;
288
+ return Is.objectLiteral(candidate) && Is.string(candidate.href);
289
+ }
290
+ CodeDescription2.is = is;
291
+ })(CodeDescription || (CodeDescription = {}));
292
+ var Diagnostic;
293
+ (function(Diagnostic2) {
294
+ function create(range, message, severity, code, source, relatedInformation) {
295
+ let result = { range, message };
296
+ if (Is.defined(severity)) {
297
+ result.severity = severity;
298
+ }
299
+ if (Is.defined(code)) {
300
+ result.code = code;
301
+ }
302
+ if (Is.defined(source)) {
303
+ result.source = source;
304
+ }
305
+ if (Is.defined(relatedInformation)) {
306
+ result.relatedInformation = relatedInformation;
307
+ }
308
+ return result;
309
+ }
310
+ Diagnostic2.create = create;
311
+ function is(value) {
312
+ var _a;
313
+ let candidate = value;
314
+ return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
315
+ }
316
+ Diagnostic2.is = is;
317
+ })(Diagnostic || (Diagnostic = {}));
318
+ var Command;
319
+ (function(Command2) {
320
+ function create(title, command, ...args) {
321
+ let result = { title, command };
322
+ if (Is.defined(args) && args.length > 0) {
323
+ result.arguments = args;
324
+ }
325
+ return result;
326
+ }
327
+ Command2.create = create;
328
+ function is(value) {
329
+ let candidate = value;
330
+ return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
331
+ }
332
+ Command2.is = is;
333
+ })(Command || (Command = {}));
334
+ var TextEdit;
335
+ (function(TextEdit2) {
336
+ function replace(range, newText) {
337
+ return { range, newText };
338
+ }
339
+ TextEdit2.replace = replace;
340
+ function insert(position, newText) {
341
+ return { range: { start: position, end: position }, newText };
342
+ }
343
+ TextEdit2.insert = insert;
344
+ function del(range) {
345
+ return { range, newText: "" };
346
+ }
347
+ TextEdit2.del = del;
348
+ function is(value) {
349
+ const candidate = value;
350
+ return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
351
+ }
352
+ TextEdit2.is = is;
353
+ })(TextEdit || (TextEdit = {}));
354
+ var ChangeAnnotation;
355
+ (function(ChangeAnnotation2) {
356
+ function create(label, needsConfirmation, description) {
357
+ const result = { label };
358
+ if (needsConfirmation !== void 0) {
359
+ result.needsConfirmation = needsConfirmation;
360
+ }
361
+ if (description !== void 0) {
362
+ result.description = description;
363
+ }
364
+ return result;
365
+ }
366
+ ChangeAnnotation2.create = create;
367
+ function is(value) {
368
+ const candidate = value;
369
+ return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
370
+ }
371
+ ChangeAnnotation2.is = is;
372
+ })(ChangeAnnotation || (ChangeAnnotation = {}));
373
+ var ChangeAnnotationIdentifier;
374
+ (function(ChangeAnnotationIdentifier2) {
375
+ function is(value) {
376
+ const candidate = value;
377
+ return Is.string(candidate);
378
+ }
379
+ ChangeAnnotationIdentifier2.is = is;
380
+ })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
381
+ var AnnotatedTextEdit;
382
+ (function(AnnotatedTextEdit2) {
383
+ function replace(range, newText, annotation) {
384
+ return { range, newText, annotationId: annotation };
385
+ }
386
+ AnnotatedTextEdit2.replace = replace;
387
+ function insert(position, newText, annotation) {
388
+ return { range: { start: position, end: position }, newText, annotationId: annotation };
389
+ }
390
+ AnnotatedTextEdit2.insert = insert;
391
+ function del(range, annotation) {
392
+ return { range, newText: "", annotationId: annotation };
393
+ }
394
+ AnnotatedTextEdit2.del = del;
395
+ function is(value) {
396
+ const candidate = value;
397
+ return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
398
+ }
399
+ AnnotatedTextEdit2.is = is;
400
+ })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
401
+ var TextDocumentEdit;
402
+ (function(TextDocumentEdit2) {
403
+ function create(textDocument, edits) {
404
+ return { textDocument, edits };
405
+ }
406
+ TextDocumentEdit2.create = create;
407
+ function is(value) {
408
+ let candidate = value;
409
+ return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
410
+ }
411
+ TextDocumentEdit2.is = is;
412
+ })(TextDocumentEdit || (TextDocumentEdit = {}));
413
+ var CreateFile;
414
+ (function(CreateFile2) {
415
+ function create(uri, options, annotation) {
416
+ let result = {
417
+ kind: "create",
418
+ uri
419
+ };
420
+ if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
421
+ result.options = options;
422
+ }
423
+ if (annotation !== void 0) {
424
+ result.annotationId = annotation;
425
+ }
426
+ return result;
427
+ }
428
+ CreateFile2.create = create;
429
+ function is(value) {
430
+ let candidate = value;
431
+ return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
432
+ }
433
+ CreateFile2.is = is;
434
+ })(CreateFile || (CreateFile = {}));
435
+ var RenameFile;
436
+ (function(RenameFile2) {
437
+ function create(oldUri, newUri, options, annotation) {
438
+ let result = {
439
+ kind: "rename",
440
+ oldUri,
441
+ newUri
442
+ };
443
+ if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
444
+ result.options = options;
445
+ }
446
+ if (annotation !== void 0) {
447
+ result.annotationId = annotation;
448
+ }
449
+ return result;
450
+ }
451
+ RenameFile2.create = create;
452
+ function is(value) {
453
+ let candidate = value;
454
+ return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
455
+ }
456
+ RenameFile2.is = is;
457
+ })(RenameFile || (RenameFile = {}));
458
+ var DeleteFile;
459
+ (function(DeleteFile2) {
460
+ function create(uri, options, annotation) {
461
+ let result = {
462
+ kind: "delete",
463
+ uri
464
+ };
465
+ if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
466
+ result.options = options;
467
+ }
468
+ if (annotation !== void 0) {
469
+ result.annotationId = annotation;
470
+ }
471
+ return result;
472
+ }
473
+ DeleteFile2.create = create;
474
+ function is(value) {
475
+ let candidate = value;
476
+ return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
477
+ }
478
+ DeleteFile2.is = is;
479
+ })(DeleteFile || (DeleteFile = {}));
480
+ var WorkspaceEdit;
481
+ (function(WorkspaceEdit2) {
482
+ function is(value) {
483
+ let candidate = value;
484
+ return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change) => {
485
+ if (Is.string(change.kind)) {
486
+ return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
487
+ } else {
488
+ return TextDocumentEdit.is(change);
489
+ }
490
+ }));
491
+ }
492
+ WorkspaceEdit2.is = is;
493
+ })(WorkspaceEdit || (WorkspaceEdit = {}));
494
+ var TextDocumentIdentifier;
495
+ (function(TextDocumentIdentifier2) {
496
+ function create(uri) {
497
+ return { uri };
498
+ }
499
+ TextDocumentIdentifier2.create = create;
500
+ function is(value) {
501
+ let candidate = value;
502
+ return Is.defined(candidate) && Is.string(candidate.uri);
503
+ }
504
+ TextDocumentIdentifier2.is = is;
505
+ })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
506
+ var VersionedTextDocumentIdentifier;
507
+ (function(VersionedTextDocumentIdentifier2) {
508
+ function create(uri, version) {
509
+ return { uri, version };
510
+ }
511
+ VersionedTextDocumentIdentifier2.create = create;
512
+ function is(value) {
513
+ let candidate = value;
514
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
515
+ }
516
+ VersionedTextDocumentIdentifier2.is = is;
517
+ })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
518
+ var OptionalVersionedTextDocumentIdentifier;
519
+ (function(OptionalVersionedTextDocumentIdentifier2) {
520
+ function create(uri, version) {
521
+ return { uri, version };
522
+ }
523
+ OptionalVersionedTextDocumentIdentifier2.create = create;
524
+ function is(value) {
525
+ let candidate = value;
526
+ return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
527
+ }
528
+ OptionalVersionedTextDocumentIdentifier2.is = is;
529
+ })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
530
+ var TextDocumentItem;
531
+ (function(TextDocumentItem2) {
532
+ function create(uri, languageId, version, text) {
533
+ return { uri, languageId, version, text };
534
+ }
535
+ TextDocumentItem2.create = create;
536
+ function is(value) {
537
+ let candidate = value;
538
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
539
+ }
540
+ TextDocumentItem2.is = is;
541
+ })(TextDocumentItem || (TextDocumentItem = {}));
542
+ var MarkupKind;
543
+ (function(MarkupKind2) {
544
+ MarkupKind2.PlainText = "plaintext";
545
+ MarkupKind2.Markdown = "markdown";
546
+ function is(value) {
547
+ const candidate = value;
548
+ return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
549
+ }
550
+ MarkupKind2.is = is;
551
+ })(MarkupKind || (MarkupKind = {}));
552
+ var MarkupContent;
553
+ (function(MarkupContent2) {
554
+ function is(value) {
555
+ const candidate = value;
556
+ return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
557
+ }
558
+ MarkupContent2.is = is;
559
+ })(MarkupContent || (MarkupContent = {}));
560
+ var CompletionItemKind;
561
+ (function(CompletionItemKind2) {
562
+ CompletionItemKind2.Text = 1;
563
+ CompletionItemKind2.Method = 2;
564
+ CompletionItemKind2.Function = 3;
565
+ CompletionItemKind2.Constructor = 4;
566
+ CompletionItemKind2.Field = 5;
567
+ CompletionItemKind2.Variable = 6;
568
+ CompletionItemKind2.Class = 7;
569
+ CompletionItemKind2.Interface = 8;
570
+ CompletionItemKind2.Module = 9;
571
+ CompletionItemKind2.Property = 10;
572
+ CompletionItemKind2.Unit = 11;
573
+ CompletionItemKind2.Value = 12;
574
+ CompletionItemKind2.Enum = 13;
575
+ CompletionItemKind2.Keyword = 14;
576
+ CompletionItemKind2.Snippet = 15;
577
+ CompletionItemKind2.Color = 16;
578
+ CompletionItemKind2.File = 17;
579
+ CompletionItemKind2.Reference = 18;
580
+ CompletionItemKind2.Folder = 19;
581
+ CompletionItemKind2.EnumMember = 20;
582
+ CompletionItemKind2.Constant = 21;
583
+ CompletionItemKind2.Struct = 22;
584
+ CompletionItemKind2.Event = 23;
585
+ CompletionItemKind2.Operator = 24;
586
+ CompletionItemKind2.TypeParameter = 25;
587
+ })(CompletionItemKind || (CompletionItemKind = {}));
588
+ var InsertTextFormat;
589
+ (function(InsertTextFormat2) {
590
+ InsertTextFormat2.PlainText = 1;
591
+ InsertTextFormat2.Snippet = 2;
592
+ })(InsertTextFormat || (InsertTextFormat = {}));
593
+ var CompletionItemTag;
594
+ (function(CompletionItemTag2) {
595
+ CompletionItemTag2.Deprecated = 1;
596
+ })(CompletionItemTag || (CompletionItemTag = {}));
597
+ var InsertReplaceEdit;
598
+ (function(InsertReplaceEdit2) {
599
+ function create(newText, insert, replace) {
600
+ return { newText, insert, replace };
601
+ }
602
+ InsertReplaceEdit2.create = create;
603
+ function is(value) {
604
+ const candidate = value;
605
+ return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
606
+ }
607
+ InsertReplaceEdit2.is = is;
608
+ })(InsertReplaceEdit || (InsertReplaceEdit = {}));
609
+ var InsertTextMode;
610
+ (function(InsertTextMode2) {
611
+ InsertTextMode2.asIs = 1;
612
+ InsertTextMode2.adjustIndentation = 2;
613
+ })(InsertTextMode || (InsertTextMode = {}));
614
+ var CompletionItemLabelDetails;
615
+ (function(CompletionItemLabelDetails2) {
616
+ function is(value) {
617
+ const candidate = value;
618
+ return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
619
+ }
620
+ CompletionItemLabelDetails2.is = is;
621
+ })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));
622
+ var CompletionItem;
623
+ (function(CompletionItem2) {
624
+ function create(label) {
625
+ return { label };
626
+ }
627
+ CompletionItem2.create = create;
628
+ })(CompletionItem || (CompletionItem = {}));
629
+ var CompletionList;
630
+ (function(CompletionList2) {
631
+ function create(items, isIncomplete) {
632
+ return { items: items ? items : [], isIncomplete: !!isIncomplete };
633
+ }
634
+ CompletionList2.create = create;
635
+ })(CompletionList || (CompletionList = {}));
636
+ var MarkedString;
637
+ (function(MarkedString2) {
638
+ function fromPlainText(plainText) {
639
+ return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
640
+ }
641
+ MarkedString2.fromPlainText = fromPlainText;
642
+ function is(value) {
643
+ const candidate = value;
644
+ return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
645
+ }
646
+ MarkedString2.is = is;
647
+ })(MarkedString || (MarkedString = {}));
648
+ var Hover;
649
+ (function(Hover2) {
650
+ function is(value) {
651
+ let candidate = value;
652
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
653
+ }
654
+ Hover2.is = is;
655
+ })(Hover || (Hover = {}));
656
+ var ParameterInformation;
657
+ (function(ParameterInformation2) {
658
+ function create(label, documentation) {
659
+ return documentation ? { label, documentation } : { label };
660
+ }
661
+ ParameterInformation2.create = create;
662
+ })(ParameterInformation || (ParameterInformation = {}));
663
+ var SignatureInformation;
664
+ (function(SignatureInformation2) {
665
+ function create(label, documentation, ...parameters) {
666
+ let result = { label };
667
+ if (Is.defined(documentation)) {
668
+ result.documentation = documentation;
669
+ }
670
+ if (Is.defined(parameters)) {
671
+ result.parameters = parameters;
672
+ } else {
673
+ result.parameters = [];
674
+ }
675
+ return result;
676
+ }
677
+ SignatureInformation2.create = create;
678
+ })(SignatureInformation || (SignatureInformation = {}));
679
+ var DocumentHighlightKind;
680
+ (function(DocumentHighlightKind2) {
681
+ DocumentHighlightKind2.Text = 1;
682
+ DocumentHighlightKind2.Read = 2;
683
+ DocumentHighlightKind2.Write = 3;
684
+ })(DocumentHighlightKind || (DocumentHighlightKind = {}));
685
+ var DocumentHighlight;
686
+ (function(DocumentHighlight2) {
687
+ function create(range, kind) {
688
+ let result = { range };
689
+ if (Is.number(kind)) {
690
+ result.kind = kind;
691
+ }
692
+ return result;
693
+ }
694
+ DocumentHighlight2.create = create;
695
+ })(DocumentHighlight || (DocumentHighlight = {}));
696
+ var SymbolKind;
697
+ (function(SymbolKind2) {
698
+ SymbolKind2.File = 1;
699
+ SymbolKind2.Module = 2;
700
+ SymbolKind2.Namespace = 3;
701
+ SymbolKind2.Package = 4;
702
+ SymbolKind2.Class = 5;
703
+ SymbolKind2.Method = 6;
704
+ SymbolKind2.Property = 7;
705
+ SymbolKind2.Field = 8;
706
+ SymbolKind2.Constructor = 9;
707
+ SymbolKind2.Enum = 10;
708
+ SymbolKind2.Interface = 11;
709
+ SymbolKind2.Function = 12;
710
+ SymbolKind2.Variable = 13;
711
+ SymbolKind2.Constant = 14;
712
+ SymbolKind2.String = 15;
713
+ SymbolKind2.Number = 16;
714
+ SymbolKind2.Boolean = 17;
715
+ SymbolKind2.Array = 18;
716
+ SymbolKind2.Object = 19;
717
+ SymbolKind2.Key = 20;
718
+ SymbolKind2.Null = 21;
719
+ SymbolKind2.EnumMember = 22;
720
+ SymbolKind2.Struct = 23;
721
+ SymbolKind2.Event = 24;
722
+ SymbolKind2.Operator = 25;
723
+ SymbolKind2.TypeParameter = 26;
724
+ })(SymbolKind || (SymbolKind = {}));
725
+ var SymbolTag;
726
+ (function(SymbolTag2) {
727
+ SymbolTag2.Deprecated = 1;
728
+ })(SymbolTag || (SymbolTag = {}));
729
+ var SymbolInformation;
730
+ (function(SymbolInformation2) {
731
+ function create(name, kind, range, uri, containerName) {
732
+ let result = {
733
+ name,
734
+ kind,
735
+ location: { uri, range }
736
+ };
737
+ if (containerName) {
738
+ result.containerName = containerName;
739
+ }
740
+ return result;
741
+ }
742
+ SymbolInformation2.create = create;
743
+ })(SymbolInformation || (SymbolInformation = {}));
744
+ var WorkspaceSymbol;
745
+ (function(WorkspaceSymbol2) {
746
+ function create(name, kind, uri, range) {
747
+ return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } };
748
+ }
749
+ WorkspaceSymbol2.create = create;
750
+ })(WorkspaceSymbol || (WorkspaceSymbol = {}));
751
+ var DocumentSymbol;
752
+ (function(DocumentSymbol2) {
753
+ function create(name, detail, kind, range, selectionRange, children) {
754
+ let result = {
755
+ name,
756
+ detail,
757
+ kind,
758
+ range,
759
+ selectionRange
760
+ };
761
+ if (children !== void 0) {
762
+ result.children = children;
763
+ }
764
+ return result;
765
+ }
766
+ DocumentSymbol2.create = create;
767
+ function is(value) {
768
+ let candidate = value;
769
+ return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
770
+ }
771
+ DocumentSymbol2.is = is;
772
+ })(DocumentSymbol || (DocumentSymbol = {}));
773
+ var CodeActionKind;
774
+ (function(CodeActionKind2) {
775
+ CodeActionKind2.Empty = "";
776
+ CodeActionKind2.QuickFix = "quickfix";
777
+ CodeActionKind2.Refactor = "refactor";
778
+ CodeActionKind2.RefactorExtract = "refactor.extract";
779
+ CodeActionKind2.RefactorInline = "refactor.inline";
780
+ CodeActionKind2.RefactorRewrite = "refactor.rewrite";
781
+ CodeActionKind2.Source = "source";
782
+ CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
783
+ CodeActionKind2.SourceFixAll = "source.fixAll";
784
+ })(CodeActionKind || (CodeActionKind = {}));
785
+ var CodeActionTriggerKind;
786
+ (function(CodeActionTriggerKind2) {
787
+ CodeActionTriggerKind2.Invoked = 1;
788
+ CodeActionTriggerKind2.Automatic = 2;
789
+ })(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
790
+ var CodeActionContext;
791
+ (function(CodeActionContext2) {
792
+ function create(diagnostics, only, triggerKind) {
793
+ let result = { diagnostics };
794
+ if (only !== void 0 && only !== null) {
795
+ result.only = only;
796
+ }
797
+ if (triggerKind !== void 0 && triggerKind !== null) {
798
+ result.triggerKind = triggerKind;
799
+ }
800
+ return result;
801
+ }
802
+ CodeActionContext2.create = create;
803
+ function is(value) {
804
+ let candidate = value;
805
+ return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);
806
+ }
807
+ CodeActionContext2.is = is;
808
+ })(CodeActionContext || (CodeActionContext = {}));
809
+ var CodeAction;
810
+ (function(CodeAction2) {
811
+ function create(title, kindOrCommandOrEdit, kind) {
812
+ let result = { title };
813
+ let checkKind = true;
814
+ if (typeof kindOrCommandOrEdit === "string") {
815
+ checkKind = false;
816
+ result.kind = kindOrCommandOrEdit;
817
+ } else if (Command.is(kindOrCommandOrEdit)) {
818
+ result.command = kindOrCommandOrEdit;
819
+ } else {
820
+ result.edit = kindOrCommandOrEdit;
821
+ }
822
+ if (checkKind && kind !== void 0) {
823
+ result.kind = kind;
824
+ }
825
+ return result;
826
+ }
827
+ CodeAction2.create = create;
828
+ function is(value) {
829
+ let candidate = value;
830
+ return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
831
+ }
832
+ CodeAction2.is = is;
833
+ })(CodeAction || (CodeAction = {}));
834
+ var CodeLens;
835
+ (function(CodeLens2) {
836
+ function create(range, data) {
837
+ let result = { range };
838
+ if (Is.defined(data)) {
839
+ result.data = data;
840
+ }
841
+ return result;
842
+ }
843
+ CodeLens2.create = create;
844
+ function is(value) {
845
+ let candidate = value;
846
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
847
+ }
848
+ CodeLens2.is = is;
849
+ })(CodeLens || (CodeLens = {}));
850
+ var FormattingOptions;
851
+ (function(FormattingOptions2) {
852
+ function create(tabSize, insertSpaces) {
853
+ return { tabSize, insertSpaces };
854
+ }
855
+ FormattingOptions2.create = create;
856
+ function is(value) {
857
+ let candidate = value;
858
+ return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
859
+ }
860
+ FormattingOptions2.is = is;
861
+ })(FormattingOptions || (FormattingOptions = {}));
862
+ var DocumentLink;
863
+ (function(DocumentLink2) {
864
+ function create(range, target, data) {
865
+ return { range, target, data };
866
+ }
867
+ DocumentLink2.create = create;
868
+ function is(value) {
869
+ let candidate = value;
870
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
871
+ }
872
+ DocumentLink2.is = is;
873
+ })(DocumentLink || (DocumentLink = {}));
874
+ var SelectionRange;
875
+ (function(SelectionRange2) {
876
+ function create(range, parent) {
877
+ return { range, parent };
878
+ }
879
+ SelectionRange2.create = create;
880
+ function is(value) {
881
+ let candidate = value;
882
+ return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
883
+ }
884
+ SelectionRange2.is = is;
885
+ })(SelectionRange || (SelectionRange = {}));
886
+ var SemanticTokenTypes;
887
+ (function(SemanticTokenTypes2) {
888
+ SemanticTokenTypes2["namespace"] = "namespace";
889
+ SemanticTokenTypes2["type"] = "type";
890
+ SemanticTokenTypes2["class"] = "class";
891
+ SemanticTokenTypes2["enum"] = "enum";
892
+ SemanticTokenTypes2["interface"] = "interface";
893
+ SemanticTokenTypes2["struct"] = "struct";
894
+ SemanticTokenTypes2["typeParameter"] = "typeParameter";
895
+ SemanticTokenTypes2["parameter"] = "parameter";
896
+ SemanticTokenTypes2["variable"] = "variable";
897
+ SemanticTokenTypes2["property"] = "property";
898
+ SemanticTokenTypes2["enumMember"] = "enumMember";
899
+ SemanticTokenTypes2["event"] = "event";
900
+ SemanticTokenTypes2["function"] = "function";
901
+ SemanticTokenTypes2["method"] = "method";
902
+ SemanticTokenTypes2["macro"] = "macro";
903
+ SemanticTokenTypes2["keyword"] = "keyword";
904
+ SemanticTokenTypes2["modifier"] = "modifier";
905
+ SemanticTokenTypes2["comment"] = "comment";
906
+ SemanticTokenTypes2["string"] = "string";
907
+ SemanticTokenTypes2["number"] = "number";
908
+ SemanticTokenTypes2["regexp"] = "regexp";
909
+ SemanticTokenTypes2["operator"] = "operator";
910
+ SemanticTokenTypes2["decorator"] = "decorator";
911
+ })(SemanticTokenTypes || (SemanticTokenTypes = {}));
912
+ var SemanticTokenModifiers;
913
+ (function(SemanticTokenModifiers2) {
914
+ SemanticTokenModifiers2["declaration"] = "declaration";
915
+ SemanticTokenModifiers2["definition"] = "definition";
916
+ SemanticTokenModifiers2["readonly"] = "readonly";
917
+ SemanticTokenModifiers2["static"] = "static";
918
+ SemanticTokenModifiers2["deprecated"] = "deprecated";
919
+ SemanticTokenModifiers2["abstract"] = "abstract";
920
+ SemanticTokenModifiers2["async"] = "async";
921
+ SemanticTokenModifiers2["modification"] = "modification";
922
+ SemanticTokenModifiers2["documentation"] = "documentation";
923
+ SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
924
+ })(SemanticTokenModifiers || (SemanticTokenModifiers = {}));
925
+ var SemanticTokens;
926
+ (function(SemanticTokens2) {
927
+ function is(value) {
928
+ const candidate = value;
929
+ return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number");
930
+ }
931
+ SemanticTokens2.is = is;
932
+ })(SemanticTokens || (SemanticTokens = {}));
933
+ var InlineValueText;
934
+ (function(InlineValueText2) {
935
+ function create(range, text) {
936
+ return { range, text };
937
+ }
938
+ InlineValueText2.create = create;
939
+ function is(value) {
940
+ const candidate = value;
941
+ return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
942
+ }
943
+ InlineValueText2.is = is;
944
+ })(InlineValueText || (InlineValueText = {}));
945
+ var InlineValueVariableLookup;
946
+ (function(InlineValueVariableLookup2) {
947
+ function create(range, variableName, caseSensitiveLookup) {
948
+ return { range, variableName, caseSensitiveLookup };
949
+ }
950
+ InlineValueVariableLookup2.create = create;
951
+ function is(value) {
952
+ const candidate = value;
953
+ return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
954
+ }
955
+ InlineValueVariableLookup2.is = is;
956
+ })(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
957
+ var InlineValueEvaluatableExpression;
958
+ (function(InlineValueEvaluatableExpression2) {
959
+ function create(range, expression) {
960
+ return { range, expression };
961
+ }
962
+ InlineValueEvaluatableExpression2.create = create;
963
+ function is(value) {
964
+ const candidate = value;
965
+ return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
966
+ }
967
+ InlineValueEvaluatableExpression2.is = is;
968
+ })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));
969
+ var InlineValueContext;
970
+ (function(InlineValueContext2) {
971
+ function create(frameId, stoppedLocation) {
972
+ return { frameId, stoppedLocation };
973
+ }
974
+ InlineValueContext2.create = create;
975
+ function is(value) {
976
+ const candidate = value;
977
+ return Is.defined(candidate) && Range.is(value.stoppedLocation);
978
+ }
979
+ InlineValueContext2.is = is;
980
+ })(InlineValueContext || (InlineValueContext = {}));
981
+ var InlayHintKind;
982
+ (function(InlayHintKind2) {
983
+ InlayHintKind2.Type = 1;
984
+ InlayHintKind2.Parameter = 2;
985
+ function is(value) {
986
+ return value === 1 || value === 2;
987
+ }
988
+ InlayHintKind2.is = is;
989
+ })(InlayHintKind || (InlayHintKind = {}));
990
+ var InlayHintLabelPart;
991
+ (function(InlayHintLabelPart2) {
992
+ function create(value) {
993
+ return { value };
994
+ }
995
+ InlayHintLabelPart2.create = create;
996
+ function is(value) {
997
+ const candidate = value;
998
+ return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command));
999
+ }
1000
+ InlayHintLabelPart2.is = is;
1001
+ })(InlayHintLabelPart || (InlayHintLabelPart = {}));
1002
+ var InlayHint;
1003
+ (function(InlayHint2) {
1004
+ function create(position, label, kind) {
1005
+ const result = { position, label };
1006
+ if (kind !== void 0) {
1007
+ result.kind = kind;
1008
+ }
1009
+ return result;
1010
+ }
1011
+ InlayHint2.create = create;
1012
+ function is(value) {
1013
+ const candidate = value;
1014
+ return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
1015
+ }
1016
+ InlayHint2.is = is;
1017
+ })(InlayHint || (InlayHint = {}));
1018
+ var StringValue;
1019
+ (function(StringValue2) {
1020
+ function createSnippet(value) {
1021
+ return { kind: "snippet", value };
1022
+ }
1023
+ StringValue2.createSnippet = createSnippet;
1024
+ })(StringValue || (StringValue = {}));
1025
+ var InlineCompletionItem;
1026
+ (function(InlineCompletionItem2) {
1027
+ function create(insertText, filterText, range, command) {
1028
+ return { insertText, filterText, range, command };
1029
+ }
1030
+ InlineCompletionItem2.create = create;
1031
+ })(InlineCompletionItem || (InlineCompletionItem = {}));
1032
+ var InlineCompletionList;
1033
+ (function(InlineCompletionList2) {
1034
+ function create(items) {
1035
+ return { items };
1036
+ }
1037
+ InlineCompletionList2.create = create;
1038
+ })(InlineCompletionList || (InlineCompletionList = {}));
1039
+ var InlineCompletionTriggerKind;
1040
+ (function(InlineCompletionTriggerKind2) {
1041
+ InlineCompletionTriggerKind2.Invoked = 0;
1042
+ InlineCompletionTriggerKind2.Automatic = 1;
1043
+ })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
1044
+ var SelectedCompletionInfo;
1045
+ (function(SelectedCompletionInfo2) {
1046
+ function create(range, text) {
1047
+ return { range, text };
1048
+ }
1049
+ SelectedCompletionInfo2.create = create;
1050
+ })(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
1051
+ var InlineCompletionContext;
1052
+ (function(InlineCompletionContext2) {
1053
+ function create(triggerKind, selectedCompletionInfo) {
1054
+ return { triggerKind, selectedCompletionInfo };
1055
+ }
1056
+ InlineCompletionContext2.create = create;
1057
+ })(InlineCompletionContext || (InlineCompletionContext = {}));
1058
+ var WorkspaceFolder;
1059
+ (function(WorkspaceFolder2) {
1060
+ function is(value) {
1061
+ const candidate = value;
1062
+ return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
1063
+ }
1064
+ WorkspaceFolder2.is = is;
1065
+ })(WorkspaceFolder || (WorkspaceFolder = {}));
1066
+ var TextDocument;
1067
+ (function(TextDocument2) {
1068
+ function create(uri, languageId, version, content) {
1069
+ return new FullTextDocument(uri, languageId, version, content);
1070
+ }
1071
+ TextDocument2.create = create;
1072
+ function is(value) {
1073
+ let candidate = value;
1074
+ return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
1075
+ }
1076
+ TextDocument2.is = is;
1077
+ function applyEdits(document, edits) {
1078
+ let text = document.getText();
1079
+ let sortedEdits = mergeSort(edits, (a, b) => {
1080
+ let diff = a.range.start.line - b.range.start.line;
1081
+ if (diff === 0) {
1082
+ return a.range.start.character - b.range.start.character;
1083
+ }
1084
+ return diff;
1085
+ });
1086
+ let lastModifiedOffset = text.length;
1087
+ for (let i = sortedEdits.length - 1; i >= 0; i--) {
1088
+ let e = sortedEdits[i];
1089
+ let startOffset = document.offsetAt(e.range.start);
1090
+ let endOffset = document.offsetAt(e.range.end);
1091
+ if (endOffset <= lastModifiedOffset) {
1092
+ text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
1093
+ } else {
1094
+ throw new Error("Overlapping edit");
1095
+ }
1096
+ lastModifiedOffset = startOffset;
1097
+ }
1098
+ return text;
1099
+ }
1100
+ TextDocument2.applyEdits = applyEdits;
1101
+ function mergeSort(data, compare) {
1102
+ if (data.length <= 1) {
1103
+ return data;
1104
+ }
1105
+ const p = data.length / 2 | 0;
1106
+ const left = data.slice(0, p);
1107
+ const right = data.slice(p);
1108
+ mergeSort(left, compare);
1109
+ mergeSort(right, compare);
1110
+ let leftIdx = 0;
1111
+ let rightIdx = 0;
1112
+ let i = 0;
1113
+ while (leftIdx < left.length && rightIdx < right.length) {
1114
+ let ret = compare(left[leftIdx], right[rightIdx]);
1115
+ if (ret <= 0) {
1116
+ data[i++] = left[leftIdx++];
1117
+ } else {
1118
+ data[i++] = right[rightIdx++];
1119
+ }
1120
+ }
1121
+ while (leftIdx < left.length) {
1122
+ data[i++] = left[leftIdx++];
1123
+ }
1124
+ while (rightIdx < right.length) {
1125
+ data[i++] = right[rightIdx++];
1126
+ }
1127
+ return data;
1128
+ }
1129
+ })(TextDocument || (TextDocument = {}));
1130
+ var FullTextDocument = class {
1131
+ constructor(uri, languageId, version, content) {
1132
+ this._uri = uri;
1133
+ this._languageId = languageId;
1134
+ this._version = version;
1135
+ this._content = content;
1136
+ this._lineOffsets = void 0;
1137
+ }
1138
+ get uri() {
1139
+ return this._uri;
1140
+ }
1141
+ get languageId() {
1142
+ return this._languageId;
1143
+ }
1144
+ get version() {
1145
+ return this._version;
1146
+ }
1147
+ getText(range) {
1148
+ if (range) {
1149
+ let start = this.offsetAt(range.start);
1150
+ let end = this.offsetAt(range.end);
1151
+ return this._content.substring(start, end);
1152
+ }
1153
+ return this._content;
1154
+ }
1155
+ update(event, version) {
1156
+ this._content = event.text;
1157
+ this._version = version;
1158
+ this._lineOffsets = void 0;
1159
+ }
1160
+ getLineOffsets() {
1161
+ if (this._lineOffsets === void 0) {
1162
+ let lineOffsets = [];
1163
+ let text = this._content;
1164
+ let isLineStart = true;
1165
+ for (let i = 0; i < text.length; i++) {
1166
+ if (isLineStart) {
1167
+ lineOffsets.push(i);
1168
+ isLineStart = false;
1169
+ }
1170
+ let ch = text.charAt(i);
1171
+ isLineStart = ch === "\r" || ch === "\n";
1172
+ if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
1173
+ i++;
1174
+ }
1175
+ }
1176
+ if (isLineStart && text.length > 0) {
1177
+ lineOffsets.push(text.length);
1178
+ }
1179
+ this._lineOffsets = lineOffsets;
1180
+ }
1181
+ return this._lineOffsets;
1182
+ }
1183
+ positionAt(offset) {
1184
+ offset = Math.max(Math.min(offset, this._content.length), 0);
1185
+ let lineOffsets = this.getLineOffsets();
1186
+ let low = 0, high = lineOffsets.length;
1187
+ if (high === 0) {
1188
+ return Position.create(0, offset);
1189
+ }
1190
+ while (low < high) {
1191
+ let mid = Math.floor((low + high) / 2);
1192
+ if (lineOffsets[mid] > offset) {
1193
+ high = mid;
1194
+ } else {
1195
+ low = mid + 1;
1196
+ }
1197
+ }
1198
+ let line = low - 1;
1199
+ return Position.create(line, offset - lineOffsets[line]);
1200
+ }
1201
+ offsetAt(position) {
1202
+ let lineOffsets = this.getLineOffsets();
1203
+ if (position.line >= lineOffsets.length) {
1204
+ return this._content.length;
1205
+ } else if (position.line < 0) {
1206
+ return 0;
1207
+ }
1208
+ let lineOffset = lineOffsets[position.line];
1209
+ let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
1210
+ return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
1211
+ }
1212
+ get lineCount() {
1213
+ return this.getLineOffsets().length;
1214
+ }
1215
+ };
1216
+ var Is;
1217
+ (function(Is2) {
1218
+ const toString = Object.prototype.toString;
1219
+ function defined(value) {
1220
+ return typeof value !== "undefined";
1221
+ }
1222
+ Is2.defined = defined;
1223
+ function undefined2(value) {
1224
+ return typeof value === "undefined";
1225
+ }
1226
+ Is2.undefined = undefined2;
1227
+ function boolean(value) {
1228
+ return value === true || value === false;
1229
+ }
1230
+ Is2.boolean = boolean;
1231
+ function string(value) {
1232
+ return toString.call(value) === "[object String]";
1233
+ }
1234
+ Is2.string = string;
1235
+ function number(value) {
1236
+ return toString.call(value) === "[object Number]";
1237
+ }
1238
+ Is2.number = number;
1239
+ function numberRange(value, min, max) {
1240
+ return toString.call(value) === "[object Number]" && min <= value && value <= max;
1241
+ }
1242
+ Is2.numberRange = numberRange;
1243
+ function integer2(value) {
1244
+ return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647;
1245
+ }
1246
+ Is2.integer = integer2;
1247
+ function uinteger2(value) {
1248
+ return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647;
1249
+ }
1250
+ Is2.uinteger = uinteger2;
1251
+ function func(value) {
1252
+ return toString.call(value) === "[object Function]";
1253
+ }
1254
+ Is2.func = func;
1255
+ function objectLiteral(value) {
1256
+ return value !== null && typeof value === "object";
1257
+ }
1258
+ Is2.objectLiteral = objectLiteral;
1259
+ function typedArray(value, check) {
1260
+ return Array.isArray(value) && value.every(check);
1261
+ }
1262
+ Is2.typedArray = typedArray;
1263
+ })(Is || (Is = {}));
1264
+ var DiagnosticsAdapter = class {
1265
+ constructor(_languageId, _worker, configChangeEvent) {
1266
+ this._languageId = _languageId;
1267
+ this._worker = _worker;
1268
+ this._disposables = [];
1269
+ this._listener = /* @__PURE__ */ Object.create(null);
1270
+ const onModelAdd = (model) => {
1271
+ let modeId = model.getLanguageId();
1272
+ if (modeId !== this._languageId) {
1273
+ return;
1274
+ }
1275
+ let handle;
1276
+ this._listener[model.uri.toString()] = model.onDidChangeContent(() => {
1277
+ window.clearTimeout(handle);
1278
+ handle = window.setTimeout(() => this._doValidate(model.uri, modeId), 500);
1279
+ });
1280
+ this._doValidate(model.uri, modeId);
1281
+ };
1282
+ const onModelRemoved = (model) => {
1283
+ monaco_editor_core_exports.editor.setModelMarkers(model, this._languageId, []);
1284
+ let uriStr = model.uri.toString();
1285
+ let listener = this._listener[uriStr];
1286
+ if (listener) {
1287
+ listener.dispose();
1288
+ delete this._listener[uriStr];
1289
+ }
1290
+ };
1291
+ this._disposables.push(monaco_editor_core_exports.editor.onDidCreateModel(onModelAdd));
1292
+ this._disposables.push(monaco_editor_core_exports.editor.onWillDisposeModel(onModelRemoved));
1293
+ this._disposables.push(
1294
+ monaco_editor_core_exports.editor.onDidChangeModelLanguage((event) => {
1295
+ onModelRemoved(event.model);
1296
+ onModelAdd(event.model);
1297
+ })
1298
+ );
1299
+ this._disposables.push(
1300
+ configChangeEvent((_) => {
1301
+ monaco_editor_core_exports.editor.getModels().forEach((model) => {
1302
+ if (model.getLanguageId() === this._languageId) {
1303
+ onModelRemoved(model);
1304
+ onModelAdd(model);
1305
+ }
1306
+ });
1307
+ })
1308
+ );
1309
+ this._disposables.push({
1310
+ dispose: () => {
1311
+ monaco_editor_core_exports.editor.getModels().forEach(onModelRemoved);
1312
+ for (let key in this._listener) {
1313
+ this._listener[key].dispose();
1314
+ }
1315
+ }
1316
+ });
1317
+ monaco_editor_core_exports.editor.getModels().forEach(onModelAdd);
1318
+ }
1319
+ dispose() {
1320
+ this._disposables.forEach((d) => d && d.dispose());
1321
+ this._disposables.length = 0;
1322
+ }
1323
+ _doValidate(resource, languageId) {
1324
+ this._worker(resource).then((worker) => {
1325
+ return worker.doValidation(resource.toString());
1326
+ }).then((diagnostics) => {
1327
+ const markers = diagnostics.map((d) => toDiagnostics(resource, d));
1328
+ let model = monaco_editor_core_exports.editor.getModel(resource);
1329
+ if (model && model.getLanguageId() === languageId) {
1330
+ monaco_editor_core_exports.editor.setModelMarkers(model, languageId, markers);
1331
+ }
1332
+ }).then(void 0, (err) => {
1333
+ console.error(err);
1334
+ });
1335
+ }
1336
+ };
1337
+ function toSeverity(lsSeverity) {
1338
+ switch (lsSeverity) {
1339
+ case DiagnosticSeverity.Error:
1340
+ return monaco_editor_core_exports.MarkerSeverity.Error;
1341
+ case DiagnosticSeverity.Warning:
1342
+ return monaco_editor_core_exports.MarkerSeverity.Warning;
1343
+ case DiagnosticSeverity.Information:
1344
+ return monaco_editor_core_exports.MarkerSeverity.Info;
1345
+ case DiagnosticSeverity.Hint:
1346
+ return monaco_editor_core_exports.MarkerSeverity.Hint;
1347
+ default:
1348
+ return monaco_editor_core_exports.MarkerSeverity.Info;
1349
+ }
1350
+ }
1351
+ function toDiagnostics(resource, diag) {
1352
+ let code = typeof diag.code === "number" ? String(diag.code) : diag.code;
1353
+ return {
1354
+ severity: toSeverity(diag.severity),
1355
+ startLineNumber: diag.range.start.line + 1,
1356
+ startColumn: diag.range.start.character + 1,
1357
+ endLineNumber: diag.range.end.line + 1,
1358
+ endColumn: diag.range.end.character + 1,
1359
+ message: diag.message,
1360
+ code,
1361
+ source: diag.source
1362
+ };
1363
+ }
1364
+ var CompletionAdapter = class {
1365
+ constructor(_worker, _triggerCharacters) {
1366
+ this._worker = _worker;
1367
+ this._triggerCharacters = _triggerCharacters;
1368
+ }
1369
+ get triggerCharacters() {
1370
+ return this._triggerCharacters;
1371
+ }
1372
+ provideCompletionItems(model, position, context, token) {
1373
+ const resource = model.uri;
1374
+ return this._worker(resource).then((worker) => {
1375
+ return worker.doComplete(resource.toString(), fromPosition(position));
1376
+ }).then((info) => {
1377
+ if (!info) {
1378
+ return;
1379
+ }
1380
+ const wordInfo = model.getWordUntilPosition(position);
1381
+ const wordRange = new monaco_editor_core_exports.Range(
1382
+ position.lineNumber,
1383
+ wordInfo.startColumn,
1384
+ position.lineNumber,
1385
+ wordInfo.endColumn
1386
+ );
1387
+ const items = info.items.map((entry) => {
1388
+ const item = {
1389
+ label: entry.label,
1390
+ insertText: entry.insertText || entry.label,
1391
+ sortText: entry.sortText,
1392
+ filterText: entry.filterText,
1393
+ documentation: entry.documentation,
1394
+ detail: entry.detail,
1395
+ command: toCommand(entry.command),
1396
+ range: wordRange,
1397
+ kind: toCompletionItemKind(entry.kind)
1398
+ };
1399
+ if (entry.textEdit) {
1400
+ if (isInsertReplaceEdit(entry.textEdit)) {
1401
+ item.range = {
1402
+ insert: toRange(entry.textEdit.insert),
1403
+ replace: toRange(entry.textEdit.replace)
1404
+ };
1405
+ } else {
1406
+ item.range = toRange(entry.textEdit.range);
1407
+ }
1408
+ item.insertText = entry.textEdit.newText;
1409
+ }
1410
+ if (entry.additionalTextEdits) {
1411
+ item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
1412
+ }
1413
+ if (entry.insertTextFormat === InsertTextFormat.Snippet) {
1414
+ item.insertTextRules = monaco_editor_core_exports.languages.CompletionItemInsertTextRule.InsertAsSnippet;
1415
+ }
1416
+ return item;
1417
+ });
1418
+ return {
1419
+ isIncomplete: info.isIncomplete,
1420
+ suggestions: items
1421
+ };
1422
+ });
1423
+ }
1424
+ };
1425
+ function fromPosition(position) {
1426
+ if (!position) {
1427
+ return void 0;
1428
+ }
1429
+ return { character: position.column - 1, line: position.lineNumber - 1 };
1430
+ }
1431
+ function fromRange(range) {
1432
+ if (!range) {
1433
+ return void 0;
1434
+ }
1435
+ return {
1436
+ start: {
1437
+ line: range.startLineNumber - 1,
1438
+ character: range.startColumn - 1
1439
+ },
1440
+ end: { line: range.endLineNumber - 1, character: range.endColumn - 1 }
1441
+ };
1442
+ }
1443
+ function toRange(range) {
1444
+ if (!range) {
1445
+ return void 0;
1446
+ }
1447
+ return new monaco_editor_core_exports.Range(
1448
+ range.start.line + 1,
1449
+ range.start.character + 1,
1450
+ range.end.line + 1,
1451
+ range.end.character + 1
1452
+ );
1453
+ }
1454
+ function isInsertReplaceEdit(edit) {
1455
+ return typeof edit.insert !== "undefined" && typeof edit.replace !== "undefined";
1456
+ }
1457
+ function toCompletionItemKind(kind) {
1458
+ const mItemKind = monaco_editor_core_exports.languages.CompletionItemKind;
1459
+ switch (kind) {
1460
+ case CompletionItemKind.Text:
1461
+ return mItemKind.Text;
1462
+ case CompletionItemKind.Method:
1463
+ return mItemKind.Method;
1464
+ case CompletionItemKind.Function:
1465
+ return mItemKind.Function;
1466
+ case CompletionItemKind.Constructor:
1467
+ return mItemKind.Constructor;
1468
+ case CompletionItemKind.Field:
1469
+ return mItemKind.Field;
1470
+ case CompletionItemKind.Variable:
1471
+ return mItemKind.Variable;
1472
+ case CompletionItemKind.Class:
1473
+ return mItemKind.Class;
1474
+ case CompletionItemKind.Interface:
1475
+ return mItemKind.Interface;
1476
+ case CompletionItemKind.Module:
1477
+ return mItemKind.Module;
1478
+ case CompletionItemKind.Property:
1479
+ return mItemKind.Property;
1480
+ case CompletionItemKind.Unit:
1481
+ return mItemKind.Unit;
1482
+ case CompletionItemKind.Value:
1483
+ return mItemKind.Value;
1484
+ case CompletionItemKind.Enum:
1485
+ return mItemKind.Enum;
1486
+ case CompletionItemKind.Keyword:
1487
+ return mItemKind.Keyword;
1488
+ case CompletionItemKind.Snippet:
1489
+ return mItemKind.Snippet;
1490
+ case CompletionItemKind.Color:
1491
+ return mItemKind.Color;
1492
+ case CompletionItemKind.File:
1493
+ return mItemKind.File;
1494
+ case CompletionItemKind.Reference:
1495
+ return mItemKind.Reference;
1496
+ }
1497
+ return mItemKind.Property;
1498
+ }
1499
+ function toTextEdit(textEdit) {
1500
+ if (!textEdit) {
1501
+ return void 0;
1502
+ }
1503
+ return {
1504
+ range: toRange(textEdit.range),
1505
+ text: textEdit.newText
1506
+ };
1507
+ }
1508
+ function toCommand(c) {
1509
+ return c && c.command === "editor.action.triggerSuggest" ? { id: c.command, title: c.title, arguments: c.arguments } : void 0;
1510
+ }
1511
+ var HoverAdapter = class {
1512
+ constructor(_worker) {
1513
+ this._worker = _worker;
1514
+ }
1515
+ provideHover(model, position, token) {
1516
+ let resource = model.uri;
1517
+ return this._worker(resource).then((worker) => {
1518
+ return worker.doHover(resource.toString(), fromPosition(position));
1519
+ }).then((info) => {
1520
+ if (!info) {
1521
+ return;
1522
+ }
1523
+ return {
1524
+ range: toRange(info.range),
1525
+ contents: toMarkedStringArray(info.contents)
1526
+ };
1527
+ });
1528
+ }
1529
+ };
1530
+ function isMarkupContent(thing) {
1531
+ return thing && typeof thing === "object" && typeof thing.kind === "string";
1532
+ }
1533
+ function toMarkdownString(entry) {
1534
+ if (typeof entry === "string") {
1535
+ return {
1536
+ value: entry
1537
+ };
1538
+ }
1539
+ if (isMarkupContent(entry)) {
1540
+ if (entry.kind === "plaintext") {
1541
+ return {
1542
+ value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&")
1543
+ };
1544
+ }
1545
+ return {
1546
+ value: entry.value
1547
+ };
1548
+ }
1549
+ return { value: "```" + entry.language + "\n" + entry.value + "\n```\n" };
1550
+ }
1551
+ function toMarkedStringArray(contents) {
1552
+ if (!contents) {
1553
+ return void 0;
1554
+ }
1555
+ if (Array.isArray(contents)) {
1556
+ return contents.map(toMarkdownString);
1557
+ }
1558
+ return [toMarkdownString(contents)];
1559
+ }
1560
+ var DocumentHighlightAdapter = class {
1561
+ constructor(_worker) {
1562
+ this._worker = _worker;
1563
+ }
1564
+ provideDocumentHighlights(model, position, token) {
1565
+ const resource = model.uri;
1566
+ return this._worker(resource).then((worker) => worker.findDocumentHighlights(resource.toString(), fromPosition(position))).then((entries) => {
1567
+ if (!entries) {
1568
+ return;
1569
+ }
1570
+ return entries.map((entry) => {
1571
+ return {
1572
+ range: toRange(entry.range),
1573
+ kind: toDocumentHighlightKind(entry.kind)
1574
+ };
1575
+ });
1576
+ });
1577
+ }
1578
+ };
1579
+ function toDocumentHighlightKind(kind) {
1580
+ switch (kind) {
1581
+ case DocumentHighlightKind.Read:
1582
+ return monaco_editor_core_exports.languages.DocumentHighlightKind.Read;
1583
+ case DocumentHighlightKind.Write:
1584
+ return monaco_editor_core_exports.languages.DocumentHighlightKind.Write;
1585
+ case DocumentHighlightKind.Text:
1586
+ return monaco_editor_core_exports.languages.DocumentHighlightKind.Text;
1587
+ }
1588
+ return monaco_editor_core_exports.languages.DocumentHighlightKind.Text;
1589
+ }
1590
+ var DefinitionAdapter = class {
1591
+ constructor(_worker) {
1592
+ this._worker = _worker;
1593
+ }
1594
+ provideDefinition(model, position, token) {
1595
+ const resource = model.uri;
1596
+ return this._worker(resource).then((worker) => {
1597
+ return worker.findDefinition(resource.toString(), fromPosition(position));
1598
+ }).then((definition) => {
1599
+ if (!definition) {
1600
+ return;
1601
+ }
1602
+ return [toLocation(definition)];
1603
+ });
1604
+ }
1605
+ };
1606
+ function toLocation(location) {
1607
+ return {
1608
+ uri: monaco_editor_core_exports.Uri.parse(location.uri),
1609
+ range: toRange(location.range)
1610
+ };
1611
+ }
1612
+ var ReferenceAdapter = class {
1613
+ constructor(_worker) {
1614
+ this._worker = _worker;
1615
+ }
1616
+ provideReferences(model, position, context, token) {
1617
+ const resource = model.uri;
1618
+ return this._worker(resource).then((worker) => {
1619
+ return worker.findReferences(resource.toString(), fromPosition(position));
1620
+ }).then((entries) => {
1621
+ if (!entries) {
1622
+ return;
1623
+ }
1624
+ return entries.map(toLocation);
1625
+ });
1626
+ }
1627
+ };
1628
+ var RenameAdapter = class {
1629
+ constructor(_worker) {
1630
+ this._worker = _worker;
1631
+ }
1632
+ provideRenameEdits(model, position, newName, token) {
1633
+ const resource = model.uri;
1634
+ return this._worker(resource).then((worker) => {
1635
+ return worker.doRename(resource.toString(), fromPosition(position), newName);
1636
+ }).then((edit) => {
1637
+ return toWorkspaceEdit(edit);
1638
+ });
1639
+ }
1640
+ };
1641
+ function toWorkspaceEdit(edit) {
1642
+ if (!edit || !edit.changes) {
1643
+ return void 0;
1644
+ }
1645
+ let resourceEdits = [];
1646
+ for (let uri in edit.changes) {
1647
+ const _uri = monaco_editor_core_exports.Uri.parse(uri);
1648
+ for (let e of edit.changes[uri]) {
1649
+ resourceEdits.push({
1650
+ resource: _uri,
1651
+ versionId: void 0,
1652
+ textEdit: {
1653
+ range: toRange(e.range),
1654
+ text: e.newText
1655
+ }
1656
+ });
1657
+ }
1658
+ }
1659
+ return {
1660
+ edits: resourceEdits
1661
+ };
1662
+ }
1663
+ var DocumentSymbolAdapter = class {
1664
+ constructor(_worker) {
1665
+ this._worker = _worker;
1666
+ }
1667
+ provideDocumentSymbols(model, token) {
1668
+ const resource = model.uri;
1669
+ return this._worker(resource).then((worker) => worker.findDocumentSymbols(resource.toString())).then((items) => {
1670
+ if (!items) {
1671
+ return;
1672
+ }
1673
+ return items.map((item) => {
1674
+ if (isDocumentSymbol(item)) {
1675
+ return toDocumentSymbol(item);
1676
+ }
1677
+ return {
1678
+ name: item.name,
1679
+ detail: "",
1680
+ containerName: item.containerName,
1681
+ kind: toSymbolKind(item.kind),
1682
+ range: toRange(item.location.range),
1683
+ selectionRange: toRange(item.location.range),
1684
+ tags: []
1685
+ };
1686
+ });
1687
+ });
1688
+ }
1689
+ };
1690
+ function isDocumentSymbol(symbol) {
1691
+ return "children" in symbol;
1692
+ }
1693
+ function toDocumentSymbol(symbol) {
1694
+ var _a, _b, _c;
1695
+ return {
1696
+ name: symbol.name,
1697
+ detail: (_a = symbol.detail) != null ? _a : "",
1698
+ kind: toSymbolKind(symbol.kind),
1699
+ range: toRange(symbol.range),
1700
+ selectionRange: toRange(symbol.selectionRange),
1701
+ tags: (_b = symbol.tags) != null ? _b : [],
1702
+ children: ((_c = symbol.children) != null ? _c : []).map((item) => toDocumentSymbol(item))
1703
+ };
1704
+ }
1705
+ function toSymbolKind(kind) {
1706
+ let mKind = monaco_editor_core_exports.languages.SymbolKind;
1707
+ switch (kind) {
1708
+ case SymbolKind.File:
1709
+ return mKind.File;
1710
+ case SymbolKind.Module:
1711
+ return mKind.Module;
1712
+ case SymbolKind.Namespace:
1713
+ return mKind.Namespace;
1714
+ case SymbolKind.Package:
1715
+ return mKind.Package;
1716
+ case SymbolKind.Class:
1717
+ return mKind.Class;
1718
+ case SymbolKind.Method:
1719
+ return mKind.Method;
1720
+ case SymbolKind.Property:
1721
+ return mKind.Property;
1722
+ case SymbolKind.Field:
1723
+ return mKind.Field;
1724
+ case SymbolKind.Constructor:
1725
+ return mKind.Constructor;
1726
+ case SymbolKind.Enum:
1727
+ return mKind.Enum;
1728
+ case SymbolKind.Interface:
1729
+ return mKind.Interface;
1730
+ case SymbolKind.Function:
1731
+ return mKind.Function;
1732
+ case SymbolKind.Variable:
1733
+ return mKind.Variable;
1734
+ case SymbolKind.Constant:
1735
+ return mKind.Constant;
1736
+ case SymbolKind.String:
1737
+ return mKind.String;
1738
+ case SymbolKind.Number:
1739
+ return mKind.Number;
1740
+ case SymbolKind.Boolean:
1741
+ return mKind.Boolean;
1742
+ case SymbolKind.Array:
1743
+ return mKind.Array;
1744
+ }
1745
+ return mKind.Function;
1746
+ }
1747
+ var DocumentLinkAdapter = class {
1748
+ constructor(_worker) {
1749
+ this._worker = _worker;
1750
+ }
1751
+ provideLinks(model, token) {
1752
+ const resource = model.uri;
1753
+ return this._worker(resource).then((worker) => worker.findDocumentLinks(resource.toString())).then((items) => {
1754
+ if (!items) {
1755
+ return;
1756
+ }
1757
+ return {
1758
+ links: items.map((item) => ({
1759
+ range: toRange(item.range),
1760
+ url: item.target
1761
+ }))
1762
+ };
1763
+ });
1764
+ }
1765
+ };
1766
+ var DocumentFormattingEditProvider = class {
1767
+ constructor(_worker) {
1768
+ this._worker = _worker;
1769
+ }
1770
+ provideDocumentFormattingEdits(model, options, token) {
1771
+ const resource = model.uri;
1772
+ return this._worker(resource).then((worker) => {
1773
+ return worker.format(resource.toString(), null, fromFormattingOptions(options)).then((edits) => {
1774
+ if (!edits || edits.length === 0) {
1775
+ return;
1776
+ }
1777
+ return edits.map(toTextEdit);
1778
+ });
1779
+ });
1780
+ }
1781
+ };
1782
+ var DocumentRangeFormattingEditProvider = class {
1783
+ constructor(_worker) {
1784
+ this._worker = _worker;
1785
+ this.canFormatMultipleRanges = false;
1786
+ }
1787
+ provideDocumentRangeFormattingEdits(model, range, options, token) {
1788
+ const resource = model.uri;
1789
+ return this._worker(resource).then((worker) => {
1790
+ return worker.format(resource.toString(), fromRange(range), fromFormattingOptions(options)).then((edits) => {
1791
+ if (!edits || edits.length === 0) {
1792
+ return;
1793
+ }
1794
+ return edits.map(toTextEdit);
1795
+ });
1796
+ });
1797
+ }
1798
+ };
1799
+ function fromFormattingOptions(options) {
1800
+ return {
1801
+ tabSize: options.tabSize,
1802
+ insertSpaces: options.insertSpaces
1803
+ };
1804
+ }
1805
+ var DocumentColorAdapter = class {
1806
+ constructor(_worker) {
1807
+ this._worker = _worker;
1808
+ }
1809
+ provideDocumentColors(model, token) {
1810
+ const resource = model.uri;
1811
+ return this._worker(resource).then((worker) => worker.findDocumentColors(resource.toString())).then((infos) => {
1812
+ if (!infos) {
1813
+ return;
1814
+ }
1815
+ return infos.map((item) => ({
1816
+ color: item.color,
1817
+ range: toRange(item.range)
1818
+ }));
1819
+ });
1820
+ }
1821
+ provideColorPresentations(model, info, token) {
1822
+ const resource = model.uri;
1823
+ return this._worker(resource).then(
1824
+ (worker) => worker.getColorPresentations(resource.toString(), info.color, fromRange(info.range))
1825
+ ).then((presentations) => {
1826
+ if (!presentations) {
1827
+ return;
1828
+ }
1829
+ return presentations.map((presentation) => {
1830
+ let item = {
1831
+ label: presentation.label
1832
+ };
1833
+ if (presentation.textEdit) {
1834
+ item.textEdit = toTextEdit(presentation.textEdit);
1835
+ }
1836
+ if (presentation.additionalTextEdits) {
1837
+ item.additionalTextEdits = presentation.additionalTextEdits.map(toTextEdit);
1838
+ }
1839
+ return item;
1840
+ });
1841
+ });
1842
+ }
1843
+ };
1844
+ var FoldingRangeAdapter = class {
1845
+ constructor(_worker) {
1846
+ this._worker = _worker;
1847
+ }
1848
+ provideFoldingRanges(model, context, token) {
1849
+ const resource = model.uri;
1850
+ return this._worker(resource).then((worker) => worker.getFoldingRanges(resource.toString(), context)).then((ranges) => {
1851
+ if (!ranges) {
1852
+ return;
1853
+ }
1854
+ return ranges.map((range) => {
1855
+ const result = {
1856
+ start: range.startLine + 1,
1857
+ end: range.endLine + 1
1858
+ };
1859
+ if (typeof range.kind !== "undefined") {
1860
+ result.kind = toFoldingRangeKind(range.kind);
1861
+ }
1862
+ return result;
1863
+ });
1864
+ });
1865
+ }
1866
+ };
1867
+ function toFoldingRangeKind(kind) {
1868
+ switch (kind) {
1869
+ case FoldingRangeKind.Comment:
1870
+ return monaco_editor_core_exports.languages.FoldingRangeKind.Comment;
1871
+ case FoldingRangeKind.Imports:
1872
+ return monaco_editor_core_exports.languages.FoldingRangeKind.Imports;
1873
+ case FoldingRangeKind.Region:
1874
+ return monaco_editor_core_exports.languages.FoldingRangeKind.Region;
1875
+ }
1876
+ return void 0;
1877
+ }
1878
+ var SelectionRangeAdapter = class {
1879
+ constructor(_worker) {
1880
+ this._worker = _worker;
1881
+ }
1882
+ provideSelectionRanges(model, positions, token) {
1883
+ const resource = model.uri;
1884
+ return this._worker(resource).then(
1885
+ (worker) => worker.getSelectionRanges(
1886
+ resource.toString(),
1887
+ positions.map(fromPosition)
1888
+ )
1889
+ ).then((selectionRanges) => {
1890
+ if (!selectionRanges) {
1891
+ return;
1892
+ }
1893
+ return selectionRanges.map((selectionRange) => {
1894
+ const result = [];
1895
+ while (selectionRange) {
1896
+ result.push({ range: toRange(selectionRange.range) });
1897
+ selectionRange = selectionRange.parent;
1898
+ }
1899
+ return result;
1900
+ });
1901
+ });
1902
+ }
1903
+ };
1904
+ var HTMLCompletionAdapter = class extends CompletionAdapter {
1905
+ constructor(worker) {
1906
+ super(worker, [".", ":", "<", '"', "=", "/"]);
1907
+ }
1908
+ };
1909
+ function setupMode1(defaults) {
1910
+ const client = new WorkerManager(defaults);
1911
+ const worker = (...uris) => {
1912
+ return client.getLanguageServiceWorker(...uris);
1913
+ };
1914
+ let languageId = defaults.languageId;
1915
+ monaco_editor_core_exports.languages.registerCompletionItemProvider(languageId, new HTMLCompletionAdapter(worker));
1916
+ monaco_editor_core_exports.languages.registerHoverProvider(languageId, new HoverAdapter(worker));
1917
+ monaco_editor_core_exports.languages.registerDocumentHighlightProvider(
1918
+ languageId,
1919
+ new DocumentHighlightAdapter(worker)
1920
+ );
1921
+ monaco_editor_core_exports.languages.registerLinkProvider(languageId, new DocumentLinkAdapter(worker));
1922
+ monaco_editor_core_exports.languages.registerFoldingRangeProvider(
1923
+ languageId,
1924
+ new FoldingRangeAdapter(worker)
1925
+ );
1926
+ monaco_editor_core_exports.languages.registerDocumentSymbolProvider(
1927
+ languageId,
1928
+ new DocumentSymbolAdapter(worker)
1929
+ );
1930
+ monaco_editor_core_exports.languages.registerSelectionRangeProvider(
1931
+ languageId,
1932
+ new SelectionRangeAdapter(worker)
1933
+ );
1934
+ monaco_editor_core_exports.languages.registerRenameProvider(languageId, new RenameAdapter(worker));
1935
+ if (languageId === "html") {
1936
+ monaco_editor_core_exports.languages.registerDocumentFormattingEditProvider(
1937
+ languageId,
1938
+ new DocumentFormattingEditProvider(worker)
1939
+ );
1940
+ monaco_editor_core_exports.languages.registerDocumentRangeFormattingEditProvider(
1941
+ languageId,
1942
+ new DocumentRangeFormattingEditProvider(worker)
1943
+ );
1944
+ }
1945
+ }
1946
+ function setupMode(defaults) {
1947
+ const disposables = [];
1948
+ const providers = [];
1949
+ const client = new WorkerManager(defaults);
1950
+ disposables.push(client);
1951
+ const worker = (...uris) => {
1952
+ return client.getLanguageServiceWorker(...uris);
1953
+ };
1954
+ function registerProviders() {
1955
+ const { languageId, modeConfiguration } = defaults;
1956
+ disposeAll(providers);
1957
+ if (modeConfiguration.completionItems) {
1958
+ providers.push(
1959
+ monaco_editor_core_exports.languages.registerCompletionItemProvider(languageId, new HTMLCompletionAdapter(worker))
1960
+ );
1961
+ }
1962
+ if (modeConfiguration.hovers) {
1963
+ providers.push(
1964
+ monaco_editor_core_exports.languages.registerHoverProvider(languageId, new HoverAdapter(worker))
1965
+ );
1966
+ }
1967
+ if (modeConfiguration.documentHighlights) {
1968
+ providers.push(
1969
+ monaco_editor_core_exports.languages.registerDocumentHighlightProvider(
1970
+ languageId,
1971
+ new DocumentHighlightAdapter(worker)
1972
+ )
1973
+ );
1974
+ }
1975
+ if (modeConfiguration.links) {
1976
+ providers.push(
1977
+ monaco_editor_core_exports.languages.registerLinkProvider(languageId, new DocumentLinkAdapter(worker))
1978
+ );
1979
+ }
1980
+ if (modeConfiguration.documentSymbols) {
1981
+ providers.push(
1982
+ monaco_editor_core_exports.languages.registerDocumentSymbolProvider(
1983
+ languageId,
1984
+ new DocumentSymbolAdapter(worker)
1985
+ )
1986
+ );
1987
+ }
1988
+ if (modeConfiguration.rename) {
1989
+ providers.push(
1990
+ monaco_editor_core_exports.languages.registerRenameProvider(languageId, new RenameAdapter(worker))
1991
+ );
1992
+ }
1993
+ if (modeConfiguration.foldingRanges) {
1994
+ providers.push(
1995
+ monaco_editor_core_exports.languages.registerFoldingRangeProvider(
1996
+ languageId,
1997
+ new FoldingRangeAdapter(worker)
1998
+ )
1999
+ );
2000
+ }
2001
+ if (modeConfiguration.selectionRanges) {
2002
+ providers.push(
2003
+ monaco_editor_core_exports.languages.registerSelectionRangeProvider(
2004
+ languageId,
2005
+ new SelectionRangeAdapter(worker)
2006
+ )
2007
+ );
2008
+ }
2009
+ if (modeConfiguration.documentFormattingEdits) {
2010
+ providers.push(
2011
+ monaco_editor_core_exports.languages.registerDocumentFormattingEditProvider(
2012
+ languageId,
2013
+ new DocumentFormattingEditProvider(worker)
2014
+ )
2015
+ );
2016
+ }
2017
+ if (modeConfiguration.documentRangeFormattingEdits) {
2018
+ providers.push(
2019
+ monaco_editor_core_exports.languages.registerDocumentRangeFormattingEditProvider(
2020
+ languageId,
2021
+ new DocumentRangeFormattingEditProvider(worker)
2022
+ )
2023
+ );
2024
+ }
2025
+ }
2026
+ registerProviders();
2027
+ disposables.push(asDisposable(providers));
2028
+ return asDisposable(disposables);
2029
+ }
2030
+ function asDisposable(disposables) {
2031
+ return { dispose: () => disposeAll(disposables) };
2032
+ }
2033
+ function disposeAll(disposables) {
2034
+ while (disposables.length) {
2035
+ disposables.pop().dispose();
2036
+ }
2037
+ }
2038
+ export {
2039
+ CompletionAdapter,
2040
+ DefinitionAdapter,
2041
+ DiagnosticsAdapter,
2042
+ DocumentColorAdapter,
2043
+ DocumentFormattingEditProvider,
2044
+ DocumentHighlightAdapter,
2045
+ DocumentLinkAdapter,
2046
+ DocumentRangeFormattingEditProvider,
2047
+ DocumentSymbolAdapter,
2048
+ FoldingRangeAdapter,
2049
+ HoverAdapter,
2050
+ ReferenceAdapter,
2051
+ RenameAdapter,
2052
+ SelectionRangeAdapter,
2053
+ WorkerManager,
2054
+ fromPosition,
2055
+ fromRange,
2056
+ setupMode,
2057
+ setupMode1,
2058
+ toRange,
2059
+ toTextEdit
2060
+ };