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