@depup/vscode-languageserver-types 3.18.3-depup.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,2415 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ 'use strict';
6
+ export var DocumentUri;
7
+ (function (DocumentUri) {
8
+ function is(value) {
9
+ return typeof value === 'string';
10
+ }
11
+ DocumentUri.is = is;
12
+ })(DocumentUri || (DocumentUri = {}));
13
+ export var URI;
14
+ (function (URI) {
15
+ function is(value) {
16
+ return typeof value === 'string';
17
+ }
18
+ URI.is = is;
19
+ })(URI || (URI = {}));
20
+ export var integer;
21
+ (function (integer) {
22
+ integer.MIN_VALUE = -2147483648;
23
+ integer.MAX_VALUE = 2147483647;
24
+ function is(value) {
25
+ return typeof value === 'number' && integer.MIN_VALUE <= value && value <= integer.MAX_VALUE;
26
+ }
27
+ integer.is = is;
28
+ })(integer || (integer = {}));
29
+ export var uinteger;
30
+ (function (uinteger) {
31
+ uinteger.MIN_VALUE = 0;
32
+ uinteger.MAX_VALUE = 2147483647;
33
+ function is(value) {
34
+ return typeof value === 'number' && uinteger.MIN_VALUE <= value && value <= uinteger.MAX_VALUE;
35
+ }
36
+ uinteger.is = is;
37
+ })(uinteger || (uinteger = {}));
38
+ /**
39
+ * The Position namespace provides helper functions to work with
40
+ * {@link Position} literals.
41
+ */
42
+ export var Position;
43
+ (function (Position) {
44
+ /**
45
+ * Creates a new Position literal from the given line and character.
46
+ * @param line The position's line.
47
+ * @param character The position's character.
48
+ */
49
+ function create(line, character) {
50
+ if (line === Number.MAX_VALUE) {
51
+ line = uinteger.MAX_VALUE;
52
+ }
53
+ if (character === Number.MAX_VALUE) {
54
+ character = uinteger.MAX_VALUE;
55
+ }
56
+ return { line, character };
57
+ }
58
+ Position.create = create;
59
+ /**
60
+ * Checks whether the given literal conforms to the {@link Position} interface.
61
+ */
62
+ function is(value) {
63
+ const candidate = value;
64
+ return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
65
+ }
66
+ Position.is = is;
67
+ })(Position || (Position = {}));
68
+ /**
69
+ * The Range namespace provides helper functions to work with
70
+ * {@link Range} literals.
71
+ */
72
+ export var Range;
73
+ (function (Range) {
74
+ function create(one, two, three, four) {
75
+ if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
76
+ return { start: Position.create(one, two), end: Position.create(three, four) };
77
+ }
78
+ else if (Position.is(one) && Position.is(two)) {
79
+ return { start: one, end: two };
80
+ }
81
+ else {
82
+ throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);
83
+ }
84
+ }
85
+ Range.create = create;
86
+ /**
87
+ * Checks whether the given literal conforms to the {@link Range} interface.
88
+ */
89
+ function is(value) {
90
+ const candidate = value;
91
+ return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
92
+ }
93
+ Range.is = is;
94
+ })(Range || (Range = {}));
95
+ /**
96
+ * The Location namespace provides helper functions to work with
97
+ * {@link Location} literals.
98
+ */
99
+ export var Location;
100
+ (function (Location) {
101
+ /**
102
+ * Creates a Location literal.
103
+ * @param uri The location's uri.
104
+ * @param range The location's range.
105
+ */
106
+ function create(uri, range) {
107
+ return { uri, range };
108
+ }
109
+ Location.create = create;
110
+ /**
111
+ * Checks whether the given literal conforms to the {@link Location} interface.
112
+ */
113
+ function is(value) {
114
+ const candidate = value;
115
+ return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
116
+ }
117
+ Location.is = is;
118
+ })(Location || (Location = {}));
119
+ /**
120
+ * The LocationLink namespace provides helper functions to work with
121
+ * {@link LocationLink} literals.
122
+ */
123
+ export var LocationLink;
124
+ (function (LocationLink) {
125
+ /**
126
+ * Creates a LocationLink literal.
127
+ * @param targetUri The definition's uri.
128
+ * @param targetRange The full range of the definition.
129
+ * @param targetSelectionRange The span of the symbol definition at the target.
130
+ * @param originSelectionRange The span of the symbol being defined in the originating source file.
131
+ */
132
+ function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
133
+ return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
134
+ }
135
+ LocationLink.create = create;
136
+ /**
137
+ * Checks whether the given literal conforms to the {@link LocationLink} interface.
138
+ */
139
+ function is(value) {
140
+ const candidate = value;
141
+ return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
142
+ && Range.is(candidate.targetSelectionRange)
143
+ && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
144
+ }
145
+ LocationLink.is = is;
146
+ })(LocationLink || (LocationLink = {}));
147
+ /**
148
+ * The Color namespace provides helper functions to work with
149
+ * {@link Color} literals.
150
+ */
151
+ export var Color;
152
+ (function (Color) {
153
+ /**
154
+ * Creates a new Color literal.
155
+ */
156
+ function create(red, green, blue, alpha) {
157
+ return {
158
+ red,
159
+ green,
160
+ blue,
161
+ alpha,
162
+ };
163
+ }
164
+ Color.create = create;
165
+ /**
166
+ * Checks whether the given literal conforms to the {@link Color} interface.
167
+ */
168
+ function is(value) {
169
+ const candidate = value;
170
+ return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1)
171
+ && Is.numberRange(candidate.green, 0, 1)
172
+ && Is.numberRange(candidate.blue, 0, 1)
173
+ && Is.numberRange(candidate.alpha, 0, 1);
174
+ }
175
+ Color.is = is;
176
+ })(Color || (Color = {}));
177
+ /**
178
+ * The ColorInformation namespace provides helper functions to work with
179
+ * {@link ColorInformation} literals.
180
+ */
181
+ export var ColorInformation;
182
+ (function (ColorInformation) {
183
+ /**
184
+ * Creates a new ColorInformation literal.
185
+ */
186
+ function create(range, color) {
187
+ return {
188
+ range,
189
+ color,
190
+ };
191
+ }
192
+ ColorInformation.create = create;
193
+ /**
194
+ * Checks whether the given literal conforms to the {@link ColorInformation} interface.
195
+ */
196
+ function is(value) {
197
+ const candidate = value;
198
+ return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);
199
+ }
200
+ ColorInformation.is = is;
201
+ })(ColorInformation || (ColorInformation = {}));
202
+ /**
203
+ * The Color namespace provides helper functions to work with
204
+ * {@link ColorPresentation} literals.
205
+ */
206
+ export var ColorPresentation;
207
+ (function (ColorPresentation) {
208
+ /**
209
+ * Creates a new ColorInformation literal.
210
+ */
211
+ function create(label, textEdit, additionalTextEdits) {
212
+ return {
213
+ label,
214
+ textEdit,
215
+ additionalTextEdits,
216
+ };
217
+ }
218
+ ColorPresentation.create = create;
219
+ /**
220
+ * Checks whether the given literal conforms to the {@link ColorInformation} interface.
221
+ */
222
+ function is(value) {
223
+ const candidate = value;
224
+ return Is.objectLiteral(candidate) && Is.string(candidate.label)
225
+ && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
226
+ && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
227
+ }
228
+ ColorPresentation.is = is;
229
+ })(ColorPresentation || (ColorPresentation = {}));
230
+ /**
231
+ * A set of predefined range kinds.
232
+ */
233
+ export var FoldingRangeKind;
234
+ (function (FoldingRangeKind) {
235
+ /**
236
+ * Folding range for a comment
237
+ */
238
+ FoldingRangeKind.Comment = 'comment';
239
+ /**
240
+ * Folding range for an import or include
241
+ */
242
+ FoldingRangeKind.Imports = 'imports';
243
+ /**
244
+ * Folding range for a region (e.g. `#region`)
245
+ */
246
+ FoldingRangeKind.Region = 'region';
247
+ })(FoldingRangeKind || (FoldingRangeKind = {}));
248
+ /**
249
+ * The folding range namespace provides helper functions to work with
250
+ * {@link FoldingRange} literals.
251
+ */
252
+ export var FoldingRange;
253
+ (function (FoldingRange) {
254
+ /**
255
+ * Creates a new FoldingRange literal.
256
+ */
257
+ function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {
258
+ const result = {
259
+ startLine,
260
+ endLine
261
+ };
262
+ if (Is.defined(startCharacter)) {
263
+ result.startCharacter = startCharacter;
264
+ }
265
+ if (Is.defined(endCharacter)) {
266
+ result.endCharacter = endCharacter;
267
+ }
268
+ if (Is.defined(kind)) {
269
+ result.kind = kind;
270
+ }
271
+ if (Is.defined(collapsedText)) {
272
+ result.collapsedText = collapsedText;
273
+ }
274
+ return result;
275
+ }
276
+ FoldingRange.create = create;
277
+ /**
278
+ * Checks whether the given literal conforms to the {@link FoldingRange} interface.
279
+ */
280
+ function is(value) {
281
+ const candidate = value;
282
+ return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
283
+ && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
284
+ && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
285
+ && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
286
+ }
287
+ FoldingRange.is = is;
288
+ })(FoldingRange || (FoldingRange = {}));
289
+ /**
290
+ * The DiagnosticRelatedInformation namespace provides helper functions to work with
291
+ * {@link DiagnosticRelatedInformation} literals.
292
+ */
293
+ export var DiagnosticRelatedInformation;
294
+ (function (DiagnosticRelatedInformation) {
295
+ /**
296
+ * Creates a new DiagnosticRelatedInformation literal.
297
+ */
298
+ function create(location, message) {
299
+ return {
300
+ location,
301
+ message
302
+ };
303
+ }
304
+ DiagnosticRelatedInformation.create = create;
305
+ /**
306
+ * Checks whether the given literal conforms to the {@link DiagnosticRelatedInformation} interface.
307
+ */
308
+ function is(value) {
309
+ const candidate = value;
310
+ return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
311
+ }
312
+ DiagnosticRelatedInformation.is = is;
313
+ })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
314
+ /**
315
+ * The diagnostic's severity.
316
+ */
317
+ export var DiagnosticSeverity;
318
+ (function (DiagnosticSeverity) {
319
+ /**
320
+ * Reports an error.
321
+ */
322
+ DiagnosticSeverity.Error = 1;
323
+ /**
324
+ * Reports a warning.
325
+ */
326
+ DiagnosticSeverity.Warning = 2;
327
+ /**
328
+ * Reports an information.
329
+ */
330
+ DiagnosticSeverity.Information = 3;
331
+ /**
332
+ * Reports a hint.
333
+ */
334
+ DiagnosticSeverity.Hint = 4;
335
+ })(DiagnosticSeverity || (DiagnosticSeverity = {}));
336
+ /**
337
+ * The diagnostic tags.
338
+ *
339
+ * @since 3.15.0
340
+ */
341
+ export var DiagnosticTag;
342
+ (function (DiagnosticTag) {
343
+ /**
344
+ * Unused or unnecessary code.
345
+ *
346
+ * Clients are allowed to render diagnostics with this tag faded out instead of having
347
+ * an error squiggle.
348
+ */
349
+ DiagnosticTag.Unnecessary = 1;
350
+ /**
351
+ * Deprecated or obsolete code.
352
+ *
353
+ * Clients are allowed to rendered diagnostics with this tag strike through.
354
+ */
355
+ DiagnosticTag.Deprecated = 2;
356
+ })(DiagnosticTag || (DiagnosticTag = {}));
357
+ /**
358
+ * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
359
+ *
360
+ * @since 3.16.0
361
+ */
362
+ export var CodeDescription;
363
+ (function (CodeDescription) {
364
+ function is(value) {
365
+ const candidate = value;
366
+ return Is.objectLiteral(candidate) && Is.string(candidate.href);
367
+ }
368
+ CodeDescription.is = is;
369
+ })(CodeDescription || (CodeDescription = {}));
370
+ /**
371
+ * The Diagnostic namespace provides helper functions to work with
372
+ * {@link Diagnostic} literals.
373
+ */
374
+ export var Diagnostic;
375
+ (function (Diagnostic) {
376
+ /**
377
+ * Creates a new Diagnostic literal.
378
+ */
379
+ function create(range, message, severity, code, source, relatedInformation) {
380
+ const result = { range, message };
381
+ if (Is.defined(severity)) {
382
+ result.severity = severity;
383
+ }
384
+ if (Is.defined(code)) {
385
+ result.code = code;
386
+ }
387
+ if (Is.defined(source)) {
388
+ result.source = source;
389
+ }
390
+ if (Is.defined(relatedInformation)) {
391
+ result.relatedInformation = relatedInformation;
392
+ }
393
+ return result;
394
+ }
395
+ Diagnostic.create = create;
396
+ /**
397
+ * Checks whether the given literal conforms to the {@link Diagnostic} interface.
398
+ */
399
+ function is(value) {
400
+ var _a;
401
+ const candidate = value;
402
+ return Is.defined(candidate)
403
+ && Range.is(candidate.range)
404
+ && (Is.string(candidate.message) || MarkupContent.is(candidate.message))
405
+ && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
406
+ && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
407
+ && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
408
+ && (Is.string(candidate.source) || Is.undefined(candidate.source))
409
+ && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
410
+ }
411
+ Diagnostic.is = is;
412
+ /**
413
+ * Checks whether the given diagnostic's message conforms to the 3.17.0
414
+ * version of the protocol where the message is a string.
415
+ *
416
+ * @param value the diagnostic
417
+ * @returns true if the diagnostic's message is a string, false otherwise.
418
+ */
419
+ function is3_17(value) {
420
+ return Is.string(value.message);
421
+ }
422
+ Diagnostic.is3_17 = is3_17;
423
+ /**
424
+ * Gets the message string of a diagnostic. If the message is already a
425
+ * string, it is returned as is. If the message is a MarkupContent,
426
+ * the value of the MarkupContent is returned. Otherwise an error is thrown.
427
+ *
428
+ * @param diagnostic the diagnostic to get the message string from.
429
+ * @returns the message string of the given diagnostic.
430
+ */
431
+ function getMessageString(diagnostic) {
432
+ if (Is.string(diagnostic.message)) {
433
+ return diagnostic.message;
434
+ }
435
+ else if (MarkupContent.is(diagnostic.message)) {
436
+ return diagnostic.message.value;
437
+ }
438
+ else {
439
+ throw new Error(`Unknown message type ${typeof diagnostic.message}`);
440
+ }
441
+ }
442
+ Diagnostic.getMessageString = getMessageString;
443
+ })(Diagnostic || (Diagnostic = {}));
444
+ /**
445
+ * The Command namespace provides helper functions to work with
446
+ * {@link Command} literals.
447
+ */
448
+ export var Command;
449
+ (function (Command) {
450
+ /**
451
+ * Creates a new Command literal.
452
+ */
453
+ function create(title, command, ...args) {
454
+ const result = { title, command };
455
+ if (Is.defined(args) && args.length > 0) {
456
+ result.arguments = args;
457
+ }
458
+ return result;
459
+ }
460
+ Command.create = create;
461
+ /**
462
+ * Checks whether the given literal conforms to the {@link Command} interface.
463
+ */
464
+ function is(value) {
465
+ const candidate = value;
466
+ return Is.defined(candidate) && Is.string(candidate.title) && (candidate.tooltip === undefined || Is.string(candidate.tooltip)) && Is.string(candidate.command);
467
+ }
468
+ Command.is = is;
469
+ })(Command || (Command = {}));
470
+ /**
471
+ * The TextEdit namespace provides helper function to create replace,
472
+ * insert and delete edits more easily.
473
+ */
474
+ export var TextEdit;
475
+ (function (TextEdit) {
476
+ /**
477
+ * Creates a replace text edit.
478
+ * @param range The range of text to be replaced.
479
+ * @param newText The new text.
480
+ */
481
+ function replace(range, newText) {
482
+ return { range, newText };
483
+ }
484
+ TextEdit.replace = replace;
485
+ /**
486
+ * Creates an insert text edit.
487
+ * @param position The position to insert the text at.
488
+ * @param newText The text to be inserted.
489
+ */
490
+ function insert(position, newText) {
491
+ return { range: { start: position, end: position }, newText };
492
+ }
493
+ TextEdit.insert = insert;
494
+ /**
495
+ * Creates a delete text edit.
496
+ * @param range The range of text to be deleted.
497
+ */
498
+ function del(range) {
499
+ return { range, newText: '' };
500
+ }
501
+ TextEdit.del = del;
502
+ function is(value) {
503
+ const candidate = value;
504
+ return Is.objectLiteral(candidate)
505
+ && Is.string(candidate.newText)
506
+ && Range.is(candidate.range);
507
+ }
508
+ TextEdit.is = is;
509
+ })(TextEdit || (TextEdit = {}));
510
+ export var ChangeAnnotation;
511
+ (function (ChangeAnnotation) {
512
+ function create(label, needsConfirmation, description) {
513
+ const result = { label };
514
+ if (needsConfirmation !== undefined) {
515
+ result.needsConfirmation = needsConfirmation;
516
+ }
517
+ if (description !== undefined) {
518
+ result.description = description;
519
+ }
520
+ return result;
521
+ }
522
+ ChangeAnnotation.create = create;
523
+ function is(value) {
524
+ const candidate = value;
525
+ return Is.objectLiteral(candidate) && Is.string(candidate.label) &&
526
+ (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
527
+ (Is.string(candidate.description) || candidate.description === undefined);
528
+ }
529
+ ChangeAnnotation.is = is;
530
+ })(ChangeAnnotation || (ChangeAnnotation = {}));
531
+ export var ChangeAnnotationIdentifier;
532
+ (function (ChangeAnnotationIdentifier) {
533
+ function is(value) {
534
+ const candidate = value;
535
+ return Is.string(candidate);
536
+ }
537
+ ChangeAnnotationIdentifier.is = is;
538
+ })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
539
+ export var AnnotatedTextEdit;
540
+ (function (AnnotatedTextEdit) {
541
+ /**
542
+ * Creates an annotated replace text edit.
543
+ *
544
+ * @param range The range of text to be replaced.
545
+ * @param newText The new text.
546
+ * @param annotation The annotation.
547
+ */
548
+ function replace(range, newText, annotation) {
549
+ return { range, newText, annotationId: annotation };
550
+ }
551
+ AnnotatedTextEdit.replace = replace;
552
+ /**
553
+ * Creates an annotated insert text edit.
554
+ *
555
+ * @param position The position to insert the text at.
556
+ * @param newText The text to be inserted.
557
+ * @param annotation The annotation.
558
+ */
559
+ function insert(position, newText, annotation) {
560
+ return { range: { start: position, end: position }, newText, annotationId: annotation };
561
+ }
562
+ AnnotatedTextEdit.insert = insert;
563
+ /**
564
+ * Creates an annotated delete text edit.
565
+ *
566
+ * @param range The range of text to be deleted.
567
+ * @param annotation The annotation.
568
+ */
569
+ function del(range, annotation) {
570
+ return { range, newText: '', annotationId: annotation };
571
+ }
572
+ AnnotatedTextEdit.del = del;
573
+ function is(value) {
574
+ const candidate = value;
575
+ return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
576
+ }
577
+ AnnotatedTextEdit.is = is;
578
+ })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
579
+ /**
580
+ * The TextDocumentEdit namespace provides helper function to create
581
+ * an edit that manipulates a text document.
582
+ */
583
+ export var TextDocumentEdit;
584
+ (function (TextDocumentEdit) {
585
+ /**
586
+ * Creates a new `TextDocumentEdit`
587
+ */
588
+ function create(textDocument, edits) {
589
+ return { textDocument, edits };
590
+ }
591
+ TextDocumentEdit.create = create;
592
+ function is(value) {
593
+ const candidate = value;
594
+ return Is.defined(candidate)
595
+ && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
596
+ && Array.isArray(candidate.edits);
597
+ }
598
+ TextDocumentEdit.is = is;
599
+ })(TextDocumentEdit || (TextDocumentEdit = {}));
600
+ export var CreateFile;
601
+ (function (CreateFile) {
602
+ function create(uri, options, annotation) {
603
+ const result = {
604
+ kind: 'create',
605
+ uri
606
+ };
607
+ if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
608
+ result.options = options;
609
+ }
610
+ if (annotation !== undefined) {
611
+ result.annotationId = annotation;
612
+ }
613
+ return result;
614
+ }
615
+ CreateFile.create = create;
616
+ function is(value) {
617
+ const candidate = value;
618
+ return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
619
+ ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
620
+ }
621
+ CreateFile.is = is;
622
+ })(CreateFile || (CreateFile = {}));
623
+ export var RenameFile;
624
+ (function (RenameFile) {
625
+ function create(oldUri, newUri, options, annotation) {
626
+ const result = {
627
+ kind: 'rename',
628
+ oldUri,
629
+ newUri
630
+ };
631
+ if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
632
+ result.options = options;
633
+ }
634
+ if (annotation !== undefined) {
635
+ result.annotationId = annotation;
636
+ }
637
+ return result;
638
+ }
639
+ RenameFile.create = create;
640
+ function is(value) {
641
+ const candidate = value;
642
+ return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
643
+ ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
644
+ }
645
+ RenameFile.is = is;
646
+ })(RenameFile || (RenameFile = {}));
647
+ export var DeleteFile;
648
+ (function (DeleteFile) {
649
+ function create(uri, options, annotation) {
650
+ const result = {
651
+ kind: 'delete',
652
+ uri
653
+ };
654
+ if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
655
+ result.options = options;
656
+ }
657
+ if (annotation !== undefined) {
658
+ result.annotationId = annotation;
659
+ }
660
+ return result;
661
+ }
662
+ DeleteFile.create = create;
663
+ function is(value) {
664
+ const candidate = value;
665
+ return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
666
+ ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
667
+ }
668
+ DeleteFile.is = is;
669
+ })(DeleteFile || (DeleteFile = {}));
670
+ export var WorkspaceEdit;
671
+ (function (WorkspaceEdit) {
672
+ function is(value) {
673
+ const candidate = value;
674
+ return candidate &&
675
+ (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
676
+ (candidate.documentChanges === undefined || candidate.documentChanges.every((change) => {
677
+ if (Is.string(change.kind)) {
678
+ return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
679
+ }
680
+ else {
681
+ return TextDocumentEdit.is(change);
682
+ }
683
+ }));
684
+ }
685
+ WorkspaceEdit.is = is;
686
+ })(WorkspaceEdit || (WorkspaceEdit = {}));
687
+ class TextEditChangeImpl {
688
+ constructor(edits, changeAnnotations) {
689
+ this.edits = edits;
690
+ this.changeAnnotations = changeAnnotations;
691
+ }
692
+ insert(position, newText, annotation) {
693
+ let edit;
694
+ let id;
695
+ if (annotation === undefined) {
696
+ edit = TextEdit.insert(position, newText);
697
+ }
698
+ else if (ChangeAnnotationIdentifier.is(annotation)) {
699
+ id = annotation;
700
+ edit = AnnotatedTextEdit.insert(position, newText, annotation);
701
+ }
702
+ else {
703
+ this.assertChangeAnnotations(this.changeAnnotations);
704
+ id = this.changeAnnotations.manage(annotation);
705
+ edit = AnnotatedTextEdit.insert(position, newText, id);
706
+ }
707
+ this.edits.push(edit);
708
+ if (id !== undefined) {
709
+ return id;
710
+ }
711
+ }
712
+ replace(range, newText, annotation) {
713
+ let edit;
714
+ let id;
715
+ if (annotation === undefined) {
716
+ edit = TextEdit.replace(range, newText);
717
+ }
718
+ else if (ChangeAnnotationIdentifier.is(annotation)) {
719
+ id = annotation;
720
+ edit = AnnotatedTextEdit.replace(range, newText, annotation);
721
+ }
722
+ else {
723
+ this.assertChangeAnnotations(this.changeAnnotations);
724
+ id = this.changeAnnotations.manage(annotation);
725
+ edit = AnnotatedTextEdit.replace(range, newText, id);
726
+ }
727
+ this.edits.push(edit);
728
+ if (id !== undefined) {
729
+ return id;
730
+ }
731
+ }
732
+ delete(range, annotation) {
733
+ let edit;
734
+ let id;
735
+ if (annotation === undefined) {
736
+ edit = TextEdit.del(range);
737
+ }
738
+ else if (ChangeAnnotationIdentifier.is(annotation)) {
739
+ id = annotation;
740
+ edit = AnnotatedTextEdit.del(range, annotation);
741
+ }
742
+ else {
743
+ this.assertChangeAnnotations(this.changeAnnotations);
744
+ id = this.changeAnnotations.manage(annotation);
745
+ edit = AnnotatedTextEdit.del(range, id);
746
+ }
747
+ this.edits.push(edit);
748
+ if (id !== undefined) {
749
+ return id;
750
+ }
751
+ }
752
+ add(edit) {
753
+ this.edits.push(edit);
754
+ }
755
+ all() {
756
+ return this.edits;
757
+ }
758
+ clear() {
759
+ this.edits.splice(0, this.edits.length);
760
+ }
761
+ assertChangeAnnotations(value) {
762
+ if (value === undefined) {
763
+ throw new Error(`Text edit change is not configured to manage change annotations.`);
764
+ }
765
+ }
766
+ }
767
+ export var SnippetTextEdit;
768
+ (function (SnippetTextEdit) {
769
+ function is(value) {
770
+ const candidate = value;
771
+ return Is.objectLiteral(candidate)
772
+ && Range.is(candidate.range)
773
+ && StringValue.isSnippet(candidate.snippet)
774
+ && (candidate.annotationId === undefined ||
775
+ (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)));
776
+ }
777
+ SnippetTextEdit.is = is;
778
+ })(SnippetTextEdit || (SnippetTextEdit = {}));
779
+ /**
780
+ * A helper class
781
+ */
782
+ class ChangeAnnotations {
783
+ constructor(annotations) {
784
+ this._annotations = annotations === undefined ? Object.create(null) : annotations;
785
+ this._counter = 0;
786
+ this._size = 0;
787
+ }
788
+ all() {
789
+ return this._annotations;
790
+ }
791
+ get size() {
792
+ return this._size;
793
+ }
794
+ manage(idOrAnnotation, annotation) {
795
+ let id;
796
+ if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
797
+ id = idOrAnnotation;
798
+ }
799
+ else {
800
+ id = this.nextId();
801
+ annotation = idOrAnnotation;
802
+ }
803
+ if (this._annotations[id] !== undefined) {
804
+ throw new Error(`Id ${id} is already in use.`);
805
+ }
806
+ if (annotation === undefined) {
807
+ throw new Error(`No annotation provided for id ${id}`);
808
+ }
809
+ this._annotations[id] = annotation;
810
+ this._size++;
811
+ return id;
812
+ }
813
+ nextId() {
814
+ this._counter++;
815
+ return this._counter.toString();
816
+ }
817
+ }
818
+ /**
819
+ * A workspace change helps constructing changes to a workspace.
820
+ */
821
+ export class WorkspaceChange {
822
+ constructor(workspaceEdit) {
823
+ this._textEditChanges = Object.create(null);
824
+ if (workspaceEdit !== undefined) {
825
+ this._workspaceEdit = workspaceEdit;
826
+ if (workspaceEdit.documentChanges) {
827
+ this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
828
+ workspaceEdit.changeAnnotations = this._changeAnnotations.all();
829
+ workspaceEdit.documentChanges.forEach((change) => {
830
+ if (TextDocumentEdit.is(change)) {
831
+ const textEditChange = new TextEditChangeImpl(change.edits, this._changeAnnotations);
832
+ this._textEditChanges[change.textDocument.uri] = textEditChange;
833
+ }
834
+ });
835
+ }
836
+ else if (workspaceEdit.changes) {
837
+ Object.keys(workspaceEdit.changes).forEach((key) => {
838
+ const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
839
+ this._textEditChanges[key] = textEditChange;
840
+ });
841
+ }
842
+ }
843
+ else {
844
+ this._workspaceEdit = {};
845
+ }
846
+ }
847
+ /**
848
+ * Returns the underlying {@link WorkspaceEdit} literal
849
+ * use to be returned from a workspace edit operation like rename.
850
+ */
851
+ get edit() {
852
+ this.initDocumentChanges();
853
+ if (this._changeAnnotations !== undefined) {
854
+ if (this._changeAnnotations.size === 0) {
855
+ this._workspaceEdit.changeAnnotations = undefined;
856
+ }
857
+ else {
858
+ this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
859
+ }
860
+ }
861
+ return this._workspaceEdit;
862
+ }
863
+ getTextEditChange(key) {
864
+ if (OptionalVersionedTextDocumentIdentifier.is(key)) {
865
+ this.initDocumentChanges();
866
+ if (this._workspaceEdit.documentChanges === undefined) {
867
+ throw new Error('Workspace edit is not configured for document changes.');
868
+ }
869
+ const textDocument = { uri: key.uri, version: key.version };
870
+ let result = this._textEditChanges[textDocument.uri];
871
+ if (!result) {
872
+ const edits = [];
873
+ const textDocumentEdit = {
874
+ textDocument,
875
+ edits
876
+ };
877
+ this._workspaceEdit.documentChanges.push(textDocumentEdit);
878
+ result = new TextEditChangeImpl(edits, this._changeAnnotations);
879
+ this._textEditChanges[textDocument.uri] = result;
880
+ }
881
+ return result;
882
+ }
883
+ else {
884
+ this.initChanges();
885
+ if (this._workspaceEdit.changes === undefined) {
886
+ throw new Error('Workspace edit is not configured for normal text edit changes.');
887
+ }
888
+ let result = this._textEditChanges[key];
889
+ if (!result) {
890
+ const edits = [];
891
+ this._workspaceEdit.changes[key] = edits;
892
+ result = new TextEditChangeImpl(edits);
893
+ this._textEditChanges[key] = result;
894
+ }
895
+ return result;
896
+ }
897
+ }
898
+ initDocumentChanges() {
899
+ if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
900
+ this._changeAnnotations = new ChangeAnnotations();
901
+ this._workspaceEdit.documentChanges = [];
902
+ this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
903
+ }
904
+ }
905
+ initChanges() {
906
+ if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
907
+ this._workspaceEdit.changes = Object.create(null);
908
+ }
909
+ }
910
+ createFile(uri, optionsOrAnnotation, options) {
911
+ this.initDocumentChanges();
912
+ if (this._workspaceEdit.documentChanges === undefined) {
913
+ throw new Error('Workspace edit is not configured for document changes.');
914
+ }
915
+ let annotation;
916
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
917
+ annotation = optionsOrAnnotation;
918
+ }
919
+ else {
920
+ options = optionsOrAnnotation;
921
+ }
922
+ let operation;
923
+ let id;
924
+ if (annotation === undefined) {
925
+ operation = CreateFile.create(uri, options);
926
+ }
927
+ else {
928
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
929
+ operation = CreateFile.create(uri, options, id);
930
+ }
931
+ this._workspaceEdit.documentChanges.push(operation);
932
+ if (id !== undefined) {
933
+ return id;
934
+ }
935
+ }
936
+ renameFile(oldUri, newUri, optionsOrAnnotation, options) {
937
+ this.initDocumentChanges();
938
+ if (this._workspaceEdit.documentChanges === undefined) {
939
+ throw new Error('Workspace edit is not configured for document changes.');
940
+ }
941
+ let annotation;
942
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
943
+ annotation = optionsOrAnnotation;
944
+ }
945
+ else {
946
+ options = optionsOrAnnotation;
947
+ }
948
+ let operation;
949
+ let id;
950
+ if (annotation === undefined) {
951
+ operation = RenameFile.create(oldUri, newUri, options);
952
+ }
953
+ else {
954
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
955
+ operation = RenameFile.create(oldUri, newUri, options, id);
956
+ }
957
+ this._workspaceEdit.documentChanges.push(operation);
958
+ if (id !== undefined) {
959
+ return id;
960
+ }
961
+ }
962
+ deleteFile(uri, optionsOrAnnotation, options) {
963
+ this.initDocumentChanges();
964
+ if (this._workspaceEdit.documentChanges === undefined) {
965
+ throw new Error('Workspace edit is not configured for document changes.');
966
+ }
967
+ let annotation;
968
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
969
+ annotation = optionsOrAnnotation;
970
+ }
971
+ else {
972
+ options = optionsOrAnnotation;
973
+ }
974
+ let operation;
975
+ let id;
976
+ if (annotation === undefined) {
977
+ operation = DeleteFile.create(uri, options);
978
+ }
979
+ else {
980
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
981
+ operation = DeleteFile.create(uri, options, id);
982
+ }
983
+ this._workspaceEdit.documentChanges.push(operation);
984
+ if (id !== undefined) {
985
+ return id;
986
+ }
987
+ }
988
+ }
989
+ /**
990
+ * The TextDocumentIdentifier namespace provides helper functions to work with
991
+ * {@link TextDocumentIdentifier} literals.
992
+ */
993
+ export var TextDocumentIdentifier;
994
+ (function (TextDocumentIdentifier) {
995
+ /**
996
+ * Creates a new TextDocumentIdentifier literal.
997
+ * @param uri The document's uri.
998
+ */
999
+ function create(uri) {
1000
+ return { uri };
1001
+ }
1002
+ TextDocumentIdentifier.create = create;
1003
+ /**
1004
+ * Checks whether the given literal conforms to the {@link TextDocumentIdentifier} interface.
1005
+ */
1006
+ function is(value) {
1007
+ const candidate = value;
1008
+ return Is.defined(candidate) && Is.string(candidate.uri);
1009
+ }
1010
+ TextDocumentIdentifier.is = is;
1011
+ })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
1012
+ /**
1013
+ * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
1014
+ * {@link VersionedTextDocumentIdentifier} literals.
1015
+ */
1016
+ export var VersionedTextDocumentIdentifier;
1017
+ (function (VersionedTextDocumentIdentifier) {
1018
+ /**
1019
+ * Creates a new VersionedTextDocumentIdentifier literal.
1020
+ * @param uri The document's uri.
1021
+ * @param version The document's version.
1022
+ */
1023
+ function create(uri, version) {
1024
+ return { uri, version };
1025
+ }
1026
+ VersionedTextDocumentIdentifier.create = create;
1027
+ /**
1028
+ * Checks whether the given literal conforms to the {@link VersionedTextDocumentIdentifier} interface.
1029
+ */
1030
+ function is(value) {
1031
+ const candidate = value;
1032
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
1033
+ }
1034
+ VersionedTextDocumentIdentifier.is = is;
1035
+ })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
1036
+ /**
1037
+ * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
1038
+ * {@link OptionalVersionedTextDocumentIdentifier} literals.
1039
+ */
1040
+ export var OptionalVersionedTextDocumentIdentifier;
1041
+ (function (OptionalVersionedTextDocumentIdentifier) {
1042
+ /**
1043
+ * Creates a new OptionalVersionedTextDocumentIdentifier literal.
1044
+ * @param uri The document's uri.
1045
+ * @param version The document's version.
1046
+ */
1047
+ function create(uri, version) {
1048
+ return { uri, version };
1049
+ }
1050
+ OptionalVersionedTextDocumentIdentifier.create = create;
1051
+ /**
1052
+ * Checks whether the given literal conforms to the {@link OptionalVersionedTextDocumentIdentifier} interface.
1053
+ */
1054
+ function is(value) {
1055
+ const candidate = value;
1056
+ return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
1057
+ }
1058
+ OptionalVersionedTextDocumentIdentifier.is = is;
1059
+ })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
1060
+ /**
1061
+ * Predefined Language kinds
1062
+ * @since 3.18.0
1063
+ */
1064
+ export var LanguageKind;
1065
+ (function (LanguageKind) {
1066
+ LanguageKind.ABAP = 'abap';
1067
+ LanguageKind.WindowsBat = 'bat';
1068
+ LanguageKind.BibTeX = 'bibtex';
1069
+ LanguageKind.Clojure = 'clojure';
1070
+ LanguageKind.Coffeescript = 'coffeescript';
1071
+ LanguageKind.C = 'c';
1072
+ LanguageKind.CPP = 'cpp';
1073
+ LanguageKind.CSharp = 'csharp';
1074
+ LanguageKind.CSS = 'css';
1075
+ /**
1076
+ * @since 3.18.0
1077
+ */
1078
+ LanguageKind.D = 'd';
1079
+ /**
1080
+ * @since 3.18.0
1081
+ */
1082
+ LanguageKind.Delphi = 'pascal';
1083
+ LanguageKind.Diff = 'diff';
1084
+ LanguageKind.Dart = 'dart';
1085
+ LanguageKind.Dockerfile = 'dockerfile';
1086
+ LanguageKind.Elixir = 'elixir';
1087
+ LanguageKind.Erlang = 'erlang';
1088
+ LanguageKind.FSharp = 'fsharp';
1089
+ LanguageKind.GitCommit = 'git-commit';
1090
+ LanguageKind.GitRebase = 'git-rebase';
1091
+ LanguageKind.Go = 'go';
1092
+ LanguageKind.Groovy = 'groovy';
1093
+ LanguageKind.Handlebars = 'handlebars';
1094
+ LanguageKind.Haskell = 'haskell';
1095
+ LanguageKind.HTML = 'html';
1096
+ LanguageKind.Ini = 'ini';
1097
+ LanguageKind.Java = 'java';
1098
+ LanguageKind.JavaScript = 'javascript';
1099
+ LanguageKind.JavaScriptReact = 'javascriptreact';
1100
+ LanguageKind.JSON = 'json';
1101
+ LanguageKind.LaTeX = 'latex';
1102
+ LanguageKind.Less = 'less';
1103
+ LanguageKind.Lua = 'lua';
1104
+ LanguageKind.Makefile = 'makefile';
1105
+ LanguageKind.Markdown = 'markdown';
1106
+ LanguageKind.ObjectiveC = 'objective-c';
1107
+ LanguageKind.ObjectiveCPP = 'objective-cpp';
1108
+ /**
1109
+ * @since 3.18.0
1110
+ */
1111
+ LanguageKind.Pascal = 'pascal';
1112
+ LanguageKind.Perl = 'perl';
1113
+ LanguageKind.Perl6 = 'perl6';
1114
+ LanguageKind.PHP = 'php';
1115
+ LanguageKind.Plaintext = 'plaintext';
1116
+ LanguageKind.Powershell = 'powershell';
1117
+ LanguageKind.Pug = 'jade';
1118
+ LanguageKind.Python = 'python';
1119
+ LanguageKind.R = 'r';
1120
+ LanguageKind.Razor = 'razor';
1121
+ LanguageKind.Ruby = 'ruby';
1122
+ LanguageKind.Rust = 'rust';
1123
+ LanguageKind.SCSS = 'scss';
1124
+ LanguageKind.SASS = 'sass';
1125
+ LanguageKind.Scala = 'scala';
1126
+ LanguageKind.ShaderLab = 'shaderlab';
1127
+ LanguageKind.ShellScript = 'shellscript';
1128
+ LanguageKind.SQL = 'sql';
1129
+ LanguageKind.Swift = 'swift';
1130
+ LanguageKind.TypeScript = 'typescript';
1131
+ LanguageKind.TypeScriptReact = 'typescriptreact';
1132
+ LanguageKind.TeX = 'tex';
1133
+ LanguageKind.VisualBasic = 'vb';
1134
+ LanguageKind.XML = 'xml';
1135
+ LanguageKind.XSL = 'xsl';
1136
+ LanguageKind.YAML = 'yaml';
1137
+ })(LanguageKind || (LanguageKind = {}));
1138
+ /**
1139
+ * The TextDocumentItem namespace provides helper functions to work with
1140
+ * {@link TextDocumentItem} literals.
1141
+ */
1142
+ export var TextDocumentItem;
1143
+ (function (TextDocumentItem) {
1144
+ /**
1145
+ * Creates a new TextDocumentItem literal.
1146
+ * @param uri The document's uri.
1147
+ * @param languageId The document's language identifier.
1148
+ * @param version The document's version number.
1149
+ * @param text The document's text.
1150
+ */
1151
+ function create(uri, languageId, version, text) {
1152
+ return { uri, languageId, version, text };
1153
+ }
1154
+ TextDocumentItem.create = create;
1155
+ /**
1156
+ * Checks whether the given literal conforms to the {@link TextDocumentItem} interface.
1157
+ */
1158
+ function is(value) {
1159
+ const candidate = value;
1160
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
1161
+ }
1162
+ TextDocumentItem.is = is;
1163
+ })(TextDocumentItem || (TextDocumentItem = {}));
1164
+ /**
1165
+ * Describes the content type that a client supports in various
1166
+ * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
1167
+ *
1168
+ * Please note that `MarkupKinds` must not start with a `$`. This kinds
1169
+ * are reserved for internal usage.
1170
+ */
1171
+ export var MarkupKind;
1172
+ (function (MarkupKind) {
1173
+ /**
1174
+ * Plain text is supported as a content format
1175
+ */
1176
+ MarkupKind.PlainText = 'plaintext';
1177
+ /**
1178
+ * Markdown is supported as a content format
1179
+ */
1180
+ MarkupKind.Markdown = 'markdown';
1181
+ /**
1182
+ * Checks whether the given value is a value of the {@link MarkupKind} type.
1183
+ */
1184
+ function is(value) {
1185
+ const candidate = value;
1186
+ return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
1187
+ }
1188
+ MarkupKind.is = is;
1189
+ })(MarkupKind || (MarkupKind = {}));
1190
+ export var MarkupContent;
1191
+ (function (MarkupContent) {
1192
+ /**
1193
+ * Checks whether the given value conforms to the {@link MarkupContent} interface.
1194
+ */
1195
+ function is(value) {
1196
+ const candidate = value;
1197
+ return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
1198
+ }
1199
+ MarkupContent.is = is;
1200
+ })(MarkupContent || (MarkupContent = {}));
1201
+ /**
1202
+ * The kind of a completion entry.
1203
+ */
1204
+ export var CompletionItemKind;
1205
+ (function (CompletionItemKind) {
1206
+ CompletionItemKind.Text = 1;
1207
+ CompletionItemKind.Method = 2;
1208
+ CompletionItemKind.Function = 3;
1209
+ CompletionItemKind.Constructor = 4;
1210
+ CompletionItemKind.Field = 5;
1211
+ CompletionItemKind.Variable = 6;
1212
+ CompletionItemKind.Class = 7;
1213
+ CompletionItemKind.Interface = 8;
1214
+ CompletionItemKind.Module = 9;
1215
+ CompletionItemKind.Property = 10;
1216
+ CompletionItemKind.Unit = 11;
1217
+ CompletionItemKind.Value = 12;
1218
+ CompletionItemKind.Enum = 13;
1219
+ CompletionItemKind.Keyword = 14;
1220
+ CompletionItemKind.Snippet = 15;
1221
+ CompletionItemKind.Color = 16;
1222
+ CompletionItemKind.File = 17;
1223
+ CompletionItemKind.Reference = 18;
1224
+ CompletionItemKind.Folder = 19;
1225
+ CompletionItemKind.EnumMember = 20;
1226
+ CompletionItemKind.Constant = 21;
1227
+ CompletionItemKind.Struct = 22;
1228
+ CompletionItemKind.Event = 23;
1229
+ CompletionItemKind.Operator = 24;
1230
+ CompletionItemKind.TypeParameter = 25;
1231
+ })(CompletionItemKind || (CompletionItemKind = {}));
1232
+ /**
1233
+ * Defines whether the insert text in a completion item should be interpreted as
1234
+ * plain text or a snippet.
1235
+ */
1236
+ export var InsertTextFormat;
1237
+ (function (InsertTextFormat) {
1238
+ /**
1239
+ * The primary text to be inserted is treated as a plain string.
1240
+ */
1241
+ InsertTextFormat.PlainText = 1;
1242
+ /**
1243
+ * The primary text to be inserted is treated as a snippet.
1244
+ *
1245
+ * A snippet can define tab stops and placeholders with `$1`, `$2`
1246
+ * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
1247
+ * the end of the snippet. Placeholders with equal identifiers are linked,
1248
+ * that is typing in one will update others too.
1249
+ *
1250
+ * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
1251
+ */
1252
+ InsertTextFormat.Snippet = 2;
1253
+ })(InsertTextFormat || (InsertTextFormat = {}));
1254
+ /**
1255
+ * Completion item tags are extra annotations that tweak the rendering of a completion
1256
+ * item.
1257
+ *
1258
+ * @since 3.15.0
1259
+ */
1260
+ export var CompletionItemTag;
1261
+ (function (CompletionItemTag) {
1262
+ /**
1263
+ * Render a completion as obsolete, usually using a strike-out.
1264
+ */
1265
+ CompletionItemTag.Deprecated = 1;
1266
+ })(CompletionItemTag || (CompletionItemTag = {}));
1267
+ /**
1268
+ * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
1269
+ *
1270
+ * @since 3.16.0
1271
+ */
1272
+ export var InsertReplaceEdit;
1273
+ (function (InsertReplaceEdit) {
1274
+ /**
1275
+ * Creates a new insert / replace edit
1276
+ */
1277
+ function create(newText, insert, replace) {
1278
+ return { newText, insert, replace };
1279
+ }
1280
+ InsertReplaceEdit.create = create;
1281
+ /**
1282
+ * Checks whether the given literal conforms to the {@link InsertReplaceEdit} interface.
1283
+ */
1284
+ function is(value) {
1285
+ const candidate = value;
1286
+ return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
1287
+ }
1288
+ InsertReplaceEdit.is = is;
1289
+ })(InsertReplaceEdit || (InsertReplaceEdit = {}));
1290
+ /**
1291
+ * How whitespace and indentation is handled during completion
1292
+ * item insertion.
1293
+ *
1294
+ * @since 3.16.0
1295
+ */
1296
+ export var InsertTextMode;
1297
+ (function (InsertTextMode) {
1298
+ /**
1299
+ * The insertion or replace strings is taken as it is. If the
1300
+ * value is multi line the lines below the cursor will be
1301
+ * inserted using the indentation defined in the string value.
1302
+ * The client will not apply any kind of adjustments to the
1303
+ * string.
1304
+ */
1305
+ InsertTextMode.asIs = 1;
1306
+ /**
1307
+ * The editor adjusts leading whitespace of new lines so that
1308
+ * they match the indentation up to the cursor of the line for
1309
+ * which the item is accepted.
1310
+ *
1311
+ * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
1312
+ * multi line completion item is indented using 2 tabs and all
1313
+ * following lines inserted will be indented using 2 tabs as well.
1314
+ */
1315
+ InsertTextMode.adjustIndentation = 2;
1316
+ })(InsertTextMode || (InsertTextMode = {}));
1317
+ /**
1318
+ * Defines how values from a set of defaults and an individual item will be
1319
+ * merged.
1320
+ *
1321
+ * @since 3.18.0
1322
+ */
1323
+ export var ApplyKind;
1324
+ (function (ApplyKind) {
1325
+ /**
1326
+ * The value from the individual item (if provided and not `null`) will be
1327
+ * used instead of the default.
1328
+ */
1329
+ ApplyKind.Replace = 1;
1330
+ /**
1331
+ * The value from the item will be merged with the default.
1332
+ *
1333
+ * The specific rules for mergeing values are defined against each field
1334
+ * that supports merging.
1335
+ */
1336
+ ApplyKind.Merge = 2;
1337
+ })(ApplyKind || (ApplyKind = {}));
1338
+ export var CompletionItemLabelDetails;
1339
+ (function (CompletionItemLabelDetails) {
1340
+ function is(value) {
1341
+ const candidate = value;
1342
+ return candidate && (Is.string(candidate.detail) || candidate.detail === undefined) &&
1343
+ (Is.string(candidate.description) || candidate.description === undefined);
1344
+ }
1345
+ CompletionItemLabelDetails.is = is;
1346
+ })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));
1347
+ /**
1348
+ * The CompletionItem namespace provides functions to deal with
1349
+ * completion items.
1350
+ */
1351
+ export var CompletionItem;
1352
+ (function (CompletionItem) {
1353
+ /**
1354
+ * Create a completion item and seed it with a label.
1355
+ * @param label The completion item's label
1356
+ */
1357
+ function create(label) {
1358
+ return { label };
1359
+ }
1360
+ CompletionItem.create = create;
1361
+ })(CompletionItem || (CompletionItem = {}));
1362
+ /**
1363
+ * The CompletionList namespace provides functions to deal with
1364
+ * completion lists.
1365
+ */
1366
+ export var CompletionList;
1367
+ (function (CompletionList) {
1368
+ /**
1369
+ * Creates a new completion list.
1370
+ *
1371
+ * @param items The completion items.
1372
+ * @param isIncomplete The list is not complete.
1373
+ */
1374
+ function create(items, isIncomplete) {
1375
+ return { items: items ? items : [], isIncomplete: !!isIncomplete };
1376
+ }
1377
+ CompletionList.create = create;
1378
+ })(CompletionList || (CompletionList = {}));
1379
+ export var MarkedString;
1380
+ (function (MarkedString) {
1381
+ /**
1382
+ * Creates a marked string from plain text.
1383
+ *
1384
+ * @param plainText The plain text.
1385
+ */
1386
+ function fromPlainText(plainText) {
1387
+ return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
1388
+ }
1389
+ MarkedString.fromPlainText = fromPlainText;
1390
+ /**
1391
+ * Checks whether the given value conforms to the {@link MarkedString} type.
1392
+ */
1393
+ function is(value) {
1394
+ const candidate = value;
1395
+ return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
1396
+ }
1397
+ MarkedString.is = is;
1398
+ })(MarkedString || (MarkedString = {}));
1399
+ export var Hover;
1400
+ (function (Hover) {
1401
+ /**
1402
+ * Checks whether the given value conforms to the {@link Hover} interface.
1403
+ */
1404
+ function is(value) {
1405
+ const candidate = value;
1406
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
1407
+ MarkedString.is(candidate.contents) ||
1408
+ Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
1409
+ }
1410
+ Hover.is = is;
1411
+ })(Hover || (Hover = {}));
1412
+ /**
1413
+ * The ParameterInformation namespace provides helper functions to work with
1414
+ * {@link ParameterInformation} literals.
1415
+ */
1416
+ export var ParameterInformation;
1417
+ (function (ParameterInformation) {
1418
+ /**
1419
+ * Creates a new parameter information literal.
1420
+ *
1421
+ * @param label A label string.
1422
+ * @param documentation A doc string.
1423
+ */
1424
+ function create(label, documentation) {
1425
+ return documentation ? { label, documentation } : { label };
1426
+ }
1427
+ ParameterInformation.create = create;
1428
+ })(ParameterInformation || (ParameterInformation = {}));
1429
+ /**
1430
+ * The SignatureInformation namespace provides helper functions to work with
1431
+ * {@link SignatureInformation} literals.
1432
+ */
1433
+ export var SignatureInformation;
1434
+ (function (SignatureInformation) {
1435
+ function create(label, documentation, ...parameters) {
1436
+ const result = { label };
1437
+ if (Is.defined(documentation)) {
1438
+ result.documentation = documentation;
1439
+ }
1440
+ if (Is.defined(parameters)) {
1441
+ result.parameters = parameters;
1442
+ }
1443
+ else {
1444
+ result.parameters = [];
1445
+ }
1446
+ return result;
1447
+ }
1448
+ SignatureInformation.create = create;
1449
+ })(SignatureInformation || (SignatureInformation = {}));
1450
+ /**
1451
+ * A document highlight kind.
1452
+ */
1453
+ export var DocumentHighlightKind;
1454
+ (function (DocumentHighlightKind) {
1455
+ /**
1456
+ * A textual occurrence.
1457
+ */
1458
+ DocumentHighlightKind.Text = 1;
1459
+ /**
1460
+ * Read-access of a symbol, like reading a variable.
1461
+ */
1462
+ DocumentHighlightKind.Read = 2;
1463
+ /**
1464
+ * Write-access of a symbol, like writing to a variable.
1465
+ */
1466
+ DocumentHighlightKind.Write = 3;
1467
+ })(DocumentHighlightKind || (DocumentHighlightKind = {}));
1468
+ /**
1469
+ * DocumentHighlight namespace to provide helper functions to work with
1470
+ * {@link DocumentHighlight} literals.
1471
+ */
1472
+ export var DocumentHighlight;
1473
+ (function (DocumentHighlight) {
1474
+ /**
1475
+ * Create a DocumentHighlight object.
1476
+ * @param range The range the highlight applies to.
1477
+ * @param kind The highlight kind
1478
+ */
1479
+ function create(range, kind) {
1480
+ const result = { range };
1481
+ if (Is.number(kind)) {
1482
+ result.kind = kind;
1483
+ }
1484
+ return result;
1485
+ }
1486
+ DocumentHighlight.create = create;
1487
+ })(DocumentHighlight || (DocumentHighlight = {}));
1488
+ /**
1489
+ * A symbol kind.
1490
+ */
1491
+ export var SymbolKind;
1492
+ (function (SymbolKind) {
1493
+ SymbolKind.File = 1;
1494
+ SymbolKind.Module = 2;
1495
+ SymbolKind.Namespace = 3;
1496
+ SymbolKind.Package = 4;
1497
+ SymbolKind.Class = 5;
1498
+ SymbolKind.Method = 6;
1499
+ SymbolKind.Property = 7;
1500
+ SymbolKind.Field = 8;
1501
+ SymbolKind.Constructor = 9;
1502
+ SymbolKind.Enum = 10;
1503
+ SymbolKind.Interface = 11;
1504
+ SymbolKind.Function = 12;
1505
+ SymbolKind.Variable = 13;
1506
+ SymbolKind.Constant = 14;
1507
+ SymbolKind.String = 15;
1508
+ SymbolKind.Number = 16;
1509
+ SymbolKind.Boolean = 17;
1510
+ SymbolKind.Array = 18;
1511
+ SymbolKind.Object = 19;
1512
+ SymbolKind.Key = 20;
1513
+ SymbolKind.Null = 21;
1514
+ SymbolKind.EnumMember = 22;
1515
+ SymbolKind.Struct = 23;
1516
+ SymbolKind.Event = 24;
1517
+ SymbolKind.Operator = 25;
1518
+ SymbolKind.TypeParameter = 26;
1519
+ })(SymbolKind || (SymbolKind = {}));
1520
+ /**
1521
+ * Symbol tags are extra annotations that tweak the rendering of a symbol.
1522
+ *
1523
+ * @since 3.16
1524
+ */
1525
+ export var SymbolTag;
1526
+ (function (SymbolTag) {
1527
+ /**
1528
+ * Render a symbol as obsolete, usually using a strike-out.
1529
+ */
1530
+ SymbolTag.Deprecated = 1;
1531
+ })(SymbolTag || (SymbolTag = {}));
1532
+ export var SymbolInformation;
1533
+ (function (SymbolInformation) {
1534
+ /**
1535
+ * Creates a new symbol information literal.
1536
+ *
1537
+ * @param name The name of the symbol.
1538
+ * @param kind The kind of the symbol.
1539
+ * @param range The range of the location of the symbol.
1540
+ * @param uri The resource of the location of symbol.
1541
+ * @param containerName The name of the symbol containing the symbol.
1542
+ */
1543
+ function create(name, kind, range, uri, containerName) {
1544
+ const result = {
1545
+ name,
1546
+ kind,
1547
+ location: { uri, range }
1548
+ };
1549
+ if (containerName) {
1550
+ result.containerName = containerName;
1551
+ }
1552
+ return result;
1553
+ }
1554
+ SymbolInformation.create = create;
1555
+ })(SymbolInformation || (SymbolInformation = {}));
1556
+ export var WorkspaceSymbol;
1557
+ (function (WorkspaceSymbol) {
1558
+ /**
1559
+ * Create a new workspace symbol.
1560
+ *
1561
+ * @param name The name of the symbol.
1562
+ * @param kind The kind of the symbol.
1563
+ * @param uri The resource of the location of the symbol.
1564
+ * @param range An options range of the location.
1565
+ * @returns A WorkspaceSymbol.
1566
+ */
1567
+ function create(name, kind, uri, range) {
1568
+ return range !== undefined
1569
+ ? { name, kind, location: { uri, range } }
1570
+ : { name, kind, location: { uri } };
1571
+ }
1572
+ WorkspaceSymbol.create = create;
1573
+ })(WorkspaceSymbol || (WorkspaceSymbol = {}));
1574
+ export var DocumentSymbol;
1575
+ (function (DocumentSymbol) {
1576
+ /**
1577
+ * Creates a new symbol information literal.
1578
+ *
1579
+ * @param name The name of the symbol.
1580
+ * @param detail The detail of the symbol.
1581
+ * @param kind The kind of the symbol.
1582
+ * @param range The range of the symbol.
1583
+ * @param selectionRange The selectionRange of the symbol.
1584
+ * @param children Children of the symbol.
1585
+ */
1586
+ function create(name, detail, kind, range, selectionRange, children) {
1587
+ const result = {
1588
+ name,
1589
+ detail,
1590
+ kind,
1591
+ range,
1592
+ selectionRange
1593
+ };
1594
+ if (children !== undefined) {
1595
+ result.children = children;
1596
+ }
1597
+ return result;
1598
+ }
1599
+ DocumentSymbol.create = create;
1600
+ /**
1601
+ * Checks whether the given literal conforms to the {@link DocumentSymbol} interface.
1602
+ */
1603
+ function is(value) {
1604
+ const candidate = value;
1605
+ return candidate &&
1606
+ Is.string(candidate.name) && Is.number(candidate.kind) &&
1607
+ Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
1608
+ (candidate.detail === undefined || Is.string(candidate.detail)) &&
1609
+ (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
1610
+ (candidate.children === undefined || Array.isArray(candidate.children)) &&
1611
+ (candidate.tags === undefined || Array.isArray(candidate.tags));
1612
+ }
1613
+ DocumentSymbol.is = is;
1614
+ })(DocumentSymbol || (DocumentSymbol = {}));
1615
+ /**
1616
+ * A set of predefined code action kinds
1617
+ */
1618
+ export var CodeActionKind;
1619
+ (function (CodeActionKind) {
1620
+ /**
1621
+ * Empty kind.
1622
+ */
1623
+ CodeActionKind.Empty = '';
1624
+ /**
1625
+ * Base kind for quickfix actions: 'quickfix'
1626
+ */
1627
+ CodeActionKind.QuickFix = 'quickfix';
1628
+ /**
1629
+ * Base kind for refactoring actions: 'refactor'
1630
+ */
1631
+ CodeActionKind.Refactor = 'refactor';
1632
+ /**
1633
+ * Base kind for refactoring extraction actions: 'refactor.extract'
1634
+ *
1635
+ * Example extract actions:
1636
+ *
1637
+ * - Extract method
1638
+ * - Extract function
1639
+ * - Extract variable
1640
+ * - Extract interface from class
1641
+ * - ...
1642
+ */
1643
+ CodeActionKind.RefactorExtract = 'refactor.extract';
1644
+ /**
1645
+ * Base kind for refactoring inline actions: 'refactor.inline'
1646
+ *
1647
+ * Example inline actions:
1648
+ *
1649
+ * - Inline function
1650
+ * - Inline variable
1651
+ * - Inline constant
1652
+ * - ...
1653
+ */
1654
+ CodeActionKind.RefactorInline = 'refactor.inline';
1655
+ /**
1656
+ * Base kind for refactoring move actions: `refactor.move`
1657
+ *
1658
+ * Example move actions:
1659
+ *
1660
+ * - Move a function to a new file
1661
+ * - Move a property between classes
1662
+ * - Move method to base class
1663
+ * - ...
1664
+ *
1665
+ * @since 3.18.0
1666
+ */
1667
+ CodeActionKind.RefactorMove = 'refactor.move';
1668
+ /**
1669
+ * Base kind for refactoring rewrite actions: 'refactor.rewrite'
1670
+ *
1671
+ * Example rewrite actions:
1672
+ *
1673
+ * - Convert JavaScript function to class
1674
+ * - Add or remove parameter
1675
+ * - Encapsulate field
1676
+ * - Make method static
1677
+ * - Move method to base class
1678
+ * - ...
1679
+ */
1680
+ CodeActionKind.RefactorRewrite = 'refactor.rewrite';
1681
+ /**
1682
+ * Base kind for source actions: `source`
1683
+ *
1684
+ * Source code actions apply to the entire file.
1685
+ */
1686
+ CodeActionKind.Source = 'source';
1687
+ /**
1688
+ * Base kind for an organize imports source action: `source.organizeImports`
1689
+ */
1690
+ CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
1691
+ /**
1692
+ * Base kind for auto-fix source actions: `source.fixAll`.
1693
+ *
1694
+ * Fix all actions automatically fix errors that have a clear fix that do not require user input.
1695
+ * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
1696
+ *
1697
+ * @since 3.15.0
1698
+ */
1699
+ CodeActionKind.SourceFixAll = 'source.fixAll';
1700
+ /**
1701
+ * Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using
1702
+ * this should always begin with `notebook.`
1703
+ *
1704
+ * @since 3.18.0
1705
+ */
1706
+ CodeActionKind.Notebook = 'notebook';
1707
+ })(CodeActionKind || (CodeActionKind = {}));
1708
+ /**
1709
+ * The reason why code actions were requested.
1710
+ *
1711
+ * @since 3.17.0
1712
+ */
1713
+ export var CodeActionTriggerKind;
1714
+ (function (CodeActionTriggerKind) {
1715
+ /**
1716
+ * Code actions were explicitly requested by the user or by an extension.
1717
+ */
1718
+ CodeActionTriggerKind.Invoked = 1;
1719
+ /**
1720
+ * Code actions were requested automatically.
1721
+ *
1722
+ * This typically happens when current selection in a file changes, but can
1723
+ * also be triggered when file content changes.
1724
+ */
1725
+ CodeActionTriggerKind.Automatic = 2;
1726
+ })(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
1727
+ /**
1728
+ * The CodeActionContext namespace provides helper functions to work with
1729
+ * {@link CodeActionContext} literals.
1730
+ */
1731
+ export var CodeActionContext;
1732
+ (function (CodeActionContext) {
1733
+ /**
1734
+ * Creates a new CodeActionContext literal.
1735
+ */
1736
+ function create(diagnostics, only, triggerKind) {
1737
+ const result = { diagnostics };
1738
+ if (only !== undefined && only !== null) {
1739
+ result.only = only;
1740
+ }
1741
+ if (triggerKind !== undefined && triggerKind !== null) {
1742
+ result.triggerKind = triggerKind;
1743
+ }
1744
+ return result;
1745
+ }
1746
+ CodeActionContext.create = create;
1747
+ /**
1748
+ * Checks whether the given literal conforms to the {@link CodeActionContext} interface.
1749
+ */
1750
+ function is(value) {
1751
+ const candidate = value;
1752
+ return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is)
1753
+ && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string))
1754
+ && (candidate.triggerKind === undefined || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);
1755
+ }
1756
+ CodeActionContext.is = is;
1757
+ })(CodeActionContext || (CodeActionContext = {}));
1758
+ /**
1759
+ * Code action tags are extra annotations that tweak the behavior of a code action.
1760
+ *
1761
+ * @since 3.18.0
1762
+ */
1763
+ export var CodeActionTag;
1764
+ (function (CodeActionTag) {
1765
+ /**
1766
+ * Marks the code action as LLM-generated.
1767
+ */
1768
+ CodeActionTag.LLMGenerated = 1;
1769
+ /**
1770
+ * Checks whether the given literal conforms to the {@link CodeActionTag} interface.
1771
+ */
1772
+ function is(value) {
1773
+ return Is.defined(value) && value === CodeActionTag.LLMGenerated;
1774
+ }
1775
+ CodeActionTag.is = is;
1776
+ })(CodeActionTag || (CodeActionTag = {}));
1777
+ export var CodeAction;
1778
+ (function (CodeAction) {
1779
+ function create(title, kindOrCommandOrEdit, kind) {
1780
+ const result = { title };
1781
+ let checkKind = true;
1782
+ if (typeof kindOrCommandOrEdit === 'string') {
1783
+ checkKind = false;
1784
+ result.kind = kindOrCommandOrEdit;
1785
+ }
1786
+ else if (Command.is(kindOrCommandOrEdit)) {
1787
+ result.command = kindOrCommandOrEdit;
1788
+ }
1789
+ else {
1790
+ result.edit = kindOrCommandOrEdit;
1791
+ }
1792
+ if (checkKind && kind !== undefined) {
1793
+ result.kind = kind;
1794
+ }
1795
+ return result;
1796
+ }
1797
+ CodeAction.create = create;
1798
+ function is(value) {
1799
+ const candidate = value;
1800
+ return candidate && Is.string(candidate.title) &&
1801
+ (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
1802
+ (candidate.kind === undefined || Is.string(candidate.kind)) &&
1803
+ (candidate.edit !== undefined || candidate.command !== undefined) &&
1804
+ (candidate.command === undefined || Command.is(candidate.command)) &&
1805
+ (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
1806
+ (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit)) &&
1807
+ (candidate.tags === undefined || Is.typedArray(candidate.tags, CodeActionTag.is));
1808
+ }
1809
+ CodeAction.is = is;
1810
+ })(CodeAction || (CodeAction = {}));
1811
+ /**
1812
+ * The CodeLens namespace provides helper functions to work with
1813
+ * {@link CodeLens} literals.
1814
+ */
1815
+ export var CodeLens;
1816
+ (function (CodeLens) {
1817
+ /**
1818
+ * Creates a new CodeLens literal.
1819
+ */
1820
+ function create(range, data) {
1821
+ const result = { range };
1822
+ if (Is.defined(data)) {
1823
+ result.data = data;
1824
+ }
1825
+ return result;
1826
+ }
1827
+ CodeLens.create = create;
1828
+ /**
1829
+ * Checks whether the given literal conforms to the {@link CodeLens} interface.
1830
+ */
1831
+ function is(value) {
1832
+ const candidate = value;
1833
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
1834
+ }
1835
+ CodeLens.is = is;
1836
+ })(CodeLens || (CodeLens = {}));
1837
+ /**
1838
+ * The FormattingOptions namespace provides helper functions to work with
1839
+ * {@link FormattingOptions} literals.
1840
+ */
1841
+ export var FormattingOptions;
1842
+ (function (FormattingOptions) {
1843
+ /**
1844
+ * Creates a new FormattingOptions literal.
1845
+ */
1846
+ function create(tabSize, insertSpaces) {
1847
+ return { tabSize, insertSpaces };
1848
+ }
1849
+ FormattingOptions.create = create;
1850
+ /**
1851
+ * Checks whether the given literal conforms to the {@link FormattingOptions} interface.
1852
+ */
1853
+ function is(value) {
1854
+ const candidate = value;
1855
+ return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
1856
+ }
1857
+ FormattingOptions.is = is;
1858
+ })(FormattingOptions || (FormattingOptions = {}));
1859
+ /**
1860
+ * The DocumentLink namespace provides helper functions to work with
1861
+ * {@link DocumentLink} literals.
1862
+ */
1863
+ export var DocumentLink;
1864
+ (function (DocumentLink) {
1865
+ /**
1866
+ * Creates a new DocumentLink literal.
1867
+ */
1868
+ function create(range, target, data) {
1869
+ return { range, target, data };
1870
+ }
1871
+ DocumentLink.create = create;
1872
+ /**
1873
+ * Checks whether the given literal conforms to the {@link DocumentLink} interface.
1874
+ */
1875
+ function is(value) {
1876
+ const candidate = value;
1877
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
1878
+ }
1879
+ DocumentLink.is = is;
1880
+ })(DocumentLink || (DocumentLink = {}));
1881
+ /**
1882
+ * The SelectionRange namespace provides helper function to work with
1883
+ * SelectionRange literals.
1884
+ */
1885
+ export var SelectionRange;
1886
+ (function (SelectionRange) {
1887
+ /**
1888
+ * Creates a new SelectionRange
1889
+ * @param range the range.
1890
+ * @param parent an optional parent.
1891
+ */
1892
+ function create(range, parent) {
1893
+ return { range, parent };
1894
+ }
1895
+ SelectionRange.create = create;
1896
+ function is(value) {
1897
+ const candidate = value;
1898
+ return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
1899
+ }
1900
+ SelectionRange.is = is;
1901
+ })(SelectionRange || (SelectionRange = {}));
1902
+ /**
1903
+ * A set of predefined token types. This set is not fixed
1904
+ * an clients can specify additional token types via the
1905
+ * corresponding client capabilities.
1906
+ *
1907
+ * @since 3.16.0
1908
+ */
1909
+ export var SemanticTokenTypes;
1910
+ (function (SemanticTokenTypes) {
1911
+ SemanticTokenTypes["namespace"] = "namespace";
1912
+ /**
1913
+ * Represents a generic type. Acts as a fallback for types which can't be mapped to
1914
+ * a specific type like class or enum.
1915
+ */
1916
+ SemanticTokenTypes["type"] = "type";
1917
+ SemanticTokenTypes["class"] = "class";
1918
+ SemanticTokenTypes["enum"] = "enum";
1919
+ SemanticTokenTypes["interface"] = "interface";
1920
+ SemanticTokenTypes["struct"] = "struct";
1921
+ SemanticTokenTypes["typeParameter"] = "typeParameter";
1922
+ SemanticTokenTypes["parameter"] = "parameter";
1923
+ SemanticTokenTypes["variable"] = "variable";
1924
+ SemanticTokenTypes["property"] = "property";
1925
+ SemanticTokenTypes["enumMember"] = "enumMember";
1926
+ SemanticTokenTypes["event"] = "event";
1927
+ SemanticTokenTypes["function"] = "function";
1928
+ SemanticTokenTypes["method"] = "method";
1929
+ SemanticTokenTypes["macro"] = "macro";
1930
+ SemanticTokenTypes["keyword"] = "keyword";
1931
+ SemanticTokenTypes["modifier"] = "modifier";
1932
+ SemanticTokenTypes["comment"] = "comment";
1933
+ SemanticTokenTypes["string"] = "string";
1934
+ SemanticTokenTypes["number"] = "number";
1935
+ SemanticTokenTypes["regexp"] = "regexp";
1936
+ SemanticTokenTypes["operator"] = "operator";
1937
+ /**
1938
+ * @since 3.17.0
1939
+ */
1940
+ SemanticTokenTypes["decorator"] = "decorator";
1941
+ /**
1942
+ * @since 3.18.0
1943
+ */
1944
+ SemanticTokenTypes["label"] = "label";
1945
+ })(SemanticTokenTypes || (SemanticTokenTypes = {}));
1946
+ /**
1947
+ * A set of predefined token modifiers. This set is not fixed
1948
+ * an clients can specify additional token types via the
1949
+ * corresponding client capabilities.
1950
+ *
1951
+ * @since 3.16.0
1952
+ */
1953
+ export var SemanticTokenModifiers;
1954
+ (function (SemanticTokenModifiers) {
1955
+ SemanticTokenModifiers["declaration"] = "declaration";
1956
+ SemanticTokenModifiers["definition"] = "definition";
1957
+ SemanticTokenModifiers["readonly"] = "readonly";
1958
+ SemanticTokenModifiers["static"] = "static";
1959
+ SemanticTokenModifiers["deprecated"] = "deprecated";
1960
+ SemanticTokenModifiers["abstract"] = "abstract";
1961
+ SemanticTokenModifiers["async"] = "async";
1962
+ SemanticTokenModifiers["modification"] = "modification";
1963
+ SemanticTokenModifiers["documentation"] = "documentation";
1964
+ SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
1965
+ })(SemanticTokenModifiers || (SemanticTokenModifiers = {}));
1966
+ /**
1967
+ * @since 3.16.0
1968
+ */
1969
+ export var SemanticTokens;
1970
+ (function (SemanticTokens) {
1971
+ function is(value) {
1972
+ const candidate = value;
1973
+ return Is.objectLiteral(candidate) && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
1974
+ Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
1975
+ }
1976
+ SemanticTokens.is = is;
1977
+ })(SemanticTokens || (SemanticTokens = {}));
1978
+ /**
1979
+ * The InlineValueText namespace provides functions to deal with InlineValueTexts.
1980
+ *
1981
+ * @since 3.17.0
1982
+ */
1983
+ export var InlineValueText;
1984
+ (function (InlineValueText) {
1985
+ /**
1986
+ * Creates a new InlineValueText literal.
1987
+ */
1988
+ function create(range, text) {
1989
+ return { range, text };
1990
+ }
1991
+ InlineValueText.create = create;
1992
+ function is(value) {
1993
+ const candidate = value;
1994
+ return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
1995
+ }
1996
+ InlineValueText.is = is;
1997
+ })(InlineValueText || (InlineValueText = {}));
1998
+ /**
1999
+ * The InlineValueVariableLookup namespace provides functions to
2000
+ * deal with InlineValueVariableLookups.
2001
+ *
2002
+ * @since 3.17.0
2003
+ */
2004
+ export var InlineValueVariableLookup;
2005
+ (function (InlineValueVariableLookup) {
2006
+ /**
2007
+ * Creates a new InlineValueText literal.
2008
+ */
2009
+ function create(range, variableName, caseSensitiveLookup) {
2010
+ return { range, variableName, caseSensitiveLookup };
2011
+ }
2012
+ InlineValueVariableLookup.create = create;
2013
+ function is(value) {
2014
+ const candidate = value;
2015
+ return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup)
2016
+ && (Is.string(candidate.variableName) || candidate.variableName === undefined);
2017
+ }
2018
+ InlineValueVariableLookup.is = is;
2019
+ })(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
2020
+ /**
2021
+ * The InlineValueEvaluatableExpression namespace provides functions to deal with InlineValueEvaluatableExpression.
2022
+ *
2023
+ * @since 3.17.0
2024
+ */
2025
+ export var InlineValueEvaluatableExpression;
2026
+ (function (InlineValueEvaluatableExpression) {
2027
+ /**
2028
+ * Creates a new InlineValueEvaluatableExpression literal.
2029
+ */
2030
+ function create(range, expression) {
2031
+ return { range, expression };
2032
+ }
2033
+ InlineValueEvaluatableExpression.create = create;
2034
+ function is(value) {
2035
+ const candidate = value;
2036
+ return candidate !== undefined && candidate !== null && Range.is(candidate.range)
2037
+ && (Is.string(candidate.expression) || candidate.expression === undefined);
2038
+ }
2039
+ InlineValueEvaluatableExpression.is = is;
2040
+ })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));
2041
+ /**
2042
+ * The InlineValueContext namespace provides helper functions to work with
2043
+ * {@link InlineValueContext} literals.
2044
+ *
2045
+ * @since 3.17.0
2046
+ */
2047
+ export var InlineValueContext;
2048
+ (function (InlineValueContext) {
2049
+ /**
2050
+ * Creates a new InlineValueContext literal.
2051
+ */
2052
+ function create(frameId, stoppedLocation) {
2053
+ return { frameId, stoppedLocation };
2054
+ }
2055
+ InlineValueContext.create = create;
2056
+ /**
2057
+ * Checks whether the given literal conforms to the {@link InlineValueContext} interface.
2058
+ */
2059
+ function is(value) {
2060
+ const candidate = value;
2061
+ return Is.defined(candidate) && Range.is(value.stoppedLocation);
2062
+ }
2063
+ InlineValueContext.is = is;
2064
+ })(InlineValueContext || (InlineValueContext = {}));
2065
+ /**
2066
+ * Inlay hint kinds.
2067
+ *
2068
+ * @since 3.17.0
2069
+ */
2070
+ export var InlayHintKind;
2071
+ (function (InlayHintKind) {
2072
+ /**
2073
+ * An inlay hint that for a type annotation.
2074
+ */
2075
+ InlayHintKind.Type = 1;
2076
+ /**
2077
+ * An inlay hint that is for a parameter.
2078
+ */
2079
+ InlayHintKind.Parameter = 2;
2080
+ function is(value) {
2081
+ return value === 1 || value === 2;
2082
+ }
2083
+ InlayHintKind.is = is;
2084
+ })(InlayHintKind || (InlayHintKind = {}));
2085
+ export var InlayHintLabelPart;
2086
+ (function (InlayHintLabelPart) {
2087
+ function create(value) {
2088
+ return { value };
2089
+ }
2090
+ InlayHintLabelPart.create = create;
2091
+ function is(value) {
2092
+ const candidate = value;
2093
+ return Is.objectLiteral(candidate)
2094
+ && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))
2095
+ && (candidate.location === undefined || Location.is(candidate.location))
2096
+ && (candidate.command === undefined || Command.is(candidate.command));
2097
+ }
2098
+ InlayHintLabelPart.is = is;
2099
+ })(InlayHintLabelPart || (InlayHintLabelPart = {}));
2100
+ export var InlayHint;
2101
+ (function (InlayHint) {
2102
+ function create(position, label, kind) {
2103
+ const result = { position, label };
2104
+ if (kind !== undefined) {
2105
+ result.kind = kind;
2106
+ }
2107
+ return result;
2108
+ }
2109
+ InlayHint.create = create;
2110
+ function is(value) {
2111
+ const candidate = value;
2112
+ return Is.objectLiteral(candidate) && Position.is(candidate.position)
2113
+ && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is))
2114
+ && (candidate.kind === undefined || InlayHintKind.is(candidate.kind))
2115
+ && (candidate.textEdits === undefined) || Is.typedArray(candidate.textEdits, TextEdit.is)
2116
+ && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))
2117
+ && (candidate.paddingLeft === undefined || Is.boolean(candidate.paddingLeft))
2118
+ && (candidate.paddingRight === undefined || Is.boolean(candidate.paddingRight));
2119
+ }
2120
+ InlayHint.is = is;
2121
+ })(InlayHint || (InlayHint = {}));
2122
+ export var StringValue;
2123
+ (function (StringValue) {
2124
+ function createSnippet(value) {
2125
+ return { kind: 'snippet', value };
2126
+ }
2127
+ StringValue.createSnippet = createSnippet;
2128
+ function isSnippet(value) {
2129
+ const candidate = value;
2130
+ return Is.objectLiteral(candidate)
2131
+ && candidate.kind === 'snippet'
2132
+ && Is.string(candidate.value);
2133
+ }
2134
+ StringValue.isSnippet = isSnippet;
2135
+ })(StringValue || (StringValue = {}));
2136
+ export var InlineCompletionItem;
2137
+ (function (InlineCompletionItem) {
2138
+ function create(insertText, filterText, range, command) {
2139
+ return { insertText, filterText, range, command };
2140
+ }
2141
+ InlineCompletionItem.create = create;
2142
+ })(InlineCompletionItem || (InlineCompletionItem = {}));
2143
+ export var InlineCompletionList;
2144
+ (function (InlineCompletionList) {
2145
+ function create(items) {
2146
+ return { items };
2147
+ }
2148
+ InlineCompletionList.create = create;
2149
+ })(InlineCompletionList || (InlineCompletionList = {}));
2150
+ /**
2151
+ * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
2152
+ *
2153
+ * @since 3.18.0
2154
+ */
2155
+ export var InlineCompletionTriggerKind;
2156
+ (function (InlineCompletionTriggerKind) {
2157
+ /**
2158
+ * Completion was triggered explicitly by a user gesture.
2159
+ */
2160
+ InlineCompletionTriggerKind.Invoked = 1;
2161
+ /**
2162
+ * Completion was triggered automatically while editing.
2163
+ */
2164
+ InlineCompletionTriggerKind.Automatic = 2;
2165
+ })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
2166
+ export var SelectedCompletionInfo;
2167
+ (function (SelectedCompletionInfo) {
2168
+ function create(range, text) {
2169
+ return { range, text };
2170
+ }
2171
+ SelectedCompletionInfo.create = create;
2172
+ })(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
2173
+ export var InlineCompletionContext;
2174
+ (function (InlineCompletionContext) {
2175
+ function create(triggerKind, selectedCompletionInfo) {
2176
+ return { triggerKind, selectedCompletionInfo };
2177
+ }
2178
+ InlineCompletionContext.create = create;
2179
+ })(InlineCompletionContext || (InlineCompletionContext = {}));
2180
+ export var WorkspaceFolder;
2181
+ (function (WorkspaceFolder) {
2182
+ function is(value) {
2183
+ const candidate = value;
2184
+ return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
2185
+ }
2186
+ WorkspaceFolder.is = is;
2187
+ })(WorkspaceFolder || (WorkspaceFolder = {}));
2188
+ export const EOL = ['\n', '\r\n', '\r'];
2189
+ /**
2190
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
2191
+ */
2192
+ export var TextDocument;
2193
+ (function (TextDocument) {
2194
+ /**
2195
+ * Creates a new ITextDocument literal from the given uri and content.
2196
+ * @param uri The document's uri.
2197
+ * @param languageId The document's language Id.
2198
+ * @param version The document's version.
2199
+ * @param content The document's content.
2200
+ */
2201
+ function create(uri, languageId, version, content) {
2202
+ return new FullTextDocument(uri, languageId, version, content);
2203
+ }
2204
+ TextDocument.create = create;
2205
+ /**
2206
+ * Checks whether the given literal conforms to the {@link ITextDocument} interface.
2207
+ */
2208
+ function is(value) {
2209
+ const candidate = value;
2210
+ return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
2211
+ && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
2212
+ }
2213
+ TextDocument.is = is;
2214
+ function applyEdits(document, edits) {
2215
+ let text = document.getText();
2216
+ const sortedEdits = mergeSort(edits, (a, b) => {
2217
+ const diff = a.range.start.line - b.range.start.line;
2218
+ if (diff === 0) {
2219
+ return a.range.start.character - b.range.start.character;
2220
+ }
2221
+ return diff;
2222
+ });
2223
+ let lastModifiedOffset = text.length;
2224
+ for (let i = sortedEdits.length - 1; i >= 0; i--) {
2225
+ const e = sortedEdits[i];
2226
+ const startOffset = document.offsetAt(e.range.start);
2227
+ const endOffset = document.offsetAt(e.range.end);
2228
+ if (endOffset <= lastModifiedOffset) {
2229
+ text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
2230
+ }
2231
+ else {
2232
+ throw new Error('Overlapping edit');
2233
+ }
2234
+ lastModifiedOffset = startOffset;
2235
+ }
2236
+ return text;
2237
+ }
2238
+ TextDocument.applyEdits = applyEdits;
2239
+ function mergeSort(data, compare) {
2240
+ if (data.length <= 1) {
2241
+ // sorted
2242
+ return data;
2243
+ }
2244
+ const p = (data.length / 2) | 0;
2245
+ const left = data.slice(0, p);
2246
+ const right = data.slice(p);
2247
+ mergeSort(left, compare);
2248
+ mergeSort(right, compare);
2249
+ let leftIdx = 0;
2250
+ let rightIdx = 0;
2251
+ let i = 0;
2252
+ while (leftIdx < left.length && rightIdx < right.length) {
2253
+ const ret = compare(left[leftIdx], right[rightIdx]);
2254
+ if (ret <= 0) {
2255
+ // smaller_equal -> take left to preserve order
2256
+ data[i++] = left[leftIdx++];
2257
+ }
2258
+ else {
2259
+ // greater -> take right
2260
+ data[i++] = right[rightIdx++];
2261
+ }
2262
+ }
2263
+ while (leftIdx < left.length) {
2264
+ data[i++] = left[leftIdx++];
2265
+ }
2266
+ while (rightIdx < right.length) {
2267
+ data[i++] = right[rightIdx++];
2268
+ }
2269
+ return data;
2270
+ }
2271
+ })(TextDocument || (TextDocument = {}));
2272
+ /**
2273
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
2274
+ */
2275
+ class FullTextDocument {
2276
+ constructor(uri, languageId, version, content) {
2277
+ this._uri = uri;
2278
+ this._languageId = languageId;
2279
+ this._version = version;
2280
+ this._content = content;
2281
+ this._lineOffsets = undefined;
2282
+ }
2283
+ get uri() {
2284
+ return this._uri;
2285
+ }
2286
+ get languageId() {
2287
+ return this._languageId;
2288
+ }
2289
+ get version() {
2290
+ return this._version;
2291
+ }
2292
+ getText(range) {
2293
+ if (range) {
2294
+ const start = this.offsetAt(range.start);
2295
+ const end = this.offsetAt(range.end);
2296
+ return this._content.substring(start, end);
2297
+ }
2298
+ return this._content;
2299
+ }
2300
+ update(event, version) {
2301
+ this._content = event.text;
2302
+ this._version = version;
2303
+ this._lineOffsets = undefined;
2304
+ }
2305
+ getLineOffsets() {
2306
+ if (this._lineOffsets === undefined) {
2307
+ const lineOffsets = [];
2308
+ const text = this._content;
2309
+ let isLineStart = true;
2310
+ for (let i = 0; i < text.length; i++) {
2311
+ if (isLineStart) {
2312
+ lineOffsets.push(i);
2313
+ isLineStart = false;
2314
+ }
2315
+ const ch = text.charAt(i);
2316
+ isLineStart = (ch === '\r' || ch === '\n');
2317
+ if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
2318
+ i++;
2319
+ }
2320
+ }
2321
+ if (isLineStart && text.length > 0) {
2322
+ lineOffsets.push(text.length);
2323
+ }
2324
+ this._lineOffsets = lineOffsets;
2325
+ }
2326
+ return this._lineOffsets;
2327
+ }
2328
+ positionAt(offset) {
2329
+ offset = Math.max(Math.min(offset, this._content.length), 0);
2330
+ const lineOffsets = this.getLineOffsets();
2331
+ let low = 0, high = lineOffsets.length;
2332
+ if (high === 0) {
2333
+ return Position.create(0, offset);
2334
+ }
2335
+ while (low < high) {
2336
+ const mid = Math.floor((low + high) / 2);
2337
+ if (lineOffsets[mid] > offset) {
2338
+ high = mid;
2339
+ }
2340
+ else {
2341
+ low = mid + 1;
2342
+ }
2343
+ }
2344
+ // low is the least x for which the line offset is larger than the current offset
2345
+ // or array.length if no line offset is larger than the current offset
2346
+ const line = low - 1;
2347
+ return Position.create(line, offset - lineOffsets[line]);
2348
+ }
2349
+ offsetAt(position) {
2350
+ const lineOffsets = this.getLineOffsets();
2351
+ if (position.line >= lineOffsets.length) {
2352
+ return this._content.length;
2353
+ }
2354
+ else if (position.line < 0) {
2355
+ return 0;
2356
+ }
2357
+ const lineOffset = lineOffsets[position.line];
2358
+ const nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
2359
+ return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
2360
+ }
2361
+ get lineCount() {
2362
+ return this.getLineOffsets().length;
2363
+ }
2364
+ }
2365
+ var Is;
2366
+ (function (Is) {
2367
+ const toString = Object.prototype.toString;
2368
+ function defined(value) {
2369
+ return typeof value !== 'undefined';
2370
+ }
2371
+ Is.defined = defined;
2372
+ function undefined(value) {
2373
+ return typeof value === 'undefined';
2374
+ }
2375
+ Is.undefined = undefined;
2376
+ function boolean(value) {
2377
+ return value === true || value === false;
2378
+ }
2379
+ Is.boolean = boolean;
2380
+ function string(value) {
2381
+ return toString.call(value) === '[object String]';
2382
+ }
2383
+ Is.string = string;
2384
+ function number(value) {
2385
+ return toString.call(value) === '[object Number]';
2386
+ }
2387
+ Is.number = number;
2388
+ function numberRange(value, min, max) {
2389
+ return toString.call(value) === '[object Number]' && min <= value && value <= max;
2390
+ }
2391
+ Is.numberRange = numberRange;
2392
+ function integer(value) {
2393
+ return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
2394
+ }
2395
+ Is.integer = integer;
2396
+ function uinteger(value) {
2397
+ return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
2398
+ }
2399
+ Is.uinteger = uinteger;
2400
+ function func(value) {
2401
+ return toString.call(value) === '[object Function]';
2402
+ }
2403
+ Is.func = func;
2404
+ function objectLiteral(value) {
2405
+ // Strictly speaking class instances pass this check as well. Since the LSP
2406
+ // doesn't use classes we ignore this for now. If we do we need to add something
2407
+ // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
2408
+ return value !== null && typeof value === 'object';
2409
+ }
2410
+ Is.objectLiteral = objectLiteral;
2411
+ function typedArray(value, check) {
2412
+ return Array.isArray(value) && value.every(check);
2413
+ }
2414
+ Is.typedArray = typedArray;
2415
+ })(Is || (Is = {}));