@kusto/monaco-kusto 5.6.6 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/package.json +26 -16
  2. package/release/dev/commandFormatter.d.ts +6 -0
  3. package/release/dev/commandHighlighter.d.ts +20 -0
  4. package/release/dev/extendedEditor.d.ts +7 -0
  5. package/release/dev/kustoMode.d.ts +8 -0
  6. package/release/dev/kustoMode.js +1730 -3278
  7. package/release/dev/kustoWorker.d.ts +92 -0
  8. package/release/dev/kustoWorker.js +5663 -8534
  9. package/release/dev/languageFeatures.d.ts +91 -0
  10. package/release/dev/languageService/kustoLanguageService.d.ts +142 -0
  11. package/release/dev/languageService/kustoMonarchLanguageDefinition.d.ts +1 -0
  12. package/release/dev/languageService/renderInfo.d.ts +31 -0
  13. package/release/dev/languageService/schema.d.ts +144 -0
  14. package/release/dev/languageService/settings.d.ts +30 -0
  15. package/release/dev/main-24a15f15.js +1958 -0
  16. package/release/dev/monaco.contribution.d.ts +15 -0
  17. package/release/dev/monaco.contribution.js +462 -309
  18. package/release/dev/workerManager.d.ts +23 -0
  19. package/release/esm/commandFormatter.d.ts +6 -0
  20. package/release/esm/commandHighlighter.d.ts +20 -0
  21. package/release/esm/extendedEditor.d.ts +7 -0
  22. package/release/esm/kusto.worker.js +2224 -5
  23. package/release/esm/kustoMode.d.ts +8 -0
  24. package/release/esm/kustoMode.js +1120 -88
  25. package/release/esm/kustoWorker.d.ts +92 -0
  26. package/release/esm/languageFeatures.d.ts +91 -0
  27. package/release/esm/languageService/kustoLanguageService.d.ts +142 -0
  28. package/release/esm/languageService/kustoMonarchLanguageDefinition.d.ts +1 -0
  29. package/release/esm/languageService/renderInfo.d.ts +31 -0
  30. package/release/esm/languageService/schema.d.ts +144 -0
  31. package/release/esm/languageService/settings.d.ts +30 -0
  32. package/release/esm/monaco.contribution.d.ts +1 -0
  33. package/release/esm/monaco.contribution.js +424 -181
  34. package/release/esm/workerManager.d.ts +23 -0
  35. package/release/min/commandFormatter.d.ts +6 -0
  36. package/release/min/commandHighlighter.d.ts +20 -0
  37. package/release/min/extendedEditor.d.ts +7 -0
  38. package/release/min/kustoMode.d.ts +8 -0
  39. package/release/min/kustoMode.js +2 -11
  40. package/release/min/kustoWorker.d.ts +92 -0
  41. package/release/min/kustoWorker.js +10 -53
  42. package/release/min/languageFeatures.d.ts +91 -0
  43. package/release/min/languageService/kustoLanguageService.d.ts +142 -0
  44. package/release/min/languageService/kustoMonarchLanguageDefinition.d.ts +1 -0
  45. package/release/min/languageService/renderInfo.d.ts +31 -0
  46. package/release/min/languageService/schema.d.ts +144 -0
  47. package/release/min/languageService/settings.d.ts +30 -0
  48. package/release/min/main-1108181b.js +7 -0
  49. package/release/min/monaco.contribution.d.ts +1 -0
  50. package/release/min/monaco.contribution.js +2 -2
  51. package/release/min/monaco.d.ts +1 -319
  52. package/release/min/workerManager.d.ts +23 -0
  53. package/release/esm/_deps/lodash/lodash.js +0 -17209
  54. package/release/esm/_deps/vscode-languageserver-types/main.js +0 -1908
  55. package/release/esm/_deps/xregexp/xregexp-all.js +0 -4652
  56. package/release/esm/commandFormatter.js +0 -36
  57. package/release/esm/commandHighlighter.js +0 -51
  58. package/release/esm/extendedEditor.js +0 -38
  59. package/release/esm/kustoWorker.js +0 -245
  60. package/release/esm/languageFeatures.js +0 -1032
  61. package/release/esm/languageService/kustoLanguageService.js +0 -1912
  62. package/release/esm/languageService/kustoMonarchLanguageDefinition.js +0 -127
  63. package/release/esm/languageService/schema.js +0 -64
  64. package/release/esm/workerManager.js +0 -102
  65. /package/release/{esm/monaco.d.ts → monaco.d.ts} +0 -0
@@ -0,0 +1,1958 @@
1
+ /*!-----------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * monaco-kusto version: 6.0.0(d333d5bf2aa3d56b17120ed36803a7fb5bcfb87a)
4
+ * Released under the MIT license
5
+ * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
+ *-----------------------------------------------------------------------------*/
7
+
8
+ define('vs/language/kusto/main-24a15f15', ['exports'], (function (exports) { 'use strict';
9
+
10
+ /* --------------------------------------------------------------------------------------------
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License. See License.txt in the project root for license information.
13
+ * ------------------------------------------------------------------------------------------ */
14
+
15
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
16
+ var integer;
17
+ (function (integer) {
18
+ integer.MIN_VALUE = -2147483648;
19
+ integer.MAX_VALUE = 2147483647;
20
+ })(integer || (integer = {}));
21
+ var uinteger;
22
+ (function (uinteger) {
23
+ uinteger.MIN_VALUE = 0;
24
+ uinteger.MAX_VALUE = 2147483647;
25
+ })(uinteger || (uinteger = {}));
26
+ /**
27
+ * The Position namespace provides helper functions to work with
28
+ * [Position](#Position) literals.
29
+ */
30
+ var Position;
31
+ (function (Position) {
32
+ /**
33
+ * Creates a new Position literal from the given line and character.
34
+ * @param line The position's line.
35
+ * @param character The position's character.
36
+ */
37
+ function create(line, character) {
38
+ if (line === Number.MAX_VALUE) {
39
+ line = uinteger.MAX_VALUE;
40
+ }
41
+ if (character === Number.MAX_VALUE) {
42
+ character = uinteger.MAX_VALUE;
43
+ }
44
+ return {
45
+ line: line,
46
+ character: character
47
+ };
48
+ }
49
+ Position.create = create;
50
+ /**
51
+ * Checks whether the given literal conforms to the [Position](#Position) interface.
52
+ */
53
+ function is(value) {
54
+ var candidate = value;
55
+ return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
56
+ }
57
+ Position.is = is;
58
+ })(Position || (Position = {}));
59
+ /**
60
+ * The Range namespace provides helper functions to work with
61
+ * [Range](#Range) literals.
62
+ */
63
+ exports.Range = void 0;
64
+ (function (Range) {
65
+ function create(one, two, three, four) {
66
+ if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
67
+ return {
68
+ start: Position.create(one, two),
69
+ end: Position.create(three, four)
70
+ };
71
+ } else if (Position.is(one) && Position.is(two)) {
72
+ return {
73
+ start: one,
74
+ end: two
75
+ };
76
+ } else {
77
+ throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
78
+ }
79
+ }
80
+ Range.create = create;
81
+ /**
82
+ * Checks whether the given literal conforms to the [Range](#Range) interface.
83
+ */
84
+ function is(value) {
85
+ var candidate = value;
86
+ return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
87
+ }
88
+ Range.is = is;
89
+ })(exports.Range || (exports.Range = {}));
90
+ /**
91
+ * The Location namespace provides helper functions to work with
92
+ * [Location](#Location) literals.
93
+ */
94
+ exports.Location = void 0;
95
+ (function (Location) {
96
+ /**
97
+ * Creates a Location literal.
98
+ * @param uri The location's uri.
99
+ * @param range The location's range.
100
+ */
101
+ function create(uri, range) {
102
+ return {
103
+ uri: uri,
104
+ range: range
105
+ };
106
+ }
107
+ Location.create = create;
108
+ /**
109
+ * Checks whether the given literal conforms to the [Location](#Location) interface.
110
+ */
111
+ function is(value) {
112
+ var candidate = value;
113
+ return Is.defined(candidate) && exports.Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
114
+ }
115
+ Location.is = is;
116
+ })(exports.Location || (exports.Location = {}));
117
+ /**
118
+ * The LocationLink namespace provides helper functions to work with
119
+ * [LocationLink](#LocationLink) literals.
120
+ */
121
+ var LocationLink;
122
+ (function (LocationLink) {
123
+ /**
124
+ * Creates a LocationLink literal.
125
+ * @param targetUri The definition's uri.
126
+ * @param targetRange The full range of the definition.
127
+ * @param targetSelectionRange The span of the symbol definition at the target.
128
+ * @param originSelectionRange The span of the symbol being defined in the originating source file.
129
+ */
130
+ function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
131
+ return {
132
+ targetUri: targetUri,
133
+ targetRange: targetRange,
134
+ targetSelectionRange: targetSelectionRange,
135
+ originSelectionRange: originSelectionRange
136
+ };
137
+ }
138
+ LocationLink.create = create;
139
+ /**
140
+ * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
141
+ */
142
+ function is(value) {
143
+ var candidate = value;
144
+ return Is.defined(candidate) && exports.Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && (exports.Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (exports.Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
145
+ }
146
+ LocationLink.is = is;
147
+ })(LocationLink || (LocationLink = {}));
148
+ /**
149
+ * The Color namespace provides helper functions to work with
150
+ * [Color](#Color) literals.
151
+ */
152
+ var Color;
153
+ (function (Color) {
154
+ /**
155
+ * Creates a new Color literal.
156
+ */
157
+ function create(red, green, blue, alpha) {
158
+ return {
159
+ red: red,
160
+ green: green,
161
+ blue: blue,
162
+ alpha: alpha
163
+ };
164
+ }
165
+ Color.create = create;
166
+ /**
167
+ * Checks whether the given literal conforms to the [Color](#Color) interface.
168
+ */
169
+ function is(value) {
170
+ var candidate = value;
171
+ return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
172
+ }
173
+ Color.is = is;
174
+ })(Color || (Color = {}));
175
+ /**
176
+ * The ColorInformation namespace provides helper functions to work with
177
+ * [ColorInformation](#ColorInformation) literals.
178
+ */
179
+ var ColorInformation;
180
+ (function (ColorInformation) {
181
+ /**
182
+ * Creates a new ColorInformation literal.
183
+ */
184
+ function create(range, color) {
185
+ return {
186
+ range: range,
187
+ color: color
188
+ };
189
+ }
190
+ ColorInformation.create = create;
191
+ /**
192
+ * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
193
+ */
194
+ function is(value) {
195
+ var candidate = value;
196
+ return exports.Range.is(candidate.range) && Color.is(candidate.color);
197
+ }
198
+ ColorInformation.is = is;
199
+ })(ColorInformation || (ColorInformation = {}));
200
+ /**
201
+ * The Color namespace provides helper functions to work with
202
+ * [ColorPresentation](#ColorPresentation) literals.
203
+ */
204
+ var ColorPresentation;
205
+ (function (ColorPresentation) {
206
+ /**
207
+ * Creates a new ColorInformation literal.
208
+ */
209
+ function create(label, textEdit, additionalTextEdits) {
210
+ return {
211
+ label: label,
212
+ textEdit: textEdit,
213
+ additionalTextEdits: additionalTextEdits
214
+ };
215
+ }
216
+ ColorPresentation.create = create;
217
+ /**
218
+ * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
219
+ */
220
+ function is(value) {
221
+ var candidate = value;
222
+ return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || exports.TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, exports.TextEdit.is));
223
+ }
224
+ ColorPresentation.is = is;
225
+ })(ColorPresentation || (ColorPresentation = {}));
226
+ /**
227
+ * Enum of known range kinds
228
+ */
229
+ var FoldingRangeKind;
230
+ (function (FoldingRangeKind) {
231
+ /**
232
+ * Folding range for a comment
233
+ */
234
+ FoldingRangeKind["Comment"] = "comment";
235
+ /**
236
+ * Folding range for a imports or includes
237
+ */
238
+ FoldingRangeKind["Imports"] = "imports";
239
+ /**
240
+ * Folding range for a region (e.g. `#region`)
241
+ */
242
+ FoldingRangeKind["Region"] = "region";
243
+ })(FoldingRangeKind || (FoldingRangeKind = {}));
244
+ /**
245
+ * The folding range namespace provides helper functions to work with
246
+ * [FoldingRange](#FoldingRange) literals.
247
+ */
248
+ var FoldingRange;
249
+ (function (FoldingRange) {
250
+ /**
251
+ * Creates a new FoldingRange literal.
252
+ */
253
+ function create(startLine, endLine, startCharacter, endCharacter, kind) {
254
+ var result = {
255
+ startLine: startLine,
256
+ endLine: endLine
257
+ };
258
+ if (Is.defined(startCharacter)) {
259
+ result.startCharacter = startCharacter;
260
+ }
261
+ if (Is.defined(endCharacter)) {
262
+ result.endCharacter = endCharacter;
263
+ }
264
+ if (Is.defined(kind)) {
265
+ result.kind = kind;
266
+ }
267
+ return result;
268
+ }
269
+ FoldingRange.create = create;
270
+ /**
271
+ * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
272
+ */
273
+ function is(value) {
274
+ var candidate = value;
275
+ return 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));
276
+ }
277
+ FoldingRange.is = is;
278
+ })(FoldingRange || (FoldingRange = {}));
279
+ /**
280
+ * The DiagnosticRelatedInformation namespace provides helper functions to work with
281
+ * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
282
+ */
283
+ var DiagnosticRelatedInformation;
284
+ (function (DiagnosticRelatedInformation) {
285
+ /**
286
+ * Creates a new DiagnosticRelatedInformation literal.
287
+ */
288
+ function create(location, message) {
289
+ return {
290
+ location: location,
291
+ message: message
292
+ };
293
+ }
294
+ DiagnosticRelatedInformation.create = create;
295
+ /**
296
+ * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
297
+ */
298
+ function is(value) {
299
+ var candidate = value;
300
+ return Is.defined(candidate) && exports.Location.is(candidate.location) && Is.string(candidate.message);
301
+ }
302
+ DiagnosticRelatedInformation.is = is;
303
+ })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
304
+ /**
305
+ * The diagnostic's severity.
306
+ */
307
+ exports.DiagnosticSeverity = void 0;
308
+ (function (DiagnosticSeverity) {
309
+ /**
310
+ * Reports an error.
311
+ */
312
+ DiagnosticSeverity.Error = 1;
313
+ /**
314
+ * Reports a warning.
315
+ */
316
+ DiagnosticSeverity.Warning = 2;
317
+ /**
318
+ * Reports an information.
319
+ */
320
+ DiagnosticSeverity.Information = 3;
321
+ /**
322
+ * Reports a hint.
323
+ */
324
+ DiagnosticSeverity.Hint = 4;
325
+ })(exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {}));
326
+ /**
327
+ * The diagnostic tags.
328
+ *
329
+ * @since 3.15.0
330
+ */
331
+ var DiagnosticTag;
332
+ (function (DiagnosticTag) {
333
+ /**
334
+ * Unused or unnecessary code.
335
+ *
336
+ * Clients are allowed to render diagnostics with this tag faded out instead of having
337
+ * an error squiggle.
338
+ */
339
+ DiagnosticTag.Unnecessary = 1;
340
+ /**
341
+ * Deprecated or obsolete code.
342
+ *
343
+ * Clients are allowed to rendered diagnostics with this tag strike through.
344
+ */
345
+ DiagnosticTag.Deprecated = 2;
346
+ })(DiagnosticTag || (DiagnosticTag = {}));
347
+ /**
348
+ * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
349
+ *
350
+ * @since 3.16.0
351
+ */
352
+ var CodeDescription;
353
+ (function (CodeDescription) {
354
+ function is(value) {
355
+ var candidate = value;
356
+ return candidate !== undefined && candidate !== null && Is.string(candidate.href);
357
+ }
358
+ CodeDescription.is = is;
359
+ })(CodeDescription || (CodeDescription = {}));
360
+ /**
361
+ * The Diagnostic namespace provides helper functions to work with
362
+ * [Diagnostic](#Diagnostic) literals.
363
+ */
364
+ exports.Diagnostic = void 0;
365
+ (function (Diagnostic) {
366
+ /**
367
+ * Creates a new Diagnostic literal.
368
+ */
369
+ function create(range, message, severity, code, source, relatedInformation) {
370
+ var result = {
371
+ range: range,
372
+ message: message
373
+ };
374
+ if (Is.defined(severity)) {
375
+ result.severity = severity;
376
+ }
377
+ if (Is.defined(code)) {
378
+ result.code = code;
379
+ }
380
+ if (Is.defined(source)) {
381
+ result.source = source;
382
+ }
383
+ if (Is.defined(relatedInformation)) {
384
+ result.relatedInformation = relatedInformation;
385
+ }
386
+ return result;
387
+ }
388
+ Diagnostic.create = create;
389
+ /**
390
+ * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
391
+ */
392
+ function is(value) {
393
+ var _a;
394
+ var candidate = value;
395
+ return Is.defined(candidate) && exports.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));
396
+ }
397
+ Diagnostic.is = is;
398
+ })(exports.Diagnostic || (exports.Diagnostic = {}));
399
+ /**
400
+ * The Command namespace provides helper functions to work with
401
+ * [Command](#Command) literals.
402
+ */
403
+ var Command;
404
+ (function (Command) {
405
+ /**
406
+ * Creates a new Command literal.
407
+ */
408
+ function create(title, command) {
409
+ var args = [];
410
+ for (var _i = 2; _i < arguments.length; _i++) {
411
+ args[_i - 2] = arguments[_i];
412
+ }
413
+ var result = {
414
+ title: title,
415
+ command: command
416
+ };
417
+ if (Is.defined(args) && args.length > 0) {
418
+ result.arguments = args;
419
+ }
420
+ return result;
421
+ }
422
+ Command.create = create;
423
+ /**
424
+ * Checks whether the given literal conforms to the [Command](#Command) interface.
425
+ */
426
+ function is(value) {
427
+ var candidate = value;
428
+ return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
429
+ }
430
+ Command.is = is;
431
+ })(Command || (Command = {}));
432
+ /**
433
+ * The TextEdit namespace provides helper function to create replace,
434
+ * insert and delete edits more easily.
435
+ */
436
+ exports.TextEdit = void 0;
437
+ (function (TextEdit) {
438
+ /**
439
+ * Creates a replace text edit.
440
+ * @param range The range of text to be replaced.
441
+ * @param newText The new text.
442
+ */
443
+ function replace(range, newText) {
444
+ return {
445
+ range: range,
446
+ newText: newText
447
+ };
448
+ }
449
+ TextEdit.replace = replace;
450
+ /**
451
+ * Creates a insert text edit.
452
+ * @param position The position to insert the text at.
453
+ * @param newText The text to be inserted.
454
+ */
455
+ function insert(position, newText) {
456
+ return {
457
+ range: {
458
+ start: position,
459
+ end: position
460
+ },
461
+ newText: newText
462
+ };
463
+ }
464
+ TextEdit.insert = insert;
465
+ /**
466
+ * Creates a delete text edit.
467
+ * @param range The range of text to be deleted.
468
+ */
469
+ function del(range) {
470
+ return {
471
+ range: range,
472
+ newText: ''
473
+ };
474
+ }
475
+ TextEdit.del = del;
476
+ function is(value) {
477
+ var candidate = value;
478
+ return Is.objectLiteral(candidate) && Is.string(candidate.newText) && exports.Range.is(candidate.range);
479
+ }
480
+ TextEdit.is = is;
481
+ })(exports.TextEdit || (exports.TextEdit = {}));
482
+ var ChangeAnnotation;
483
+ (function (ChangeAnnotation) {
484
+ function create(label, needsConfirmation, description) {
485
+ var result = {
486
+ label: label
487
+ };
488
+ if (needsConfirmation !== undefined) {
489
+ result.needsConfirmation = needsConfirmation;
490
+ }
491
+ if (description !== undefined) {
492
+ result.description = description;
493
+ }
494
+ return result;
495
+ }
496
+ ChangeAnnotation.create = create;
497
+ function is(value) {
498
+ var candidate = value;
499
+ return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) && (Is.string(candidate.description) || candidate.description === undefined);
500
+ }
501
+ ChangeAnnotation.is = is;
502
+ })(ChangeAnnotation || (ChangeAnnotation = {}));
503
+ var ChangeAnnotationIdentifier;
504
+ (function (ChangeAnnotationIdentifier) {
505
+ function is(value) {
506
+ var candidate = value;
507
+ return typeof candidate === 'string';
508
+ }
509
+ ChangeAnnotationIdentifier.is = is;
510
+ })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
511
+ var AnnotatedTextEdit;
512
+ (function (AnnotatedTextEdit) {
513
+ /**
514
+ * Creates an annotated replace text edit.
515
+ *
516
+ * @param range The range of text to be replaced.
517
+ * @param newText The new text.
518
+ * @param annotation The annotation.
519
+ */
520
+ function replace(range, newText, annotation) {
521
+ return {
522
+ range: range,
523
+ newText: newText,
524
+ annotationId: annotation
525
+ };
526
+ }
527
+ AnnotatedTextEdit.replace = replace;
528
+ /**
529
+ * Creates an annotated insert text edit.
530
+ *
531
+ * @param position The position to insert the text at.
532
+ * @param newText The text to be inserted.
533
+ * @param annotation The annotation.
534
+ */
535
+ function insert(position, newText, annotation) {
536
+ return {
537
+ range: {
538
+ start: position,
539
+ end: position
540
+ },
541
+ newText: newText,
542
+ annotationId: annotation
543
+ };
544
+ }
545
+ AnnotatedTextEdit.insert = insert;
546
+ /**
547
+ * Creates an annotated delete text edit.
548
+ *
549
+ * @param range The range of text to be deleted.
550
+ * @param annotation The annotation.
551
+ */
552
+ function del(range, annotation) {
553
+ return {
554
+ range: range,
555
+ newText: '',
556
+ annotationId: annotation
557
+ };
558
+ }
559
+ AnnotatedTextEdit.del = del;
560
+ function is(value) {
561
+ var candidate = value;
562
+ return exports.TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
563
+ }
564
+ AnnotatedTextEdit.is = is;
565
+ })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
566
+ /**
567
+ * The TextDocumentEdit namespace provides helper function to create
568
+ * an edit that manipulates a text document.
569
+ */
570
+ var TextDocumentEdit;
571
+ (function (TextDocumentEdit) {
572
+ /**
573
+ * Creates a new `TextDocumentEdit`
574
+ */
575
+ function create(textDocument, edits) {
576
+ return {
577
+ textDocument: textDocument,
578
+ edits: edits
579
+ };
580
+ }
581
+ TextDocumentEdit.create = create;
582
+ function is(value) {
583
+ var candidate = value;
584
+ return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
585
+ }
586
+ TextDocumentEdit.is = is;
587
+ })(TextDocumentEdit || (TextDocumentEdit = {}));
588
+ var CreateFile;
589
+ (function (CreateFile) {
590
+ function create(uri, options, annotation) {
591
+ var result = {
592
+ kind: 'create',
593
+ uri: uri
594
+ };
595
+ if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
596
+ result.options = options;
597
+ }
598
+ if (annotation !== undefined) {
599
+ result.annotationId = annotation;
600
+ }
601
+ return result;
602
+ }
603
+ CreateFile.create = create;
604
+ function is(value) {
605
+ var candidate = value;
606
+ return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined || (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));
607
+ }
608
+ CreateFile.is = is;
609
+ })(CreateFile || (CreateFile = {}));
610
+ var RenameFile;
611
+ (function (RenameFile) {
612
+ function create(oldUri, newUri, options, annotation) {
613
+ var result = {
614
+ kind: 'rename',
615
+ oldUri: oldUri,
616
+ newUri: newUri
617
+ };
618
+ if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
619
+ result.options = options;
620
+ }
621
+ if (annotation !== undefined) {
622
+ result.annotationId = annotation;
623
+ }
624
+ return result;
625
+ }
626
+ RenameFile.create = create;
627
+ function is(value) {
628
+ var candidate = value;
629
+ return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined || (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));
630
+ }
631
+ RenameFile.is = is;
632
+ })(RenameFile || (RenameFile = {}));
633
+ var DeleteFile;
634
+ (function (DeleteFile) {
635
+ function create(uri, options, annotation) {
636
+ var result = {
637
+ kind: 'delete',
638
+ uri: uri
639
+ };
640
+ if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
641
+ result.options = options;
642
+ }
643
+ if (annotation !== undefined) {
644
+ result.annotationId = annotation;
645
+ }
646
+ return result;
647
+ }
648
+ DeleteFile.create = create;
649
+ function is(value) {
650
+ var candidate = value;
651
+ return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined || (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));
652
+ }
653
+ DeleteFile.is = is;
654
+ })(DeleteFile || (DeleteFile = {}));
655
+ var WorkspaceEdit;
656
+ (function (WorkspaceEdit) {
657
+ function is(value) {
658
+ var candidate = value;
659
+ return candidate && (candidate.changes !== undefined || candidate.documentChanges !== undefined) && (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
660
+ if (Is.string(change.kind)) {
661
+ return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
662
+ } else {
663
+ return TextDocumentEdit.is(change);
664
+ }
665
+ }));
666
+ }
667
+ WorkspaceEdit.is = is;
668
+ })(WorkspaceEdit || (WorkspaceEdit = {}));
669
+ var TextEditChangeImpl = /** @class */function () {
670
+ function TextEditChangeImpl(edits, changeAnnotations) {
671
+ this.edits = edits;
672
+ this.changeAnnotations = changeAnnotations;
673
+ }
674
+ TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
675
+ var edit;
676
+ var id;
677
+ if (annotation === undefined) {
678
+ edit = exports.TextEdit.insert(position, newText);
679
+ } else if (ChangeAnnotationIdentifier.is(annotation)) {
680
+ id = annotation;
681
+ edit = AnnotatedTextEdit.insert(position, newText, annotation);
682
+ } else {
683
+ this.assertChangeAnnotations(this.changeAnnotations);
684
+ id = this.changeAnnotations.manage(annotation);
685
+ edit = AnnotatedTextEdit.insert(position, newText, id);
686
+ }
687
+ this.edits.push(edit);
688
+ if (id !== undefined) {
689
+ return id;
690
+ }
691
+ };
692
+ TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
693
+ var edit;
694
+ var id;
695
+ if (annotation === undefined) {
696
+ edit = exports.TextEdit.replace(range, newText);
697
+ } else if (ChangeAnnotationIdentifier.is(annotation)) {
698
+ id = annotation;
699
+ edit = AnnotatedTextEdit.replace(range, newText, annotation);
700
+ } else {
701
+ this.assertChangeAnnotations(this.changeAnnotations);
702
+ id = this.changeAnnotations.manage(annotation);
703
+ edit = AnnotatedTextEdit.replace(range, newText, id);
704
+ }
705
+ this.edits.push(edit);
706
+ if (id !== undefined) {
707
+ return id;
708
+ }
709
+ };
710
+ TextEditChangeImpl.prototype.delete = function (range, annotation) {
711
+ var edit;
712
+ var id;
713
+ if (annotation === undefined) {
714
+ edit = exports.TextEdit.del(range);
715
+ } else if (ChangeAnnotationIdentifier.is(annotation)) {
716
+ id = annotation;
717
+ edit = AnnotatedTextEdit.del(range, annotation);
718
+ } else {
719
+ this.assertChangeAnnotations(this.changeAnnotations);
720
+ id = this.changeAnnotations.manage(annotation);
721
+ edit = AnnotatedTextEdit.del(range, id);
722
+ }
723
+ this.edits.push(edit);
724
+ if (id !== undefined) {
725
+ return id;
726
+ }
727
+ };
728
+ TextEditChangeImpl.prototype.add = function (edit) {
729
+ this.edits.push(edit);
730
+ };
731
+ TextEditChangeImpl.prototype.all = function () {
732
+ return this.edits;
733
+ };
734
+ TextEditChangeImpl.prototype.clear = function () {
735
+ this.edits.splice(0, this.edits.length);
736
+ };
737
+ TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
738
+ if (value === undefined) {
739
+ throw new Error("Text edit change is not configured to manage change annotations.");
740
+ }
741
+ };
742
+ return TextEditChangeImpl;
743
+ }();
744
+ /**
745
+ * A helper class
746
+ */
747
+ var ChangeAnnotations = /** @class */function () {
748
+ function ChangeAnnotations(annotations) {
749
+ this._annotations = annotations === undefined ? Object.create(null) : annotations;
750
+ this._counter = 0;
751
+ this._size = 0;
752
+ }
753
+ ChangeAnnotations.prototype.all = function () {
754
+ return this._annotations;
755
+ };
756
+ Object.defineProperty(ChangeAnnotations.prototype, "size", {
757
+ get: function get() {
758
+ return this._size;
759
+ },
760
+ enumerable: false,
761
+ configurable: true
762
+ });
763
+ ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
764
+ var id;
765
+ if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
766
+ id = idOrAnnotation;
767
+ } else {
768
+ id = this.nextId();
769
+ annotation = idOrAnnotation;
770
+ }
771
+ if (this._annotations[id] !== undefined) {
772
+ throw new Error("Id " + id + " is already in use.");
773
+ }
774
+ if (annotation === undefined) {
775
+ throw new Error("No annotation provided for id " + id);
776
+ }
777
+ this._annotations[id] = annotation;
778
+ this._size++;
779
+ return id;
780
+ };
781
+ ChangeAnnotations.prototype.nextId = function () {
782
+ this._counter++;
783
+ return this._counter.toString();
784
+ };
785
+ return ChangeAnnotations;
786
+ }();
787
+ /**
788
+ * A workspace change helps constructing changes to a workspace.
789
+ */
790
+ /** @class */(function () {
791
+ function WorkspaceChange(workspaceEdit) {
792
+ var _this = this;
793
+ this._textEditChanges = Object.create(null);
794
+ if (workspaceEdit !== undefined) {
795
+ this._workspaceEdit = workspaceEdit;
796
+ if (workspaceEdit.documentChanges) {
797
+ this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
798
+ workspaceEdit.changeAnnotations = this._changeAnnotations.all();
799
+ workspaceEdit.documentChanges.forEach(function (change) {
800
+ if (TextDocumentEdit.is(change)) {
801
+ var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
802
+ _this._textEditChanges[change.textDocument.uri] = textEditChange;
803
+ }
804
+ });
805
+ } else if (workspaceEdit.changes) {
806
+ Object.keys(workspaceEdit.changes).forEach(function (key) {
807
+ var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
808
+ _this._textEditChanges[key] = textEditChange;
809
+ });
810
+ }
811
+ } else {
812
+ this._workspaceEdit = {};
813
+ }
814
+ }
815
+ Object.defineProperty(WorkspaceChange.prototype, "edit", {
816
+ /**
817
+ * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
818
+ * use to be returned from a workspace edit operation like rename.
819
+ */
820
+ get: function get() {
821
+ this.initDocumentChanges();
822
+ if (this._changeAnnotations !== undefined) {
823
+ if (this._changeAnnotations.size === 0) {
824
+ this._workspaceEdit.changeAnnotations = undefined;
825
+ } else {
826
+ this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
827
+ }
828
+ }
829
+ return this._workspaceEdit;
830
+ },
831
+ enumerable: false,
832
+ configurable: true
833
+ });
834
+ WorkspaceChange.prototype.getTextEditChange = function (key) {
835
+ if (OptionalVersionedTextDocumentIdentifier.is(key)) {
836
+ this.initDocumentChanges();
837
+ if (this._workspaceEdit.documentChanges === undefined) {
838
+ throw new Error('Workspace edit is not configured for document changes.');
839
+ }
840
+ var textDocument = {
841
+ uri: key.uri,
842
+ version: key.version
843
+ };
844
+ var result = this._textEditChanges[textDocument.uri];
845
+ if (!result) {
846
+ var edits = [];
847
+ var textDocumentEdit = {
848
+ textDocument: textDocument,
849
+ edits: edits
850
+ };
851
+ this._workspaceEdit.documentChanges.push(textDocumentEdit);
852
+ result = new TextEditChangeImpl(edits, this._changeAnnotations);
853
+ this._textEditChanges[textDocument.uri] = result;
854
+ }
855
+ return result;
856
+ } else {
857
+ this.initChanges();
858
+ if (this._workspaceEdit.changes === undefined) {
859
+ throw new Error('Workspace edit is not configured for normal text edit changes.');
860
+ }
861
+ var result = this._textEditChanges[key];
862
+ if (!result) {
863
+ var edits = [];
864
+ this._workspaceEdit.changes[key] = edits;
865
+ result = new TextEditChangeImpl(edits);
866
+ this._textEditChanges[key] = result;
867
+ }
868
+ return result;
869
+ }
870
+ };
871
+ WorkspaceChange.prototype.initDocumentChanges = function () {
872
+ if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
873
+ this._changeAnnotations = new ChangeAnnotations();
874
+ this._workspaceEdit.documentChanges = [];
875
+ this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
876
+ }
877
+ };
878
+ WorkspaceChange.prototype.initChanges = function () {
879
+ if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
880
+ this._workspaceEdit.changes = Object.create(null);
881
+ }
882
+ };
883
+ WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
884
+ this.initDocumentChanges();
885
+ if (this._workspaceEdit.documentChanges === undefined) {
886
+ throw new Error('Workspace edit is not configured for document changes.');
887
+ }
888
+ var annotation;
889
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
890
+ annotation = optionsOrAnnotation;
891
+ } else {
892
+ options = optionsOrAnnotation;
893
+ }
894
+ var operation;
895
+ var id;
896
+ if (annotation === undefined) {
897
+ operation = CreateFile.create(uri, options);
898
+ } else {
899
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
900
+ operation = CreateFile.create(uri, options, id);
901
+ }
902
+ this._workspaceEdit.documentChanges.push(operation);
903
+ if (id !== undefined) {
904
+ return id;
905
+ }
906
+ };
907
+ WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
908
+ this.initDocumentChanges();
909
+ if (this._workspaceEdit.documentChanges === undefined) {
910
+ throw new Error('Workspace edit is not configured for document changes.');
911
+ }
912
+ var annotation;
913
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
914
+ annotation = optionsOrAnnotation;
915
+ } else {
916
+ options = optionsOrAnnotation;
917
+ }
918
+ var operation;
919
+ var id;
920
+ if (annotation === undefined) {
921
+ operation = RenameFile.create(oldUri, newUri, options);
922
+ } else {
923
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
924
+ operation = RenameFile.create(oldUri, newUri, options, id);
925
+ }
926
+ this._workspaceEdit.documentChanges.push(operation);
927
+ if (id !== undefined) {
928
+ return id;
929
+ }
930
+ };
931
+ WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
932
+ this.initDocumentChanges();
933
+ if (this._workspaceEdit.documentChanges === undefined) {
934
+ throw new Error('Workspace edit is not configured for document changes.');
935
+ }
936
+ var annotation;
937
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
938
+ annotation = optionsOrAnnotation;
939
+ } else {
940
+ options = optionsOrAnnotation;
941
+ }
942
+ var operation;
943
+ var id;
944
+ if (annotation === undefined) {
945
+ operation = DeleteFile.create(uri, options);
946
+ } else {
947
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
948
+ operation = DeleteFile.create(uri, options, id);
949
+ }
950
+ this._workspaceEdit.documentChanges.push(operation);
951
+ if (id !== undefined) {
952
+ return id;
953
+ }
954
+ };
955
+ return WorkspaceChange;
956
+ })();
957
+ /**
958
+ * The TextDocumentIdentifier namespace provides helper functions to work with
959
+ * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
960
+ */
961
+ var TextDocumentIdentifier;
962
+ (function (TextDocumentIdentifier) {
963
+ /**
964
+ * Creates a new TextDocumentIdentifier literal.
965
+ * @param uri The document's uri.
966
+ */
967
+ function create(uri) {
968
+ return {
969
+ uri: uri
970
+ };
971
+ }
972
+ TextDocumentIdentifier.create = create;
973
+ /**
974
+ * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
975
+ */
976
+ function is(value) {
977
+ var candidate = value;
978
+ return Is.defined(candidate) && Is.string(candidate.uri);
979
+ }
980
+ TextDocumentIdentifier.is = is;
981
+ })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
982
+ /**
983
+ * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
984
+ * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
985
+ */
986
+ var VersionedTextDocumentIdentifier;
987
+ (function (VersionedTextDocumentIdentifier) {
988
+ /**
989
+ * Creates a new VersionedTextDocumentIdentifier literal.
990
+ * @param uri The document's uri.
991
+ * @param uri The document's text.
992
+ */
993
+ function create(uri, version) {
994
+ return {
995
+ uri: uri,
996
+ version: version
997
+ };
998
+ }
999
+ VersionedTextDocumentIdentifier.create = create;
1000
+ /**
1001
+ * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
1002
+ */
1003
+ function is(value) {
1004
+ var candidate = value;
1005
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
1006
+ }
1007
+ VersionedTextDocumentIdentifier.is = is;
1008
+ })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
1009
+ /**
1010
+ * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
1011
+ * [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
1012
+ */
1013
+ var OptionalVersionedTextDocumentIdentifier;
1014
+ (function (OptionalVersionedTextDocumentIdentifier) {
1015
+ /**
1016
+ * Creates a new OptionalVersionedTextDocumentIdentifier literal.
1017
+ * @param uri The document's uri.
1018
+ * @param uri The document's text.
1019
+ */
1020
+ function create(uri, version) {
1021
+ return {
1022
+ uri: uri,
1023
+ version: version
1024
+ };
1025
+ }
1026
+ OptionalVersionedTextDocumentIdentifier.create = create;
1027
+ /**
1028
+ * Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
1029
+ */
1030
+ function is(value) {
1031
+ var candidate = value;
1032
+ return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
1033
+ }
1034
+ OptionalVersionedTextDocumentIdentifier.is = is;
1035
+ })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
1036
+ /**
1037
+ * The TextDocumentItem namespace provides helper functions to work with
1038
+ * [TextDocumentItem](#TextDocumentItem) literals.
1039
+ */
1040
+ var TextDocumentItem;
1041
+ (function (TextDocumentItem) {
1042
+ /**
1043
+ * Creates a new TextDocumentItem literal.
1044
+ * @param uri The document's uri.
1045
+ * @param languageId The document's language identifier.
1046
+ * @param version The document's version number.
1047
+ * @param text The document's text.
1048
+ */
1049
+ function create(uri, languageId, version, text) {
1050
+ return {
1051
+ uri: uri,
1052
+ languageId: languageId,
1053
+ version: version,
1054
+ text: text
1055
+ };
1056
+ }
1057
+ TextDocumentItem.create = create;
1058
+ /**
1059
+ * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
1060
+ */
1061
+ function is(value) {
1062
+ var candidate = value;
1063
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
1064
+ }
1065
+ TextDocumentItem.is = is;
1066
+ })(TextDocumentItem || (TextDocumentItem = {}));
1067
+ /**
1068
+ * Describes the content type that a client supports in various
1069
+ * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
1070
+ *
1071
+ * Please note that `MarkupKinds` must not start with a `$`. This kinds
1072
+ * are reserved for internal usage.
1073
+ */
1074
+ exports.MarkupKind = void 0;
1075
+ (function (MarkupKind) {
1076
+ /**
1077
+ * Plain text is supported as a content format
1078
+ */
1079
+ MarkupKind.PlainText = 'plaintext';
1080
+ /**
1081
+ * Markdown is supported as a content format
1082
+ */
1083
+ MarkupKind.Markdown = 'markdown';
1084
+ })(exports.MarkupKind || (exports.MarkupKind = {}));
1085
+ (function (MarkupKind) {
1086
+ /**
1087
+ * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
1088
+ */
1089
+ function is(value) {
1090
+ var candidate = value;
1091
+ return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
1092
+ }
1093
+ MarkupKind.is = is;
1094
+ })(exports.MarkupKind || (exports.MarkupKind = {}));
1095
+ var MarkupContent;
1096
+ (function (MarkupContent) {
1097
+ /**
1098
+ * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
1099
+ */
1100
+ function is(value) {
1101
+ var candidate = value;
1102
+ return Is.objectLiteral(value) && exports.MarkupKind.is(candidate.kind) && Is.string(candidate.value);
1103
+ }
1104
+ MarkupContent.is = is;
1105
+ })(MarkupContent || (MarkupContent = {}));
1106
+ /**
1107
+ * The kind of a completion entry.
1108
+ */
1109
+ exports.CompletionItemKind = void 0;
1110
+ (function (CompletionItemKind) {
1111
+ CompletionItemKind.Text = 1;
1112
+ CompletionItemKind.Method = 2;
1113
+ CompletionItemKind.Function = 3;
1114
+ CompletionItemKind.Constructor = 4;
1115
+ CompletionItemKind.Field = 5;
1116
+ CompletionItemKind.Variable = 6;
1117
+ CompletionItemKind.Class = 7;
1118
+ CompletionItemKind.Interface = 8;
1119
+ CompletionItemKind.Module = 9;
1120
+ CompletionItemKind.Property = 10;
1121
+ CompletionItemKind.Unit = 11;
1122
+ CompletionItemKind.Value = 12;
1123
+ CompletionItemKind.Enum = 13;
1124
+ CompletionItemKind.Keyword = 14;
1125
+ CompletionItemKind.Snippet = 15;
1126
+ CompletionItemKind.Color = 16;
1127
+ CompletionItemKind.File = 17;
1128
+ CompletionItemKind.Reference = 18;
1129
+ CompletionItemKind.Folder = 19;
1130
+ CompletionItemKind.EnumMember = 20;
1131
+ CompletionItemKind.Constant = 21;
1132
+ CompletionItemKind.Struct = 22;
1133
+ CompletionItemKind.Event = 23;
1134
+ CompletionItemKind.Operator = 24;
1135
+ CompletionItemKind.TypeParameter = 25;
1136
+ })(exports.CompletionItemKind || (exports.CompletionItemKind = {}));
1137
+ /**
1138
+ * Defines whether the insert text in a completion item should be interpreted as
1139
+ * plain text or a snippet.
1140
+ */
1141
+ exports.InsertTextFormat = void 0;
1142
+ (function (InsertTextFormat) {
1143
+ /**
1144
+ * The primary text to be inserted is treated as a plain string.
1145
+ */
1146
+ InsertTextFormat.PlainText = 1;
1147
+ /**
1148
+ * The primary text to be inserted is treated as a snippet.
1149
+ *
1150
+ * A snippet can define tab stops and placeholders with `$1`, `$2`
1151
+ * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
1152
+ * the end of the snippet. Placeholders with equal identifiers are linked,
1153
+ * that is typing in one will update others too.
1154
+ *
1155
+ * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
1156
+ */
1157
+ InsertTextFormat.Snippet = 2;
1158
+ })(exports.InsertTextFormat || (exports.InsertTextFormat = {}));
1159
+ /**
1160
+ * Completion item tags are extra annotations that tweak the rendering of a completion
1161
+ * item.
1162
+ *
1163
+ * @since 3.15.0
1164
+ */
1165
+ var CompletionItemTag;
1166
+ (function (CompletionItemTag) {
1167
+ /**
1168
+ * Render a completion as obsolete, usually using a strike-out.
1169
+ */
1170
+ CompletionItemTag.Deprecated = 1;
1171
+ })(CompletionItemTag || (CompletionItemTag = {}));
1172
+ /**
1173
+ * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
1174
+ *
1175
+ * @since 3.16.0
1176
+ */
1177
+ var InsertReplaceEdit;
1178
+ (function (InsertReplaceEdit) {
1179
+ /**
1180
+ * Creates a new insert / replace edit
1181
+ */
1182
+ function create(newText, insert, replace) {
1183
+ return {
1184
+ newText: newText,
1185
+ insert: insert,
1186
+ replace: replace
1187
+ };
1188
+ }
1189
+ InsertReplaceEdit.create = create;
1190
+ /**
1191
+ * Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
1192
+ */
1193
+ function is(value) {
1194
+ var candidate = value;
1195
+ return candidate && Is.string(candidate.newText) && exports.Range.is(candidate.insert) && exports.Range.is(candidate.replace);
1196
+ }
1197
+ InsertReplaceEdit.is = is;
1198
+ })(InsertReplaceEdit || (InsertReplaceEdit = {}));
1199
+ /**
1200
+ * How whitespace and indentation is handled during completion
1201
+ * item insertion.
1202
+ *
1203
+ * @since 3.16.0
1204
+ */
1205
+ var InsertTextMode;
1206
+ (function (InsertTextMode) {
1207
+ /**
1208
+ * The insertion or replace strings is taken as it is. If the
1209
+ * value is multi line the lines below the cursor will be
1210
+ * inserted using the indentation defined in the string value.
1211
+ * The client will not apply any kind of adjustments to the
1212
+ * string.
1213
+ */
1214
+ InsertTextMode.asIs = 1;
1215
+ /**
1216
+ * The editor adjusts leading whitespace of new lines so that
1217
+ * they match the indentation up to the cursor of the line for
1218
+ * which the item is accepted.
1219
+ *
1220
+ * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
1221
+ * multi line completion item is indented using 2 tabs and all
1222
+ * following lines inserted will be indented using 2 tabs as well.
1223
+ */
1224
+ InsertTextMode.adjustIndentation = 2;
1225
+ })(InsertTextMode || (InsertTextMode = {}));
1226
+ /**
1227
+ * The CompletionItem namespace provides functions to deal with
1228
+ * completion items.
1229
+ */
1230
+ exports.CompletionItem = void 0;
1231
+ (function (CompletionItem) {
1232
+ /**
1233
+ * Create a completion item and seed it with a label.
1234
+ * @param label The completion item's label
1235
+ */
1236
+ function create(label) {
1237
+ return {
1238
+ label: label
1239
+ };
1240
+ }
1241
+ CompletionItem.create = create;
1242
+ })(exports.CompletionItem || (exports.CompletionItem = {}));
1243
+ /**
1244
+ * The CompletionList namespace provides functions to deal with
1245
+ * completion lists.
1246
+ */
1247
+ exports.CompletionList = void 0;
1248
+ (function (CompletionList) {
1249
+ /**
1250
+ * Creates a new completion list.
1251
+ *
1252
+ * @param items The completion items.
1253
+ * @param isIncomplete The list is not complete.
1254
+ */
1255
+ function create(items, isIncomplete) {
1256
+ return {
1257
+ items: items ? items : [],
1258
+ isIncomplete: !!isIncomplete
1259
+ };
1260
+ }
1261
+ CompletionList.create = create;
1262
+ })(exports.CompletionList || (exports.CompletionList = {}));
1263
+ var MarkedString;
1264
+ (function (MarkedString) {
1265
+ /**
1266
+ * Creates a marked string from plain text.
1267
+ *
1268
+ * @param plainText The plain text.
1269
+ */
1270
+ function fromPlainText(plainText) {
1271
+ return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
1272
+ }
1273
+
1274
+ MarkedString.fromPlainText = fromPlainText;
1275
+ /**
1276
+ * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
1277
+ */
1278
+ function is(value) {
1279
+ var candidate = value;
1280
+ return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
1281
+ }
1282
+ MarkedString.is = is;
1283
+ })(MarkedString || (MarkedString = {}));
1284
+ var Hover;
1285
+ (function (Hover) {
1286
+ /**
1287
+ * Checks whether the given value conforms to the [Hover](#Hover) interface.
1288
+ */
1289
+ function is(value) {
1290
+ var candidate = value;
1291
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || exports.Range.is(value.range));
1292
+ }
1293
+ Hover.is = is;
1294
+ })(Hover || (Hover = {}));
1295
+ /**
1296
+ * The ParameterInformation namespace provides helper functions to work with
1297
+ * [ParameterInformation](#ParameterInformation) literals.
1298
+ */
1299
+ var ParameterInformation;
1300
+ (function (ParameterInformation) {
1301
+ /**
1302
+ * Creates a new parameter information literal.
1303
+ *
1304
+ * @param label A label string.
1305
+ * @param documentation A doc string.
1306
+ */
1307
+ function create(label, documentation) {
1308
+ return documentation ? {
1309
+ label: label,
1310
+ documentation: documentation
1311
+ } : {
1312
+ label: label
1313
+ };
1314
+ }
1315
+ ParameterInformation.create = create;
1316
+ })(ParameterInformation || (ParameterInformation = {}));
1317
+ /**
1318
+ * The SignatureInformation namespace provides helper functions to work with
1319
+ * [SignatureInformation](#SignatureInformation) literals.
1320
+ */
1321
+ var SignatureInformation;
1322
+ (function (SignatureInformation) {
1323
+ function create(label, documentation) {
1324
+ var parameters = [];
1325
+ for (var _i = 2; _i < arguments.length; _i++) {
1326
+ parameters[_i - 2] = arguments[_i];
1327
+ }
1328
+ var result = {
1329
+ label: label
1330
+ };
1331
+ if (Is.defined(documentation)) {
1332
+ result.documentation = documentation;
1333
+ }
1334
+ if (Is.defined(parameters)) {
1335
+ result.parameters = parameters;
1336
+ } else {
1337
+ result.parameters = [];
1338
+ }
1339
+ return result;
1340
+ }
1341
+ SignatureInformation.create = create;
1342
+ })(SignatureInformation || (SignatureInformation = {}));
1343
+ /**
1344
+ * A document highlight kind.
1345
+ */
1346
+ var DocumentHighlightKind;
1347
+ (function (DocumentHighlightKind) {
1348
+ /**
1349
+ * A textual occurrence.
1350
+ */
1351
+ DocumentHighlightKind.Text = 1;
1352
+ /**
1353
+ * Read-access of a symbol, like reading a variable.
1354
+ */
1355
+ DocumentHighlightKind.Read = 2;
1356
+ /**
1357
+ * Write-access of a symbol, like writing to a variable.
1358
+ */
1359
+ DocumentHighlightKind.Write = 3;
1360
+ })(DocumentHighlightKind || (DocumentHighlightKind = {}));
1361
+ /**
1362
+ * DocumentHighlight namespace to provide helper functions to work with
1363
+ * [DocumentHighlight](#DocumentHighlight) literals.
1364
+ */
1365
+ var DocumentHighlight;
1366
+ (function (DocumentHighlight) {
1367
+ /**
1368
+ * Create a DocumentHighlight object.
1369
+ * @param range The range the highlight applies to.
1370
+ */
1371
+ function create(range, kind) {
1372
+ var result = {
1373
+ range: range
1374
+ };
1375
+ if (Is.number(kind)) {
1376
+ result.kind = kind;
1377
+ }
1378
+ return result;
1379
+ }
1380
+ DocumentHighlight.create = create;
1381
+ })(DocumentHighlight || (DocumentHighlight = {}));
1382
+ /**
1383
+ * A symbol kind.
1384
+ */
1385
+ var SymbolKind;
1386
+ (function (SymbolKind) {
1387
+ SymbolKind.File = 1;
1388
+ SymbolKind.Module = 2;
1389
+ SymbolKind.Namespace = 3;
1390
+ SymbolKind.Package = 4;
1391
+ SymbolKind.Class = 5;
1392
+ SymbolKind.Method = 6;
1393
+ SymbolKind.Property = 7;
1394
+ SymbolKind.Field = 8;
1395
+ SymbolKind.Constructor = 9;
1396
+ SymbolKind.Enum = 10;
1397
+ SymbolKind.Interface = 11;
1398
+ SymbolKind.Function = 12;
1399
+ SymbolKind.Variable = 13;
1400
+ SymbolKind.Constant = 14;
1401
+ SymbolKind.String = 15;
1402
+ SymbolKind.Number = 16;
1403
+ SymbolKind.Boolean = 17;
1404
+ SymbolKind.Array = 18;
1405
+ SymbolKind.Object = 19;
1406
+ SymbolKind.Key = 20;
1407
+ SymbolKind.Null = 21;
1408
+ SymbolKind.EnumMember = 22;
1409
+ SymbolKind.Struct = 23;
1410
+ SymbolKind.Event = 24;
1411
+ SymbolKind.Operator = 25;
1412
+ SymbolKind.TypeParameter = 26;
1413
+ })(SymbolKind || (SymbolKind = {}));
1414
+ /**
1415
+ * Symbol tags are extra annotations that tweak the rendering of a symbol.
1416
+ * @since 3.16
1417
+ */
1418
+ var SymbolTag;
1419
+ (function (SymbolTag) {
1420
+ /**
1421
+ * Render a symbol as obsolete, usually using a strike-out.
1422
+ */
1423
+ SymbolTag.Deprecated = 1;
1424
+ })(SymbolTag || (SymbolTag = {}));
1425
+ var SymbolInformation;
1426
+ (function (SymbolInformation) {
1427
+ /**
1428
+ * Creates a new symbol information literal.
1429
+ *
1430
+ * @param name The name of the symbol.
1431
+ * @param kind The kind of the symbol.
1432
+ * @param range The range of the location of the symbol.
1433
+ * @param uri The resource of the location of symbol, defaults to the current document.
1434
+ * @param containerName The name of the symbol containing the symbol.
1435
+ */
1436
+ function create(name, kind, range, uri, containerName) {
1437
+ var result = {
1438
+ name: name,
1439
+ kind: kind,
1440
+ location: {
1441
+ uri: uri,
1442
+ range: range
1443
+ }
1444
+ };
1445
+ if (containerName) {
1446
+ result.containerName = containerName;
1447
+ }
1448
+ return result;
1449
+ }
1450
+ SymbolInformation.create = create;
1451
+ })(SymbolInformation || (SymbolInformation = {}));
1452
+ var DocumentSymbol;
1453
+ (function (DocumentSymbol) {
1454
+ /**
1455
+ * Creates a new symbol information literal.
1456
+ *
1457
+ * @param name The name of the symbol.
1458
+ * @param detail The detail of the symbol.
1459
+ * @param kind The kind of the symbol.
1460
+ * @param range The range of the symbol.
1461
+ * @param selectionRange The selectionRange of the symbol.
1462
+ * @param children Children of the symbol.
1463
+ */
1464
+ function create(name, detail, kind, range, selectionRange, children) {
1465
+ var result = {
1466
+ name: name,
1467
+ detail: detail,
1468
+ kind: kind,
1469
+ range: range,
1470
+ selectionRange: selectionRange
1471
+ };
1472
+ if (children !== undefined) {
1473
+ result.children = children;
1474
+ }
1475
+ return result;
1476
+ }
1477
+ DocumentSymbol.create = create;
1478
+ /**
1479
+ * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
1480
+ */
1481
+ function is(value) {
1482
+ var candidate = value;
1483
+ return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && exports.Range.is(candidate.range) && exports.Range.is(candidate.selectionRange) && (candidate.detail === undefined || Is.string(candidate.detail)) && (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) && (candidate.children === undefined || Array.isArray(candidate.children)) && (candidate.tags === undefined || Array.isArray(candidate.tags));
1484
+ }
1485
+ DocumentSymbol.is = is;
1486
+ })(DocumentSymbol || (DocumentSymbol = {}));
1487
+ /**
1488
+ * A set of predefined code action kinds
1489
+ */
1490
+ var CodeActionKind;
1491
+ (function (CodeActionKind) {
1492
+ /**
1493
+ * Empty kind.
1494
+ */
1495
+ CodeActionKind.Empty = '';
1496
+ /**
1497
+ * Base kind for quickfix actions: 'quickfix'
1498
+ */
1499
+ CodeActionKind.QuickFix = 'quickfix';
1500
+ /**
1501
+ * Base kind for refactoring actions: 'refactor'
1502
+ */
1503
+ CodeActionKind.Refactor = 'refactor';
1504
+ /**
1505
+ * Base kind for refactoring extraction actions: 'refactor.extract'
1506
+ *
1507
+ * Example extract actions:
1508
+ *
1509
+ * - Extract method
1510
+ * - Extract function
1511
+ * - Extract variable
1512
+ * - Extract interface from class
1513
+ * - ...
1514
+ */
1515
+ CodeActionKind.RefactorExtract = 'refactor.extract';
1516
+ /**
1517
+ * Base kind for refactoring inline actions: 'refactor.inline'
1518
+ *
1519
+ * Example inline actions:
1520
+ *
1521
+ * - Inline function
1522
+ * - Inline variable
1523
+ * - Inline constant
1524
+ * - ...
1525
+ */
1526
+ CodeActionKind.RefactorInline = 'refactor.inline';
1527
+ /**
1528
+ * Base kind for refactoring rewrite actions: 'refactor.rewrite'
1529
+ *
1530
+ * Example rewrite actions:
1531
+ *
1532
+ * - Convert JavaScript function to class
1533
+ * - Add or remove parameter
1534
+ * - Encapsulate field
1535
+ * - Make method static
1536
+ * - Move method to base class
1537
+ * - ...
1538
+ */
1539
+ CodeActionKind.RefactorRewrite = 'refactor.rewrite';
1540
+ /**
1541
+ * Base kind for source actions: `source`
1542
+ *
1543
+ * Source code actions apply to the entire file.
1544
+ */
1545
+ CodeActionKind.Source = 'source';
1546
+ /**
1547
+ * Base kind for an organize imports source action: `source.organizeImports`
1548
+ */
1549
+ CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
1550
+ /**
1551
+ * Base kind for auto-fix source actions: `source.fixAll`.
1552
+ *
1553
+ * Fix all actions automatically fix errors that have a clear fix that do not require user input.
1554
+ * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
1555
+ *
1556
+ * @since 3.15.0
1557
+ */
1558
+ CodeActionKind.SourceFixAll = 'source.fixAll';
1559
+ })(CodeActionKind || (CodeActionKind = {}));
1560
+ /**
1561
+ * The CodeActionContext namespace provides helper functions to work with
1562
+ * [CodeActionContext](#CodeActionContext) literals.
1563
+ */
1564
+ var CodeActionContext;
1565
+ (function (CodeActionContext) {
1566
+ /**
1567
+ * Creates a new CodeActionContext literal.
1568
+ */
1569
+ function create(diagnostics, only) {
1570
+ var result = {
1571
+ diagnostics: diagnostics
1572
+ };
1573
+ if (only !== undefined && only !== null) {
1574
+ result.only = only;
1575
+ }
1576
+ return result;
1577
+ }
1578
+ CodeActionContext.create = create;
1579
+ /**
1580
+ * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
1581
+ */
1582
+ function is(value) {
1583
+ var candidate = value;
1584
+ return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, exports.Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
1585
+ }
1586
+ CodeActionContext.is = is;
1587
+ })(CodeActionContext || (CodeActionContext = {}));
1588
+ var CodeAction;
1589
+ (function (CodeAction) {
1590
+ function create(title, kindOrCommandOrEdit, kind) {
1591
+ var result = {
1592
+ title: title
1593
+ };
1594
+ var checkKind = true;
1595
+ if (typeof kindOrCommandOrEdit === 'string') {
1596
+ checkKind = false;
1597
+ result.kind = kindOrCommandOrEdit;
1598
+ } else if (Command.is(kindOrCommandOrEdit)) {
1599
+ result.command = kindOrCommandOrEdit;
1600
+ } else {
1601
+ result.edit = kindOrCommandOrEdit;
1602
+ }
1603
+ if (checkKind && kind !== undefined) {
1604
+ result.kind = kind;
1605
+ }
1606
+ return result;
1607
+ }
1608
+ CodeAction.create = create;
1609
+ function is(value) {
1610
+ var candidate = value;
1611
+ return candidate && Is.string(candidate.title) && (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, exports.Diagnostic.is)) && (candidate.kind === undefined || Is.string(candidate.kind)) && (candidate.edit !== undefined || candidate.command !== undefined) && (candidate.command === undefined || Command.is(candidate.command)) && (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) && (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
1612
+ }
1613
+ CodeAction.is = is;
1614
+ })(CodeAction || (CodeAction = {}));
1615
+ /**
1616
+ * The CodeLens namespace provides helper functions to work with
1617
+ * [CodeLens](#CodeLens) literals.
1618
+ */
1619
+ var CodeLens;
1620
+ (function (CodeLens) {
1621
+ /**
1622
+ * Creates a new CodeLens literal.
1623
+ */
1624
+ function create(range, data) {
1625
+ var result = {
1626
+ range: range
1627
+ };
1628
+ if (Is.defined(data)) {
1629
+ result.data = data;
1630
+ }
1631
+ return result;
1632
+ }
1633
+ CodeLens.create = create;
1634
+ /**
1635
+ * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
1636
+ */
1637
+ function is(value) {
1638
+ var candidate = value;
1639
+ return Is.defined(candidate) && exports.Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
1640
+ }
1641
+ CodeLens.is = is;
1642
+ })(CodeLens || (CodeLens = {}));
1643
+ /**
1644
+ * The FormattingOptions namespace provides helper functions to work with
1645
+ * [FormattingOptions](#FormattingOptions) literals.
1646
+ */
1647
+ var FormattingOptions;
1648
+ (function (FormattingOptions) {
1649
+ /**
1650
+ * Creates a new FormattingOptions literal.
1651
+ */
1652
+ function create(tabSize, insertSpaces) {
1653
+ return {
1654
+ tabSize: tabSize,
1655
+ insertSpaces: insertSpaces
1656
+ };
1657
+ }
1658
+ FormattingOptions.create = create;
1659
+ /**
1660
+ * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
1661
+ */
1662
+ function is(value) {
1663
+ var candidate = value;
1664
+ return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
1665
+ }
1666
+ FormattingOptions.is = is;
1667
+ })(FormattingOptions || (FormattingOptions = {}));
1668
+ /**
1669
+ * The DocumentLink namespace provides helper functions to work with
1670
+ * [DocumentLink](#DocumentLink) literals.
1671
+ */
1672
+ var DocumentLink;
1673
+ (function (DocumentLink) {
1674
+ /**
1675
+ * Creates a new DocumentLink literal.
1676
+ */
1677
+ function create(range, target, data) {
1678
+ return {
1679
+ range: range,
1680
+ target: target,
1681
+ data: data
1682
+ };
1683
+ }
1684
+ DocumentLink.create = create;
1685
+ /**
1686
+ * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
1687
+ */
1688
+ function is(value) {
1689
+ var candidate = value;
1690
+ return Is.defined(candidate) && exports.Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
1691
+ }
1692
+ DocumentLink.is = is;
1693
+ })(DocumentLink || (DocumentLink = {}));
1694
+ /**
1695
+ * The SelectionRange namespace provides helper function to work with
1696
+ * SelectionRange literals.
1697
+ */
1698
+ var SelectionRange;
1699
+ (function (SelectionRange) {
1700
+ /**
1701
+ * Creates a new SelectionRange
1702
+ * @param range the range.
1703
+ * @param parent an optional parent.
1704
+ */
1705
+ function create(range, parent) {
1706
+ return {
1707
+ range: range,
1708
+ parent: parent
1709
+ };
1710
+ }
1711
+ SelectionRange.create = create;
1712
+ function is(value) {
1713
+ var candidate = value;
1714
+ return candidate !== undefined && exports.Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
1715
+ }
1716
+ SelectionRange.is = is;
1717
+ })(SelectionRange || (SelectionRange = {}));
1718
+ /**
1719
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
1720
+ */
1721
+ exports.TextDocument = void 0;
1722
+ (function (TextDocument) {
1723
+ /**
1724
+ * Creates a new ITextDocument literal from the given uri and content.
1725
+ * @param uri The document's uri.
1726
+ * @param languageId The document's language Id.
1727
+ * @param content The document's content.
1728
+ */
1729
+ function create(uri, languageId, version, content) {
1730
+ return new FullTextDocument(uri, languageId, version, content);
1731
+ }
1732
+ TextDocument.create = create;
1733
+ /**
1734
+ * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
1735
+ */
1736
+ function is(value) {
1737
+ var candidate = value;
1738
+ 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;
1739
+ }
1740
+ TextDocument.is = is;
1741
+ function applyEdits(document, edits) {
1742
+ var text = document.getText();
1743
+ var sortedEdits = mergeSort(edits, function (a, b) {
1744
+ var diff = a.range.start.line - b.range.start.line;
1745
+ if (diff === 0) {
1746
+ return a.range.start.character - b.range.start.character;
1747
+ }
1748
+ return diff;
1749
+ });
1750
+ var lastModifiedOffset = text.length;
1751
+ for (var i = sortedEdits.length - 1; i >= 0; i--) {
1752
+ var e = sortedEdits[i];
1753
+ var startOffset = document.offsetAt(e.range.start);
1754
+ var endOffset = document.offsetAt(e.range.end);
1755
+ if (endOffset <= lastModifiedOffset) {
1756
+ text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
1757
+ } else {
1758
+ throw new Error('Overlapping edit');
1759
+ }
1760
+ lastModifiedOffset = startOffset;
1761
+ }
1762
+ return text;
1763
+ }
1764
+ TextDocument.applyEdits = applyEdits;
1765
+ function mergeSort(data, compare) {
1766
+ if (data.length <= 1) {
1767
+ // sorted
1768
+ return data;
1769
+ }
1770
+ var p = data.length / 2 | 0;
1771
+ var left = data.slice(0, p);
1772
+ var right = data.slice(p);
1773
+ mergeSort(left, compare);
1774
+ mergeSort(right, compare);
1775
+ var leftIdx = 0;
1776
+ var rightIdx = 0;
1777
+ var i = 0;
1778
+ while (leftIdx < left.length && rightIdx < right.length) {
1779
+ var ret = compare(left[leftIdx], right[rightIdx]);
1780
+ if (ret <= 0) {
1781
+ // smaller_equal -> take left to preserve order
1782
+ data[i++] = left[leftIdx++];
1783
+ } else {
1784
+ // greater -> take right
1785
+ data[i++] = right[rightIdx++];
1786
+ }
1787
+ }
1788
+ while (leftIdx < left.length) {
1789
+ data[i++] = left[leftIdx++];
1790
+ }
1791
+ while (rightIdx < right.length) {
1792
+ data[i++] = right[rightIdx++];
1793
+ }
1794
+ return data;
1795
+ }
1796
+ })(exports.TextDocument || (exports.TextDocument = {}));
1797
+ /**
1798
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
1799
+ */
1800
+ var FullTextDocument = /** @class */function () {
1801
+ function FullTextDocument(uri, languageId, version, content) {
1802
+ this._uri = uri;
1803
+ this._languageId = languageId;
1804
+ this._version = version;
1805
+ this._content = content;
1806
+ this._lineOffsets = undefined;
1807
+ }
1808
+ Object.defineProperty(FullTextDocument.prototype, "uri", {
1809
+ get: function get() {
1810
+ return this._uri;
1811
+ },
1812
+ enumerable: false,
1813
+ configurable: true
1814
+ });
1815
+ Object.defineProperty(FullTextDocument.prototype, "languageId", {
1816
+ get: function get() {
1817
+ return this._languageId;
1818
+ },
1819
+ enumerable: false,
1820
+ configurable: true
1821
+ });
1822
+ Object.defineProperty(FullTextDocument.prototype, "version", {
1823
+ get: function get() {
1824
+ return this._version;
1825
+ },
1826
+ enumerable: false,
1827
+ configurable: true
1828
+ });
1829
+ FullTextDocument.prototype.getText = function (range) {
1830
+ if (range) {
1831
+ var start = this.offsetAt(range.start);
1832
+ var end = this.offsetAt(range.end);
1833
+ return this._content.substring(start, end);
1834
+ }
1835
+ return this._content;
1836
+ };
1837
+ FullTextDocument.prototype.update = function (event, version) {
1838
+ this._content = event.text;
1839
+ this._version = version;
1840
+ this._lineOffsets = undefined;
1841
+ };
1842
+ FullTextDocument.prototype.getLineOffsets = function () {
1843
+ if (this._lineOffsets === undefined) {
1844
+ var lineOffsets = [];
1845
+ var text = this._content;
1846
+ var isLineStart = true;
1847
+ for (var i = 0; i < text.length; i++) {
1848
+ if (isLineStart) {
1849
+ lineOffsets.push(i);
1850
+ isLineStart = false;
1851
+ }
1852
+ var ch = text.charAt(i);
1853
+ isLineStart = ch === '\r' || ch === '\n';
1854
+ if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
1855
+ i++;
1856
+ }
1857
+ }
1858
+ if (isLineStart && text.length > 0) {
1859
+ lineOffsets.push(text.length);
1860
+ }
1861
+ this._lineOffsets = lineOffsets;
1862
+ }
1863
+ return this._lineOffsets;
1864
+ };
1865
+ FullTextDocument.prototype.positionAt = function (offset) {
1866
+ offset = Math.max(Math.min(offset, this._content.length), 0);
1867
+ var lineOffsets = this.getLineOffsets();
1868
+ var low = 0,
1869
+ high = lineOffsets.length;
1870
+ if (high === 0) {
1871
+ return Position.create(0, offset);
1872
+ }
1873
+ while (low < high) {
1874
+ var mid = Math.floor((low + high) / 2);
1875
+ if (lineOffsets[mid] > offset) {
1876
+ high = mid;
1877
+ } else {
1878
+ low = mid + 1;
1879
+ }
1880
+ }
1881
+ // low is the least x for which the line offset is larger than the current offset
1882
+ // or array.length if no line offset is larger than the current offset
1883
+ var line = low - 1;
1884
+ return Position.create(line, offset - lineOffsets[line]);
1885
+ };
1886
+ FullTextDocument.prototype.offsetAt = function (position) {
1887
+ var lineOffsets = this.getLineOffsets();
1888
+ if (position.line >= lineOffsets.length) {
1889
+ return this._content.length;
1890
+ } else if (position.line < 0) {
1891
+ return 0;
1892
+ }
1893
+ var lineOffset = lineOffsets[position.line];
1894
+ var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
1895
+ return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
1896
+ };
1897
+ Object.defineProperty(FullTextDocument.prototype, "lineCount", {
1898
+ get: function get() {
1899
+ return this.getLineOffsets().length;
1900
+ },
1901
+ enumerable: false,
1902
+ configurable: true
1903
+ });
1904
+ return FullTextDocument;
1905
+ }();
1906
+ var Is;
1907
+ (function (Is) {
1908
+ var toString = Object.prototype.toString;
1909
+ function defined(value) {
1910
+ return typeof value !== 'undefined';
1911
+ }
1912
+ Is.defined = defined;
1913
+ function undefined$1(value) {
1914
+ return typeof value === 'undefined';
1915
+ }
1916
+ Is.undefined = undefined$1;
1917
+ function boolean(value) {
1918
+ return value === true || value === false;
1919
+ }
1920
+ Is.boolean = boolean;
1921
+ function string(value) {
1922
+ return toString.call(value) === '[object String]';
1923
+ }
1924
+ Is.string = string;
1925
+ function number(value) {
1926
+ return toString.call(value) === '[object Number]';
1927
+ }
1928
+ Is.number = number;
1929
+ function numberRange(value, min, max) {
1930
+ return toString.call(value) === '[object Number]' && min <= value && value <= max;
1931
+ }
1932
+ Is.numberRange = numberRange;
1933
+ function integer(value) {
1934
+ return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
1935
+ }
1936
+ Is.integer = integer;
1937
+ function uinteger(value) {
1938
+ return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
1939
+ }
1940
+ Is.uinteger = uinteger;
1941
+ function func(value) {
1942
+ return toString.call(value) === '[object Function]';
1943
+ }
1944
+ Is.func = func;
1945
+ function objectLiteral(value) {
1946
+ // Strictly speaking class instances pass this check as well. Since the LSP
1947
+ // doesn't use classes we ignore this for now. If we do we need to add something
1948
+ // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
1949
+ return value !== null && _typeof(value) === 'object';
1950
+ }
1951
+ Is.objectLiteral = objectLiteral;
1952
+ function typedArray(value, check) {
1953
+ return Array.isArray(value) && value.every(check);
1954
+ }
1955
+ Is.typedArray = typedArray;
1956
+ })(Is || (Is = {}));
1957
+
1958
+ }));