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