@kusto/monaco-kusto 4.1.8 → 5.1.1

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.
@@ -188,1545 +188,1927 @@ define('vs/language/kusto/languageService/kustoMonarchLanguageDefinition',["requ
188
188
  };
189
189
  });
190
190
 
191
- (function (factory) {
192
- if (typeof module === "object" && typeof module.exports === "object") {
193
- var v = factory(require, exports);
194
- if (v !== undefined) module.exports = v;
195
- }
196
- else if (typeof define === "function" && define.amd) {
197
- define('vscode-languageserver-types/main',["require", "exports"], factory);
198
- }
199
- })(function (require, exports) {
200
- /* --------------------------------------------------------------------------------------------
201
- * Copyright (c) Microsoft Corporation. All rights reserved.
202
- * Licensed under the MIT License. See License.txt in the project root for license information.
203
- * ------------------------------------------------------------------------------------------ */
204
- 'use strict';
205
- Object.defineProperty(exports, "__esModule", { value: true });
206
- /**
207
- * The Position namespace provides helper functions to work with
208
- * [Position](#Position) literals.
209
- */
210
- var Position;
211
- (function (Position) {
212
- /**
213
- * Creates a new Position literal from the given line and character.
214
- * @param line The position's line.
215
- * @param character The position's character.
216
- */
217
- function create(line, character) {
218
- return { line: line, character: character };
219
- }
220
- Position.create = create;
221
- /**
222
- * Checks whether the given liternal conforms to the [Position](#Position) interface.
223
- */
224
- function is(value) {
225
- var candidate = value;
226
- return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
227
- }
228
- Position.is = is;
229
- })(Position = exports.Position || (exports.Position = {}));
230
- /**
231
- * The Range namespace provides helper functions to work with
232
- * [Range](#Range) literals.
233
- */
234
- var Range;
235
- (function (Range) {
236
- function create(one, two, three, four) {
237
- if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
238
- return { start: Position.create(one, two), end: Position.create(three, four) };
239
- }
240
- else if (Position.is(one) && Position.is(two)) {
241
- return { start: one, end: two };
242
- }
243
- else {
244
- throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
245
- }
246
- }
247
- Range.create = create;
248
- /**
249
- * Checks whether the given literal conforms to the [Range](#Range) interface.
250
- */
251
- function is(value) {
252
- var candidate = value;
253
- return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
254
- }
255
- Range.is = is;
256
- })(Range = exports.Range || (exports.Range = {}));
257
- /**
258
- * The Location namespace provides helper functions to work with
259
- * [Location](#Location) literals.
260
- */
261
- var Location;
262
- (function (Location) {
263
- /**
264
- * Creates a Location literal.
265
- * @param uri The location's uri.
266
- * @param range The location's range.
267
- */
268
- function create(uri, range) {
269
- return { uri: uri, range: range };
270
- }
271
- Location.create = create;
272
- /**
273
- * Checks whether the given literal conforms to the [Location](#Location) interface.
274
- */
275
- function is(value) {
276
- var candidate = value;
277
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
278
- }
279
- Location.is = is;
280
- })(Location = exports.Location || (exports.Location = {}));
281
- /**
282
- * The LocationLink namespace provides helper functions to work with
283
- * [LocationLink](#LocationLink) literals.
284
- */
285
- var LocationLink;
286
- (function (LocationLink) {
287
- /**
288
- * Creates a LocationLink literal.
289
- * @param targetUri The definition's uri.
290
- * @param targetRange The full range of the definition.
291
- * @param targetSelectionRange The span of the symbol definition at the target.
292
- * @param originSelectionRange The span of the symbol being defined in the originating source file.
293
- */
294
- function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
295
- return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
296
- }
297
- LocationLink.create = create;
298
- /**
299
- * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
300
- */
301
- function is(value) {
302
- var candidate = value;
303
- return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
304
- && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
305
- && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
306
- }
307
- LocationLink.is = is;
308
- })(LocationLink = exports.LocationLink || (exports.LocationLink = {}));
309
- /**
310
- * The Color namespace provides helper functions to work with
311
- * [Color](#Color) literals.
312
- */
313
- var Color;
314
- (function (Color) {
315
- /**
316
- * Creates a new Color literal.
317
- */
318
- function create(red, green, blue, alpha) {
319
- return {
320
- red: red,
321
- green: green,
322
- blue: blue,
323
- alpha: alpha,
324
- };
325
- }
326
- Color.create = create;
327
- /**
328
- * Checks whether the given literal conforms to the [Color](#Color) interface.
329
- */
330
- function is(value) {
331
- var candidate = value;
332
- return Is.number(candidate.red)
333
- && Is.number(candidate.green)
334
- && Is.number(candidate.blue)
335
- && Is.number(candidate.alpha);
336
- }
337
- Color.is = is;
338
- })(Color = exports.Color || (exports.Color = {}));
339
- /**
340
- * The ColorInformation namespace provides helper functions to work with
341
- * [ColorInformation](#ColorInformation) literals.
342
- */
343
- var ColorInformation;
344
- (function (ColorInformation) {
345
- /**
346
- * Creates a new ColorInformation literal.
347
- */
348
- function create(range, color) {
349
- return {
350
- range: range,
351
- color: color,
352
- };
353
- }
354
- ColorInformation.create = create;
355
- /**
356
- * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
357
- */
358
- function is(value) {
359
- var candidate = value;
360
- return Range.is(candidate.range) && Color.is(candidate.color);
361
- }
362
- ColorInformation.is = is;
363
- })(ColorInformation = exports.ColorInformation || (exports.ColorInformation = {}));
364
- /**
365
- * The Color namespace provides helper functions to work with
366
- * [ColorPresentation](#ColorPresentation) literals.
367
- */
368
- var ColorPresentation;
369
- (function (ColorPresentation) {
370
- /**
371
- * Creates a new ColorInformation literal.
372
- */
373
- function create(label, textEdit, additionalTextEdits) {
374
- return {
375
- label: label,
376
- textEdit: textEdit,
377
- additionalTextEdits: additionalTextEdits,
378
- };
379
- }
380
- ColorPresentation.create = create;
381
- /**
382
- * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
383
- */
384
- function is(value) {
385
- var candidate = value;
386
- return Is.string(candidate.label)
387
- && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
388
- && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
389
- }
390
- ColorPresentation.is = is;
391
- })(ColorPresentation = exports.ColorPresentation || (exports.ColorPresentation = {}));
392
- /**
393
- * Enum of known range kinds
394
- */
395
- var FoldingRangeKind;
396
- (function (FoldingRangeKind) {
397
- /**
398
- * Folding range for a comment
399
- */
400
- FoldingRangeKind["Comment"] = "comment";
401
- /**
402
- * Folding range for a imports or includes
403
- */
404
- FoldingRangeKind["Imports"] = "imports";
405
- /**
406
- * Folding range for a region (e.g. `#region`)
407
- */
408
- FoldingRangeKind["Region"] = "region";
409
- })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
410
- /**
411
- * The folding range namespace provides helper functions to work with
412
- * [FoldingRange](#FoldingRange) literals.
413
- */
414
- var FoldingRange;
415
- (function (FoldingRange) {
416
- /**
417
- * Creates a new FoldingRange literal.
418
- */
419
- function create(startLine, endLine, startCharacter, endCharacter, kind) {
420
- var result = {
421
- startLine: startLine,
422
- endLine: endLine
423
- };
424
- if (Is.defined(startCharacter)) {
425
- result.startCharacter = startCharacter;
426
- }
427
- if (Is.defined(endCharacter)) {
428
- result.endCharacter = endCharacter;
429
- }
430
- if (Is.defined(kind)) {
431
- result.kind = kind;
432
- }
433
- return result;
434
- }
435
- FoldingRange.create = create;
436
- /**
437
- * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
438
- */
439
- function is(value) {
440
- var candidate = value;
441
- return Is.number(candidate.startLine) && Is.number(candidate.startLine)
442
- && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
443
- && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
444
- && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
445
- }
446
- FoldingRange.is = is;
447
- })(FoldingRange = exports.FoldingRange || (exports.FoldingRange = {}));
448
- /**
449
- * The DiagnosticRelatedInformation namespace provides helper functions to work with
450
- * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
451
- */
452
- var DiagnosticRelatedInformation;
453
- (function (DiagnosticRelatedInformation) {
454
- /**
455
- * Creates a new DiagnosticRelatedInformation literal.
456
- */
457
- function create(location, message) {
458
- return {
459
- location: location,
460
- message: message
461
- };
462
- }
463
- DiagnosticRelatedInformation.create = create;
464
- /**
465
- * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
466
- */
467
- function is(value) {
468
- var candidate = value;
469
- return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
470
- }
471
- DiagnosticRelatedInformation.is = is;
472
- })(DiagnosticRelatedInformation = exports.DiagnosticRelatedInformation || (exports.DiagnosticRelatedInformation = {}));
473
- /**
474
- * The diagnostic's severity.
475
- */
476
- var DiagnosticSeverity;
477
- (function (DiagnosticSeverity) {
478
- /**
479
- * Reports an error.
480
- */
481
- DiagnosticSeverity.Error = 1;
482
- /**
483
- * Reports a warning.
484
- */
485
- DiagnosticSeverity.Warning = 2;
486
- /**
487
- * Reports an information.
488
- */
489
- DiagnosticSeverity.Information = 3;
490
- /**
491
- * Reports a hint.
492
- */
493
- DiagnosticSeverity.Hint = 4;
494
- })(DiagnosticSeverity = exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {}));
495
- /**
496
- * The diagnostic tags.
497
- *
498
- * @since 3.15.0
499
- */
500
- var DiagnosticTag;
501
- (function (DiagnosticTag) {
502
- /**
503
- * Unused or unnecessary code.
504
- *
505
- * Clients are allowed to render diagnostics with this tag faded out instead of having
506
- * an error squiggle.
507
- */
508
- DiagnosticTag.Unnecessary = 1;
509
- /**
510
- * Deprecated or obsolete code.
511
- *
512
- * Clients are allowed to rendered diagnostics with this tag strike through.
513
- */
514
- DiagnosticTag.Deprecated = 2;
515
- })(DiagnosticTag = exports.DiagnosticTag || (exports.DiagnosticTag = {}));
516
- /**
517
- * The Diagnostic namespace provides helper functions to work with
518
- * [Diagnostic](#Diagnostic) literals.
519
- */
520
- var Diagnostic;
521
- (function (Diagnostic) {
522
- /**
523
- * Creates a new Diagnostic literal.
524
- */
525
- function create(range, message, severity, code, source, relatedInformation) {
526
- var result = { range: range, message: message };
527
- if (Is.defined(severity)) {
528
- result.severity = severity;
529
- }
530
- if (Is.defined(code)) {
531
- result.code = code;
532
- }
533
- if (Is.defined(source)) {
534
- result.source = source;
535
- }
536
- if (Is.defined(relatedInformation)) {
537
- result.relatedInformation = relatedInformation;
538
- }
539
- return result;
540
- }
541
- Diagnostic.create = create;
542
- /**
543
- * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
544
- */
545
- function is(value) {
546
- var candidate = value;
547
- return Is.defined(candidate)
548
- && Range.is(candidate.range)
549
- && Is.string(candidate.message)
550
- && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
551
- && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
552
- && (Is.string(candidate.source) || Is.undefined(candidate.source))
553
- && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
554
- }
555
- Diagnostic.is = is;
556
- })(Diagnostic = exports.Diagnostic || (exports.Diagnostic = {}));
557
- /**
558
- * The Command namespace provides helper functions to work with
559
- * [Command](#Command) literals.
560
- */
561
- var Command;
562
- (function (Command) {
563
- /**
564
- * Creates a new Command literal.
565
- */
566
- function create(title, command) {
567
- var args = [];
568
- for (var _i = 2; _i < arguments.length; _i++) {
569
- args[_i - 2] = arguments[_i];
570
- }
571
- var result = { title: title, command: command };
572
- if (Is.defined(args) && args.length > 0) {
573
- result.arguments = args;
574
- }
575
- return result;
576
- }
577
- Command.create = create;
578
- /**
579
- * Checks whether the given literal conforms to the [Command](#Command) interface.
580
- */
581
- function is(value) {
582
- var candidate = value;
583
- return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
584
- }
585
- Command.is = is;
586
- })(Command = exports.Command || (exports.Command = {}));
587
- /**
588
- * The TextEdit namespace provides helper function to create replace,
589
- * insert and delete edits more easily.
590
- */
591
- var TextEdit;
592
- (function (TextEdit) {
593
- /**
594
- * Creates a replace text edit.
595
- * @param range The range of text to be replaced.
596
- * @param newText The new text.
597
- */
598
- function replace(range, newText) {
599
- return { range: range, newText: newText };
600
- }
601
- TextEdit.replace = replace;
602
- /**
603
- * Creates a insert text edit.
604
- * @param position The position to insert the text at.
605
- * @param newText The text to be inserted.
606
- */
607
- function insert(position, newText) {
608
- return { range: { start: position, end: position }, newText: newText };
609
- }
610
- TextEdit.insert = insert;
611
- /**
612
- * Creates a delete text edit.
613
- * @param range The range of text to be deleted.
614
- */
615
- function del(range) {
616
- return { range: range, newText: '' };
617
- }
618
- TextEdit.del = del;
619
- function is(value) {
620
- var candidate = value;
621
- return Is.objectLiteral(candidate)
622
- && Is.string(candidate.newText)
623
- && Range.is(candidate.range);
624
- }
625
- TextEdit.is = is;
626
- })(TextEdit = exports.TextEdit || (exports.TextEdit = {}));
627
- /**
628
- * The TextDocumentEdit namespace provides helper function to create
629
- * an edit that manipulates a text document.
630
- */
631
- var TextDocumentEdit;
632
- (function (TextDocumentEdit) {
633
- /**
634
- * Creates a new `TextDocumentEdit`
635
- */
636
- function create(textDocument, edits) {
637
- return { textDocument: textDocument, edits: edits };
638
- }
639
- TextDocumentEdit.create = create;
640
- function is(value) {
641
- var candidate = value;
642
- return Is.defined(candidate)
643
- && VersionedTextDocumentIdentifier.is(candidate.textDocument)
644
- && Array.isArray(candidate.edits);
645
- }
646
- TextDocumentEdit.is = is;
647
- })(TextDocumentEdit = exports.TextDocumentEdit || (exports.TextDocumentEdit = {}));
648
- var CreateFile;
649
- (function (CreateFile) {
650
- function create(uri, options) {
651
- var result = {
652
- kind: 'create',
653
- uri: uri
654
- };
655
- if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
656
- result.options = options;
657
- }
658
- return result;
659
- }
660
- CreateFile.create = create;
661
- function is(value) {
662
- var candidate = value;
663
- return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
664
- (candidate.options === void 0 ||
665
- ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
666
- }
667
- CreateFile.is = is;
668
- })(CreateFile = exports.CreateFile || (exports.CreateFile = {}));
669
- var RenameFile;
670
- (function (RenameFile) {
671
- function create(oldUri, newUri, options) {
672
- var result = {
673
- kind: 'rename',
674
- oldUri: oldUri,
675
- newUri: newUri
676
- };
677
- if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
678
- result.options = options;
679
- }
680
- return result;
681
- }
682
- RenameFile.create = create;
683
- function is(value) {
684
- var candidate = value;
685
- return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
686
- (candidate.options === void 0 ||
687
- ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
688
- }
689
- RenameFile.is = is;
690
- })(RenameFile = exports.RenameFile || (exports.RenameFile = {}));
691
- var DeleteFile;
692
- (function (DeleteFile) {
693
- function create(uri, options) {
694
- var result = {
695
- kind: 'delete',
696
- uri: uri
697
- };
698
- if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
699
- result.options = options;
700
- }
701
- return result;
702
- }
703
- DeleteFile.create = create;
704
- function is(value) {
705
- var candidate = value;
706
- return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
707
- (candidate.options === void 0 ||
708
- ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
709
- }
710
- DeleteFile.is = is;
711
- })(DeleteFile = exports.DeleteFile || (exports.DeleteFile = {}));
712
- var WorkspaceEdit;
713
- (function (WorkspaceEdit) {
714
- function is(value) {
715
- var candidate = value;
716
- return candidate &&
717
- (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
718
- (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
719
- if (Is.string(change.kind)) {
720
- return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
721
- }
722
- else {
723
- return TextDocumentEdit.is(change);
724
- }
725
- }));
726
- }
727
- WorkspaceEdit.is = is;
728
- })(WorkspaceEdit = exports.WorkspaceEdit || (exports.WorkspaceEdit = {}));
729
- var TextEditChangeImpl = /** @class */ (function () {
730
- function TextEditChangeImpl(edits) {
731
- this.edits = edits;
732
- }
733
- TextEditChangeImpl.prototype.insert = function (position, newText) {
734
- this.edits.push(TextEdit.insert(position, newText));
735
- };
736
- TextEditChangeImpl.prototype.replace = function (range, newText) {
737
- this.edits.push(TextEdit.replace(range, newText));
738
- };
739
- TextEditChangeImpl.prototype.delete = function (range) {
740
- this.edits.push(TextEdit.del(range));
741
- };
742
- TextEditChangeImpl.prototype.add = function (edit) {
743
- this.edits.push(edit);
744
- };
745
- TextEditChangeImpl.prototype.all = function () {
746
- return this.edits;
747
- };
748
- TextEditChangeImpl.prototype.clear = function () {
749
- this.edits.splice(0, this.edits.length);
750
- };
751
- return TextEditChangeImpl;
752
- }());
753
- /**
754
- * A workspace change helps constructing changes to a workspace.
755
- */
756
- var WorkspaceChange = /** @class */ (function () {
757
- function WorkspaceChange(workspaceEdit) {
758
- var _this = this;
759
- this._textEditChanges = Object.create(null);
760
- if (workspaceEdit) {
761
- this._workspaceEdit = workspaceEdit;
762
- if (workspaceEdit.documentChanges) {
763
- workspaceEdit.documentChanges.forEach(function (change) {
764
- if (TextDocumentEdit.is(change)) {
765
- var textEditChange = new TextEditChangeImpl(change.edits);
766
- _this._textEditChanges[change.textDocument.uri] = textEditChange;
767
- }
768
- });
769
- }
770
- else if (workspaceEdit.changes) {
771
- Object.keys(workspaceEdit.changes).forEach(function (key) {
772
- var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
773
- _this._textEditChanges[key] = textEditChange;
774
- });
775
- }
776
- }
777
- }
778
- Object.defineProperty(WorkspaceChange.prototype, "edit", {
779
- /**
780
- * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
781
- * use to be returned from a workspace edit operation like rename.
782
- */
783
- get: function () {
784
- return this._workspaceEdit;
785
- },
786
- enumerable: true,
787
- configurable: true
788
- });
789
- WorkspaceChange.prototype.getTextEditChange = function (key) {
790
- if (VersionedTextDocumentIdentifier.is(key)) {
791
- if (!this._workspaceEdit) {
792
- this._workspaceEdit = {
793
- documentChanges: []
794
- };
795
- }
796
- if (!this._workspaceEdit.documentChanges) {
797
- throw new Error('Workspace edit is not configured for document changes.');
798
- }
799
- var textDocument = key;
800
- var result = this._textEditChanges[textDocument.uri];
801
- if (!result) {
802
- var edits = [];
803
- var textDocumentEdit = {
804
- textDocument: textDocument,
805
- edits: edits
806
- };
807
- this._workspaceEdit.documentChanges.push(textDocumentEdit);
808
- result = new TextEditChangeImpl(edits);
809
- this._textEditChanges[textDocument.uri] = result;
810
- }
811
- return result;
812
- }
813
- else {
814
- if (!this._workspaceEdit) {
815
- this._workspaceEdit = {
816
- changes: Object.create(null)
817
- };
818
- }
819
- if (!this._workspaceEdit.changes) {
820
- throw new Error('Workspace edit is not configured for normal text edit changes.');
821
- }
822
- var result = this._textEditChanges[key];
823
- if (!result) {
824
- var edits = [];
825
- this._workspaceEdit.changes[key] = edits;
826
- result = new TextEditChangeImpl(edits);
827
- this._textEditChanges[key] = result;
828
- }
829
- return result;
830
- }
831
- };
832
- WorkspaceChange.prototype.createFile = function (uri, options) {
833
- this.checkDocumentChanges();
834
- this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
835
- };
836
- WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {
837
- this.checkDocumentChanges();
838
- this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
839
- };
840
- WorkspaceChange.prototype.deleteFile = function (uri, options) {
841
- this.checkDocumentChanges();
842
- this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
843
- };
844
- WorkspaceChange.prototype.checkDocumentChanges = function () {
845
- if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
846
- throw new Error('Workspace edit is not configured for document changes.');
847
- }
848
- };
849
- return WorkspaceChange;
850
- }());
851
- exports.WorkspaceChange = WorkspaceChange;
852
- /**
853
- * The TextDocumentIdentifier namespace provides helper functions to work with
854
- * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
855
- */
856
- var TextDocumentIdentifier;
857
- (function (TextDocumentIdentifier) {
858
- /**
859
- * Creates a new TextDocumentIdentifier literal.
860
- * @param uri The document's uri.
861
- */
862
- function create(uri) {
863
- return { uri: uri };
864
- }
865
- TextDocumentIdentifier.create = create;
866
- /**
867
- * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
868
- */
869
- function is(value) {
870
- var candidate = value;
871
- return Is.defined(candidate) && Is.string(candidate.uri);
872
- }
873
- TextDocumentIdentifier.is = is;
874
- })(TextDocumentIdentifier = exports.TextDocumentIdentifier || (exports.TextDocumentIdentifier = {}));
875
- /**
876
- * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
877
- * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
878
- */
879
- var VersionedTextDocumentIdentifier;
880
- (function (VersionedTextDocumentIdentifier) {
881
- /**
882
- * Creates a new VersionedTextDocumentIdentifier literal.
883
- * @param uri The document's uri.
884
- * @param uri The document's text.
885
- */
886
- function create(uri, version) {
887
- return { uri: uri, version: version };
888
- }
889
- VersionedTextDocumentIdentifier.create = create;
890
- /**
891
- * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
892
- */
893
- function is(value) {
894
- var candidate = value;
895
- return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
896
- }
897
- VersionedTextDocumentIdentifier.is = is;
898
- })(VersionedTextDocumentIdentifier = exports.VersionedTextDocumentIdentifier || (exports.VersionedTextDocumentIdentifier = {}));
899
- /**
900
- * The TextDocumentItem namespace provides helper functions to work with
901
- * [TextDocumentItem](#TextDocumentItem) literals.
902
- */
903
- var TextDocumentItem;
904
- (function (TextDocumentItem) {
905
- /**
906
- * Creates a new TextDocumentItem literal.
907
- * @param uri The document's uri.
908
- * @param languageId The document's language identifier.
909
- * @param version The document's version number.
910
- * @param text The document's text.
911
- */
912
- function create(uri, languageId, version, text) {
913
- return { uri: uri, languageId: languageId, version: version, text: text };
914
- }
915
- TextDocumentItem.create = create;
916
- /**
917
- * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
918
- */
919
- function is(value) {
920
- var candidate = value;
921
- return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
922
- }
923
- TextDocumentItem.is = is;
924
- })(TextDocumentItem = exports.TextDocumentItem || (exports.TextDocumentItem = {}));
925
- /**
926
- * Describes the content type that a client supports in various
927
- * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
928
- *
929
- * Please note that `MarkupKinds` must not start with a `$`. This kinds
930
- * are reserved for internal usage.
931
- */
932
- var MarkupKind;
933
- (function (MarkupKind) {
934
- /**
935
- * Plain text is supported as a content format
936
- */
937
- MarkupKind.PlainText = 'plaintext';
938
- /**
939
- * Markdown is supported as a content format
940
- */
941
- MarkupKind.Markdown = 'markdown';
942
- })(MarkupKind = exports.MarkupKind || (exports.MarkupKind = {}));
943
- (function (MarkupKind) {
944
- /**
945
- * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
946
- */
947
- function is(value) {
948
- var candidate = value;
949
- return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
950
- }
951
- MarkupKind.is = is;
952
- })(MarkupKind = exports.MarkupKind || (exports.MarkupKind = {}));
953
- var MarkupContent;
954
- (function (MarkupContent) {
955
- /**
956
- * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
957
- */
958
- function is(value) {
959
- var candidate = value;
960
- return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
961
- }
962
- MarkupContent.is = is;
963
- })(MarkupContent = exports.MarkupContent || (exports.MarkupContent = {}));
964
- /**
965
- * The kind of a completion entry.
966
- */
967
- var CompletionItemKind;
968
- (function (CompletionItemKind) {
969
- CompletionItemKind.Text = 1;
970
- CompletionItemKind.Method = 2;
971
- CompletionItemKind.Function = 3;
972
- CompletionItemKind.Constructor = 4;
973
- CompletionItemKind.Field = 5;
974
- CompletionItemKind.Variable = 6;
975
- CompletionItemKind.Class = 7;
976
- CompletionItemKind.Interface = 8;
977
- CompletionItemKind.Module = 9;
978
- CompletionItemKind.Property = 10;
979
- CompletionItemKind.Unit = 11;
980
- CompletionItemKind.Value = 12;
981
- CompletionItemKind.Enum = 13;
982
- CompletionItemKind.Keyword = 14;
983
- CompletionItemKind.Snippet = 15;
984
- CompletionItemKind.Color = 16;
985
- CompletionItemKind.File = 17;
986
- CompletionItemKind.Reference = 18;
987
- CompletionItemKind.Folder = 19;
988
- CompletionItemKind.EnumMember = 20;
989
- CompletionItemKind.Constant = 21;
990
- CompletionItemKind.Struct = 22;
991
- CompletionItemKind.Event = 23;
992
- CompletionItemKind.Operator = 24;
993
- CompletionItemKind.TypeParameter = 25;
994
- })(CompletionItemKind = exports.CompletionItemKind || (exports.CompletionItemKind = {}));
995
- /**
996
- * Defines whether the insert text in a completion item should be interpreted as
997
- * plain text or a snippet.
998
- */
999
- var InsertTextFormat;
1000
- (function (InsertTextFormat) {
1001
- /**
1002
- * The primary text to be inserted is treated as a plain string.
1003
- */
1004
- InsertTextFormat.PlainText = 1;
1005
- /**
1006
- * The primary text to be inserted is treated as a snippet.
1007
- *
1008
- * A snippet can define tab stops and placeholders with `$1`, `$2`
1009
- * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
1010
- * the end of the snippet. Placeholders with equal identifiers are linked,
1011
- * that is typing in one will update others too.
1012
- *
1013
- * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
1014
- */
1015
- InsertTextFormat.Snippet = 2;
1016
- })(InsertTextFormat = exports.InsertTextFormat || (exports.InsertTextFormat = {}));
1017
- /**
1018
- * Completion item tags are extra annotations that tweak the rendering of a completion
1019
- * item.
1020
- *
1021
- * @since 3.15.0
1022
- */
1023
- var CompletionItemTag;
1024
- (function (CompletionItemTag) {
1025
- /**
1026
- * Render a completion as obsolete, usually using a strike-out.
1027
- */
1028
- CompletionItemTag.Deprecated = 1;
1029
- })(CompletionItemTag = exports.CompletionItemTag || (exports.CompletionItemTag = {}));
1030
- /**
1031
- * The CompletionItem namespace provides functions to deal with
1032
- * completion items.
1033
- */
1034
- var CompletionItem;
1035
- (function (CompletionItem) {
1036
- /**
1037
- * Create a completion item and seed it with a label.
1038
- * @param label The completion item's label
1039
- */
1040
- function create(label) {
1041
- return { label: label };
1042
- }
1043
- CompletionItem.create = create;
1044
- })(CompletionItem = exports.CompletionItem || (exports.CompletionItem = {}));
1045
- /**
1046
- * The CompletionList namespace provides functions to deal with
1047
- * completion lists.
1048
- */
1049
- var CompletionList;
1050
- (function (CompletionList) {
1051
- /**
1052
- * Creates a new completion list.
1053
- *
1054
- * @param items The completion items.
1055
- * @param isIncomplete The list is not complete.
1056
- */
1057
- function create(items, isIncomplete) {
1058
- return { items: items ? items : [], isIncomplete: !!isIncomplete };
1059
- }
1060
- CompletionList.create = create;
1061
- })(CompletionList = exports.CompletionList || (exports.CompletionList = {}));
1062
- var MarkedString;
1063
- (function (MarkedString) {
1064
- /**
1065
- * Creates a marked string from plain text.
1066
- *
1067
- * @param plainText The plain text.
1068
- */
1069
- function fromPlainText(plainText) {
1070
- return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
1071
- }
1072
- MarkedString.fromPlainText = fromPlainText;
1073
- /**
1074
- * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
1075
- */
1076
- function is(value) {
1077
- var candidate = value;
1078
- return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
1079
- }
1080
- MarkedString.is = is;
1081
- })(MarkedString = exports.MarkedString || (exports.MarkedString = {}));
1082
- var Hover;
1083
- (function (Hover) {
1084
- /**
1085
- * Checks whether the given value conforms to the [Hover](#Hover) interface.
1086
- */
1087
- function is(value) {
1088
- var candidate = value;
1089
- return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
1090
- MarkedString.is(candidate.contents) ||
1091
- Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
1092
- }
1093
- Hover.is = is;
1094
- })(Hover = exports.Hover || (exports.Hover = {}));
1095
- /**
1096
- * The ParameterInformation namespace provides helper functions to work with
1097
- * [ParameterInformation](#ParameterInformation) literals.
1098
- */
1099
- var ParameterInformation;
1100
- (function (ParameterInformation) {
1101
- /**
1102
- * Creates a new parameter information literal.
1103
- *
1104
- * @param label A label string.
1105
- * @param documentation A doc string.
1106
- */
1107
- function create(label, documentation) {
1108
- return documentation ? { label: label, documentation: documentation } : { label: label };
1109
- }
1110
- ParameterInformation.create = create;
1111
- })(ParameterInformation = exports.ParameterInformation || (exports.ParameterInformation = {}));
1112
- /**
1113
- * The SignatureInformation namespace provides helper functions to work with
1114
- * [SignatureInformation](#SignatureInformation) literals.
1115
- */
1116
- var SignatureInformation;
1117
- (function (SignatureInformation) {
1118
- function create(label, documentation) {
1119
- var parameters = [];
1120
- for (var _i = 2; _i < arguments.length; _i++) {
1121
- parameters[_i - 2] = arguments[_i];
1122
- }
1123
- var result = { label: label };
1124
- if (Is.defined(documentation)) {
1125
- result.documentation = documentation;
1126
- }
1127
- if (Is.defined(parameters)) {
1128
- result.parameters = parameters;
1129
- }
1130
- else {
1131
- result.parameters = [];
1132
- }
1133
- return result;
1134
- }
1135
- SignatureInformation.create = create;
1136
- })(SignatureInformation = exports.SignatureInformation || (exports.SignatureInformation = {}));
1137
- /**
1138
- * A document highlight kind.
1139
- */
1140
- var DocumentHighlightKind;
1141
- (function (DocumentHighlightKind) {
1142
- /**
1143
- * A textual occurrence.
1144
- */
1145
- DocumentHighlightKind.Text = 1;
1146
- /**
1147
- * Read-access of a symbol, like reading a variable.
1148
- */
1149
- DocumentHighlightKind.Read = 2;
1150
- /**
1151
- * Write-access of a symbol, like writing to a variable.
1152
- */
1153
- DocumentHighlightKind.Write = 3;
1154
- })(DocumentHighlightKind = exports.DocumentHighlightKind || (exports.DocumentHighlightKind = {}));
1155
- /**
1156
- * DocumentHighlight namespace to provide helper functions to work with
1157
- * [DocumentHighlight](#DocumentHighlight) literals.
1158
- */
1159
- var DocumentHighlight;
1160
- (function (DocumentHighlight) {
1161
- /**
1162
- * Create a DocumentHighlight object.
1163
- * @param range The range the highlight applies to.
1164
- */
1165
- function create(range, kind) {
1166
- var result = { range: range };
1167
- if (Is.number(kind)) {
1168
- result.kind = kind;
1169
- }
1170
- return result;
1171
- }
1172
- DocumentHighlight.create = create;
1173
- })(DocumentHighlight = exports.DocumentHighlight || (exports.DocumentHighlight = {}));
1174
- /**
1175
- * A symbol kind.
1176
- */
1177
- var SymbolKind;
1178
- (function (SymbolKind) {
1179
- SymbolKind.File = 1;
1180
- SymbolKind.Module = 2;
1181
- SymbolKind.Namespace = 3;
1182
- SymbolKind.Package = 4;
1183
- SymbolKind.Class = 5;
1184
- SymbolKind.Method = 6;
1185
- SymbolKind.Property = 7;
1186
- SymbolKind.Field = 8;
1187
- SymbolKind.Constructor = 9;
1188
- SymbolKind.Enum = 10;
1189
- SymbolKind.Interface = 11;
1190
- SymbolKind.Function = 12;
1191
- SymbolKind.Variable = 13;
1192
- SymbolKind.Constant = 14;
1193
- SymbolKind.String = 15;
1194
- SymbolKind.Number = 16;
1195
- SymbolKind.Boolean = 17;
1196
- SymbolKind.Array = 18;
1197
- SymbolKind.Object = 19;
1198
- SymbolKind.Key = 20;
1199
- SymbolKind.Null = 21;
1200
- SymbolKind.EnumMember = 22;
1201
- SymbolKind.Struct = 23;
1202
- SymbolKind.Event = 24;
1203
- SymbolKind.Operator = 25;
1204
- SymbolKind.TypeParameter = 26;
1205
- })(SymbolKind = exports.SymbolKind || (exports.SymbolKind = {}));
1206
- /**
1207
- * Symbol tags are extra annotations that tweak the rendering of a symbol.
1208
- * @since 3.15
1209
- */
1210
- var SymbolTag;
1211
- (function (SymbolTag) {
1212
- /**
1213
- * Render a symbol as obsolete, usually using a strike-out.
1214
- */
1215
- SymbolTag.Deprecated = 1;
1216
- })(SymbolTag = exports.SymbolTag || (exports.SymbolTag = {}));
1217
- var SymbolInformation;
1218
- (function (SymbolInformation) {
1219
- /**
1220
- * Creates a new symbol information literal.
1221
- *
1222
- * @param name The name of the symbol.
1223
- * @param kind The kind of the symbol.
1224
- * @param range The range of the location of the symbol.
1225
- * @param uri The resource of the location of symbol, defaults to the current document.
1226
- * @param containerName The name of the symbol containing the symbol.
1227
- */
1228
- function create(name, kind, range, uri, containerName) {
1229
- var result = {
1230
- name: name,
1231
- kind: kind,
1232
- location: { uri: uri, range: range }
1233
- };
1234
- if (containerName) {
1235
- result.containerName = containerName;
1236
- }
1237
- return result;
1238
- }
1239
- SymbolInformation.create = create;
1240
- })(SymbolInformation = exports.SymbolInformation || (exports.SymbolInformation = {}));
1241
- var DocumentSymbol;
1242
- (function (DocumentSymbol) {
1243
- /**
1244
- * Creates a new symbol information literal.
1245
- *
1246
- * @param name The name of the symbol.
1247
- * @param detail The detail of the symbol.
1248
- * @param kind The kind of the symbol.
1249
- * @param range The range of the symbol.
1250
- * @param selectionRange The selectionRange of the symbol.
1251
- * @param children Children of the symbol.
1252
- */
1253
- function create(name, detail, kind, range, selectionRange, children) {
1254
- var result = {
1255
- name: name,
1256
- detail: detail,
1257
- kind: kind,
1258
- range: range,
1259
- selectionRange: selectionRange
1260
- };
1261
- if (children !== void 0) {
1262
- result.children = children;
1263
- }
1264
- return result;
1265
- }
1266
- DocumentSymbol.create = create;
1267
- /**
1268
- * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
1269
- */
1270
- function is(value) {
1271
- var candidate = value;
1272
- return candidate &&
1273
- Is.string(candidate.name) && Is.number(candidate.kind) &&
1274
- Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
1275
- (candidate.detail === void 0 || Is.string(candidate.detail)) &&
1276
- (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
1277
- (candidate.children === void 0 || Array.isArray(candidate.children));
1278
- }
1279
- DocumentSymbol.is = is;
1280
- })(DocumentSymbol = exports.DocumentSymbol || (exports.DocumentSymbol = {}));
1281
- /**
1282
- * A set of predefined code action kinds
1283
- */
1284
- var CodeActionKind;
1285
- (function (CodeActionKind) {
1286
- /**
1287
- * Empty kind.
1288
- */
1289
- CodeActionKind.Empty = '';
1290
- /**
1291
- * Base kind for quickfix actions: 'quickfix'
1292
- */
1293
- CodeActionKind.QuickFix = 'quickfix';
1294
- /**
1295
- * Base kind for refactoring actions: 'refactor'
1296
- */
1297
- CodeActionKind.Refactor = 'refactor';
1298
- /**
1299
- * Base kind for refactoring extraction actions: 'refactor.extract'
1300
- *
1301
- * Example extract actions:
1302
- *
1303
- * - Extract method
1304
- * - Extract function
1305
- * - Extract variable
1306
- * - Extract interface from class
1307
- * - ...
1308
- */
1309
- CodeActionKind.RefactorExtract = 'refactor.extract';
1310
- /**
1311
- * Base kind for refactoring inline actions: 'refactor.inline'
1312
- *
1313
- * Example inline actions:
1314
- *
1315
- * - Inline function
1316
- * - Inline variable
1317
- * - Inline constant
1318
- * - ...
1319
- */
1320
- CodeActionKind.RefactorInline = 'refactor.inline';
1321
- /**
1322
- * Base kind for refactoring rewrite actions: 'refactor.rewrite'
1323
- *
1324
- * Example rewrite actions:
1325
- *
1326
- * - Convert JavaScript function to class
1327
- * - Add or remove parameter
1328
- * - Encapsulate field
1329
- * - Make method static
1330
- * - Move method to base class
1331
- * - ...
1332
- */
1333
- CodeActionKind.RefactorRewrite = 'refactor.rewrite';
1334
- /**
1335
- * Base kind for source actions: `source`
1336
- *
1337
- * Source code actions apply to the entire file.
1338
- */
1339
- CodeActionKind.Source = 'source';
1340
- /**
1341
- * Base kind for an organize imports source action: `source.organizeImports`
1342
- */
1343
- CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
1344
- /**
1345
- * Base kind for auto-fix source actions: `source.fixAll`.
1346
- *
1347
- * Fix all actions automatically fix errors that have a clear fix that do not require user input.
1348
- * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
1349
- *
1350
- * @since 3.15.0
1351
- */
1352
- CodeActionKind.SourceFixAll = 'source.fixAll';
1353
- })(CodeActionKind = exports.CodeActionKind || (exports.CodeActionKind = {}));
1354
- /**
1355
- * The CodeActionContext namespace provides helper functions to work with
1356
- * [CodeActionContext](#CodeActionContext) literals.
1357
- */
1358
- var CodeActionContext;
1359
- (function (CodeActionContext) {
1360
- /**
1361
- * Creates a new CodeActionContext literal.
1362
- */
1363
- function create(diagnostics, only) {
1364
- var result = { diagnostics: diagnostics };
1365
- if (only !== void 0 && only !== null) {
1366
- result.only = only;
1367
- }
1368
- return result;
1369
- }
1370
- CodeActionContext.create = create;
1371
- /**
1372
- * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
1373
- */
1374
- function is(value) {
1375
- var candidate = value;
1376
- return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
1377
- }
1378
- CodeActionContext.is = is;
1379
- })(CodeActionContext = exports.CodeActionContext || (exports.CodeActionContext = {}));
1380
- var CodeAction;
1381
- (function (CodeAction) {
1382
- function create(title, commandOrEdit, kind) {
1383
- var result = { title: title };
1384
- if (Command.is(commandOrEdit)) {
1385
- result.command = commandOrEdit;
1386
- }
1387
- else {
1388
- result.edit = commandOrEdit;
1389
- }
1390
- if (kind !== void 0) {
1391
- result.kind = kind;
1392
- }
1393
- return result;
1394
- }
1395
- CodeAction.create = create;
1396
- function is(value) {
1397
- var candidate = value;
1398
- return candidate && Is.string(candidate.title) &&
1399
- (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
1400
- (candidate.kind === void 0 || Is.string(candidate.kind)) &&
1401
- (candidate.edit !== void 0 || candidate.command !== void 0) &&
1402
- (candidate.command === void 0 || Command.is(candidate.command)) &&
1403
- (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
1404
- (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
1405
- }
1406
- CodeAction.is = is;
1407
- })(CodeAction = exports.CodeAction || (exports.CodeAction = {}));
1408
- /**
1409
- * The CodeLens namespace provides helper functions to work with
1410
- * [CodeLens](#CodeLens) literals.
1411
- */
1412
- var CodeLens;
1413
- (function (CodeLens) {
1414
- /**
1415
- * Creates a new CodeLens literal.
1416
- */
1417
- function create(range, data) {
1418
- var result = { range: range };
1419
- if (Is.defined(data)) {
1420
- result.data = data;
1421
- }
1422
- return result;
1423
- }
1424
- CodeLens.create = create;
1425
- /**
1426
- * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
1427
- */
1428
- function is(value) {
1429
- var candidate = value;
1430
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
1431
- }
1432
- CodeLens.is = is;
1433
- })(CodeLens = exports.CodeLens || (exports.CodeLens = {}));
1434
- /**
1435
- * The FormattingOptions namespace provides helper functions to work with
1436
- * [FormattingOptions](#FormattingOptions) literals.
1437
- */
1438
- var FormattingOptions;
1439
- (function (FormattingOptions) {
1440
- /**
1441
- * Creates a new FormattingOptions literal.
1442
- */
1443
- function create(tabSize, insertSpaces) {
1444
- return { tabSize: tabSize, insertSpaces: insertSpaces };
1445
- }
1446
- FormattingOptions.create = create;
1447
- /**
1448
- * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
1449
- */
1450
- function is(value) {
1451
- var candidate = value;
1452
- return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
1453
- }
1454
- FormattingOptions.is = is;
1455
- })(FormattingOptions = exports.FormattingOptions || (exports.FormattingOptions = {}));
1456
- /**
1457
- * The DocumentLink namespace provides helper functions to work with
1458
- * [DocumentLink](#DocumentLink) literals.
1459
- */
1460
- var DocumentLink;
1461
- (function (DocumentLink) {
1462
- /**
1463
- * Creates a new DocumentLink literal.
1464
- */
1465
- function create(range, target, data) {
1466
- return { range: range, target: target, data: data };
1467
- }
1468
- DocumentLink.create = create;
1469
- /**
1470
- * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
1471
- */
1472
- function is(value) {
1473
- var candidate = value;
1474
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
1475
- }
1476
- DocumentLink.is = is;
1477
- })(DocumentLink = exports.DocumentLink || (exports.DocumentLink = {}));
1478
- /**
1479
- * The SelectionRange namespace provides helper function to work with
1480
- * SelectionRange literals.
1481
- */
1482
- var SelectionRange;
1483
- (function (SelectionRange) {
1484
- /**
1485
- * Creates a new SelectionRange
1486
- * @param range the range.
1487
- * @param parent an optional parent.
1488
- */
1489
- function create(range, parent) {
1490
- return { range: range, parent: parent };
1491
- }
1492
- SelectionRange.create = create;
1493
- function is(value) {
1494
- var candidate = value;
1495
- return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
1496
- }
1497
- SelectionRange.is = is;
1498
- })(SelectionRange = exports.SelectionRange || (exports.SelectionRange = {}));
1499
- exports.EOL = ['\n', '\r\n', '\r'];
1500
- /**
1501
- * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
1502
- */
1503
- var TextDocument;
1504
- (function (TextDocument) {
1505
- /**
1506
- * Creates a new ITextDocument literal from the given uri and content.
1507
- * @param uri The document's uri.
1508
- * @param languageId The document's language Id.
1509
- * @param content The document's content.
1510
- */
1511
- function create(uri, languageId, version, content) {
1512
- return new FullTextDocument(uri, languageId, version, content);
1513
- }
1514
- TextDocument.create = create;
1515
- /**
1516
- * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
1517
- */
1518
- function is(value) {
1519
- var candidate = value;
1520
- return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
1521
- && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
1522
- }
1523
- TextDocument.is = is;
1524
- function applyEdits(document, edits) {
1525
- var text = document.getText();
1526
- var sortedEdits = mergeSort(edits, function (a, b) {
1527
- var diff = a.range.start.line - b.range.start.line;
1528
- if (diff === 0) {
1529
- return a.range.start.character - b.range.start.character;
1530
- }
1531
- return diff;
1532
- });
1533
- var lastModifiedOffset = text.length;
1534
- for (var i = sortedEdits.length - 1; i >= 0; i--) {
1535
- var e = sortedEdits[i];
1536
- var startOffset = document.offsetAt(e.range.start);
1537
- var endOffset = document.offsetAt(e.range.end);
1538
- if (endOffset <= lastModifiedOffset) {
1539
- text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
1540
- }
1541
- else {
1542
- throw new Error('Overlapping edit');
1543
- }
1544
- lastModifiedOffset = startOffset;
1545
- }
1546
- return text;
1547
- }
1548
- TextDocument.applyEdits = applyEdits;
1549
- function mergeSort(data, compare) {
1550
- if (data.length <= 1) {
1551
- // sorted
1552
- return data;
1553
- }
1554
- var p = (data.length / 2) | 0;
1555
- var left = data.slice(0, p);
1556
- var right = data.slice(p);
1557
- mergeSort(left, compare);
1558
- mergeSort(right, compare);
1559
- var leftIdx = 0;
1560
- var rightIdx = 0;
1561
- var i = 0;
1562
- while (leftIdx < left.length && rightIdx < right.length) {
1563
- var ret = compare(left[leftIdx], right[rightIdx]);
1564
- if (ret <= 0) {
1565
- // smaller_equal -> take left to preserve order
1566
- data[i++] = left[leftIdx++];
1567
- }
1568
- else {
1569
- // greater -> take right
1570
- data[i++] = right[rightIdx++];
1571
- }
1572
- }
1573
- while (leftIdx < left.length) {
1574
- data[i++] = left[leftIdx++];
1575
- }
1576
- while (rightIdx < right.length) {
1577
- data[i++] = right[rightIdx++];
1578
- }
1579
- return data;
1580
- }
1581
- })(TextDocument = exports.TextDocument || (exports.TextDocument = {}));
1582
- var FullTextDocument = /** @class */ (function () {
1583
- function FullTextDocument(uri, languageId, version, content) {
1584
- this._uri = uri;
1585
- this._languageId = languageId;
1586
- this._version = version;
1587
- this._content = content;
1588
- this._lineOffsets = undefined;
1589
- }
1590
- Object.defineProperty(FullTextDocument.prototype, "uri", {
1591
- get: function () {
1592
- return this._uri;
1593
- },
1594
- enumerable: true,
1595
- configurable: true
1596
- });
1597
- Object.defineProperty(FullTextDocument.prototype, "languageId", {
1598
- get: function () {
1599
- return this._languageId;
1600
- },
1601
- enumerable: true,
1602
- configurable: true
1603
- });
1604
- Object.defineProperty(FullTextDocument.prototype, "version", {
1605
- get: function () {
1606
- return this._version;
1607
- },
1608
- enumerable: true,
1609
- configurable: true
1610
- });
1611
- FullTextDocument.prototype.getText = function (range) {
1612
- if (range) {
1613
- var start = this.offsetAt(range.start);
1614
- var end = this.offsetAt(range.end);
1615
- return this._content.substring(start, end);
1616
- }
1617
- return this._content;
1618
- };
1619
- FullTextDocument.prototype.update = function (event, version) {
1620
- this._content = event.text;
1621
- this._version = version;
1622
- this._lineOffsets = undefined;
1623
- };
1624
- FullTextDocument.prototype.getLineOffsets = function () {
1625
- if (this._lineOffsets === undefined) {
1626
- var lineOffsets = [];
1627
- var text = this._content;
1628
- var isLineStart = true;
1629
- for (var i = 0; i < text.length; i++) {
1630
- if (isLineStart) {
1631
- lineOffsets.push(i);
1632
- isLineStart = false;
1633
- }
1634
- var ch = text.charAt(i);
1635
- isLineStart = (ch === '\r' || ch === '\n');
1636
- if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
1637
- i++;
1638
- }
1639
- }
1640
- if (isLineStart && text.length > 0) {
1641
- lineOffsets.push(text.length);
1642
- }
1643
- this._lineOffsets = lineOffsets;
1644
- }
1645
- return this._lineOffsets;
1646
- };
1647
- FullTextDocument.prototype.positionAt = function (offset) {
1648
- offset = Math.max(Math.min(offset, this._content.length), 0);
1649
- var lineOffsets = this.getLineOffsets();
1650
- var low = 0, high = lineOffsets.length;
1651
- if (high === 0) {
1652
- return Position.create(0, offset);
1653
- }
1654
- while (low < high) {
1655
- var mid = Math.floor((low + high) / 2);
1656
- if (lineOffsets[mid] > offset) {
1657
- high = mid;
1658
- }
1659
- else {
1660
- low = mid + 1;
1661
- }
1662
- }
1663
- // low is the least x for which the line offset is larger than the current offset
1664
- // or array.length if no line offset is larger than the current offset
1665
- var line = low - 1;
1666
- return Position.create(line, offset - lineOffsets[line]);
1667
- };
1668
- FullTextDocument.prototype.offsetAt = function (position) {
1669
- var lineOffsets = this.getLineOffsets();
1670
- if (position.line >= lineOffsets.length) {
1671
- return this._content.length;
1672
- }
1673
- else if (position.line < 0) {
1674
- return 0;
1675
- }
1676
- var lineOffset = lineOffsets[position.line];
1677
- var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
1678
- return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
1679
- };
1680
- Object.defineProperty(FullTextDocument.prototype, "lineCount", {
1681
- get: function () {
1682
- return this.getLineOffsets().length;
1683
- },
1684
- enumerable: true,
1685
- configurable: true
1686
- });
1687
- return FullTextDocument;
1688
- }());
1689
- var Is;
1690
- (function (Is) {
1691
- var toString = Object.prototype.toString;
1692
- function defined(value) {
1693
- return typeof value !== 'undefined';
1694
- }
1695
- Is.defined = defined;
1696
- function undefined(value) {
1697
- return typeof value === 'undefined';
1698
- }
1699
- Is.undefined = undefined;
1700
- function boolean(value) {
1701
- return value === true || value === false;
1702
- }
1703
- Is.boolean = boolean;
1704
- function string(value) {
1705
- return toString.call(value) === '[object String]';
1706
- }
1707
- Is.string = string;
1708
- function number(value) {
1709
- return toString.call(value) === '[object Number]';
1710
- }
1711
- Is.number = number;
1712
- function func(value) {
1713
- return toString.call(value) === '[object Function]';
1714
- }
1715
- Is.func = func;
1716
- function objectLiteral(value) {
1717
- // Strictly speaking class instances pass this check as well. Since the LSP
1718
- // doesn't use classes we ignore this for now. If we do we need to add something
1719
- // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
1720
- return value !== null && typeof value === 'object';
1721
- }
1722
- Is.objectLiteral = objectLiteral;
1723
- function typedArray(value, check) {
1724
- return Array.isArray(value) && value.every(check);
1725
- }
1726
- Is.typedArray = typedArray;
1727
- })(Is || (Is = {}));
1728
- });
1729
-
191
+ (function (factory) {
192
+ if (typeof module === "object" && typeof module.exports === "object") {
193
+ var v = factory(require, exports);
194
+ if (v !== undefined) module.exports = v;
195
+ }
196
+ else if (typeof define === "function" && define.amd) {
197
+ define('vscode-languageserver-types/main',["require", "exports"], factory);
198
+ }
199
+ })(function (require, exports) {
200
+ /* --------------------------------------------------------------------------------------------
201
+ * Copyright (c) Microsoft Corporation. All rights reserved.
202
+ * Licensed under the MIT License. See License.txt in the project root for license information.
203
+ * ------------------------------------------------------------------------------------------ */
204
+ 'use strict';
205
+ Object.defineProperty(exports, "__esModule", { value: true });
206
+ 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;
207
+ var integer;
208
+ (function (integer) {
209
+ integer.MIN_VALUE = -2147483648;
210
+ integer.MAX_VALUE = 2147483647;
211
+ })(integer = exports.integer || (exports.integer = {}));
212
+ var uinteger;
213
+ (function (uinteger) {
214
+ uinteger.MIN_VALUE = 0;
215
+ uinteger.MAX_VALUE = 2147483647;
216
+ })(uinteger = exports.uinteger || (exports.uinteger = {}));
217
+ /**
218
+ * The Position namespace provides helper functions to work with
219
+ * [Position](#Position) literals.
220
+ */
221
+ var Position;
222
+ (function (Position) {
223
+ /**
224
+ * Creates a new Position literal from the given line and character.
225
+ * @param line The position's line.
226
+ * @param character The position's character.
227
+ */
228
+ function create(line, character) {
229
+ if (line === Number.MAX_VALUE) {
230
+ line = uinteger.MAX_VALUE;
231
+ }
232
+ if (character === Number.MAX_VALUE) {
233
+ character = uinteger.MAX_VALUE;
234
+ }
235
+ return { line: line, character: character };
236
+ }
237
+ Position.create = create;
238
+ /**
239
+ * Checks whether the given literal conforms to the [Position](#Position) interface.
240
+ */
241
+ function is(value) {
242
+ var candidate = value;
243
+ return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
244
+ }
245
+ Position.is = is;
246
+ })(Position = exports.Position || (exports.Position = {}));
247
+ /**
248
+ * The Range namespace provides helper functions to work with
249
+ * [Range](#Range) literals.
250
+ */
251
+ var Range;
252
+ (function (Range) {
253
+ function create(one, two, three, four) {
254
+ if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
255
+ return { start: Position.create(one, two), end: Position.create(three, four) };
256
+ }
257
+ else if (Position.is(one) && Position.is(two)) {
258
+ return { start: one, end: two };
259
+ }
260
+ else {
261
+ throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
262
+ }
263
+ }
264
+ Range.create = create;
265
+ /**
266
+ * Checks whether the given literal conforms to the [Range](#Range) interface.
267
+ */
268
+ function is(value) {
269
+ var candidate = value;
270
+ return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
271
+ }
272
+ Range.is = is;
273
+ })(Range = exports.Range || (exports.Range = {}));
274
+ /**
275
+ * The Location namespace provides helper functions to work with
276
+ * [Location](#Location) literals.
277
+ */
278
+ var Location;
279
+ (function (Location) {
280
+ /**
281
+ * Creates a Location literal.
282
+ * @param uri The location's uri.
283
+ * @param range The location's range.
284
+ */
285
+ function create(uri, range) {
286
+ return { uri: uri, range: range };
287
+ }
288
+ Location.create = create;
289
+ /**
290
+ * Checks whether the given literal conforms to the [Location](#Location) interface.
291
+ */
292
+ function is(value) {
293
+ var candidate = value;
294
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
295
+ }
296
+ Location.is = is;
297
+ })(Location = exports.Location || (exports.Location = {}));
298
+ /**
299
+ * The LocationLink namespace provides helper functions to work with
300
+ * [LocationLink](#LocationLink) literals.
301
+ */
302
+ var LocationLink;
303
+ (function (LocationLink) {
304
+ /**
305
+ * Creates a LocationLink literal.
306
+ * @param targetUri The definition's uri.
307
+ * @param targetRange The full range of the definition.
308
+ * @param targetSelectionRange The span of the symbol definition at the target.
309
+ * @param originSelectionRange The span of the symbol being defined in the originating source file.
310
+ */
311
+ function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
312
+ return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
313
+ }
314
+ LocationLink.create = create;
315
+ /**
316
+ * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
317
+ */
318
+ function is(value) {
319
+ var candidate = value;
320
+ return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
321
+ && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
322
+ && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
323
+ }
324
+ LocationLink.is = is;
325
+ })(LocationLink = exports.LocationLink || (exports.LocationLink = {}));
326
+ /**
327
+ * The Color namespace provides helper functions to work with
328
+ * [Color](#Color) literals.
329
+ */
330
+ var Color;
331
+ (function (Color) {
332
+ /**
333
+ * Creates a new Color literal.
334
+ */
335
+ function create(red, green, blue, alpha) {
336
+ return {
337
+ red: red,
338
+ green: green,
339
+ blue: blue,
340
+ alpha: alpha,
341
+ };
342
+ }
343
+ Color.create = create;
344
+ /**
345
+ * Checks whether the given literal conforms to the [Color](#Color) interface.
346
+ */
347
+ function is(value) {
348
+ var candidate = value;
349
+ return Is.numberRange(candidate.red, 0, 1)
350
+ && Is.numberRange(candidate.green, 0, 1)
351
+ && Is.numberRange(candidate.blue, 0, 1)
352
+ && Is.numberRange(candidate.alpha, 0, 1);
353
+ }
354
+ Color.is = is;
355
+ })(Color = exports.Color || (exports.Color = {}));
356
+ /**
357
+ * The ColorInformation namespace provides helper functions to work with
358
+ * [ColorInformation](#ColorInformation) literals.
359
+ */
360
+ var ColorInformation;
361
+ (function (ColorInformation) {
362
+ /**
363
+ * Creates a new ColorInformation literal.
364
+ */
365
+ function create(range, color) {
366
+ return {
367
+ range: range,
368
+ color: color,
369
+ };
370
+ }
371
+ ColorInformation.create = create;
372
+ /**
373
+ * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
374
+ */
375
+ function is(value) {
376
+ var candidate = value;
377
+ return Range.is(candidate.range) && Color.is(candidate.color);
378
+ }
379
+ ColorInformation.is = is;
380
+ })(ColorInformation = exports.ColorInformation || (exports.ColorInformation = {}));
381
+ /**
382
+ * The Color namespace provides helper functions to work with
383
+ * [ColorPresentation](#ColorPresentation) literals.
384
+ */
385
+ var ColorPresentation;
386
+ (function (ColorPresentation) {
387
+ /**
388
+ * Creates a new ColorInformation literal.
389
+ */
390
+ function create(label, textEdit, additionalTextEdits) {
391
+ return {
392
+ label: label,
393
+ textEdit: textEdit,
394
+ additionalTextEdits: additionalTextEdits,
395
+ };
396
+ }
397
+ ColorPresentation.create = create;
398
+ /**
399
+ * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
400
+ */
401
+ function is(value) {
402
+ var candidate = value;
403
+ return Is.string(candidate.label)
404
+ && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
405
+ && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
406
+ }
407
+ ColorPresentation.is = is;
408
+ })(ColorPresentation = exports.ColorPresentation || (exports.ColorPresentation = {}));
409
+ /**
410
+ * Enum of known range kinds
411
+ */
412
+ var FoldingRangeKind;
413
+ (function (FoldingRangeKind) {
414
+ /**
415
+ * Folding range for a comment
416
+ */
417
+ FoldingRangeKind["Comment"] = "comment";
418
+ /**
419
+ * Folding range for a imports or includes
420
+ */
421
+ FoldingRangeKind["Imports"] = "imports";
422
+ /**
423
+ * Folding range for a region (e.g. `#region`)
424
+ */
425
+ FoldingRangeKind["Region"] = "region";
426
+ })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
427
+ /**
428
+ * The folding range namespace provides helper functions to work with
429
+ * [FoldingRange](#FoldingRange) literals.
430
+ */
431
+ var FoldingRange;
432
+ (function (FoldingRange) {
433
+ /**
434
+ * Creates a new FoldingRange literal.
435
+ */
436
+ function create(startLine, endLine, startCharacter, endCharacter, kind) {
437
+ var result = {
438
+ startLine: startLine,
439
+ endLine: endLine
440
+ };
441
+ if (Is.defined(startCharacter)) {
442
+ result.startCharacter = startCharacter;
443
+ }
444
+ if (Is.defined(endCharacter)) {
445
+ result.endCharacter = endCharacter;
446
+ }
447
+ if (Is.defined(kind)) {
448
+ result.kind = kind;
449
+ }
450
+ return result;
451
+ }
452
+ FoldingRange.create = create;
453
+ /**
454
+ * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
455
+ */
456
+ function is(value) {
457
+ var candidate = value;
458
+ return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
459
+ && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
460
+ && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
461
+ && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
462
+ }
463
+ FoldingRange.is = is;
464
+ })(FoldingRange = exports.FoldingRange || (exports.FoldingRange = {}));
465
+ /**
466
+ * The DiagnosticRelatedInformation namespace provides helper functions to work with
467
+ * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
468
+ */
469
+ var DiagnosticRelatedInformation;
470
+ (function (DiagnosticRelatedInformation) {
471
+ /**
472
+ * Creates a new DiagnosticRelatedInformation literal.
473
+ */
474
+ function create(location, message) {
475
+ return {
476
+ location: location,
477
+ message: message
478
+ };
479
+ }
480
+ DiagnosticRelatedInformation.create = create;
481
+ /**
482
+ * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
483
+ */
484
+ function is(value) {
485
+ var candidate = value;
486
+ return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
487
+ }
488
+ DiagnosticRelatedInformation.is = is;
489
+ })(DiagnosticRelatedInformation = exports.DiagnosticRelatedInformation || (exports.DiagnosticRelatedInformation = {}));
490
+ /**
491
+ * The diagnostic's severity.
492
+ */
493
+ var DiagnosticSeverity;
494
+ (function (DiagnosticSeverity) {
495
+ /**
496
+ * Reports an error.
497
+ */
498
+ DiagnosticSeverity.Error = 1;
499
+ /**
500
+ * Reports a warning.
501
+ */
502
+ DiagnosticSeverity.Warning = 2;
503
+ /**
504
+ * Reports an information.
505
+ */
506
+ DiagnosticSeverity.Information = 3;
507
+ /**
508
+ * Reports a hint.
509
+ */
510
+ DiagnosticSeverity.Hint = 4;
511
+ })(DiagnosticSeverity = exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {}));
512
+ /**
513
+ * The diagnostic tags.
514
+ *
515
+ * @since 3.15.0
516
+ */
517
+ var DiagnosticTag;
518
+ (function (DiagnosticTag) {
519
+ /**
520
+ * Unused or unnecessary code.
521
+ *
522
+ * Clients are allowed to render diagnostics with this tag faded out instead of having
523
+ * an error squiggle.
524
+ */
525
+ DiagnosticTag.Unnecessary = 1;
526
+ /**
527
+ * Deprecated or obsolete code.
528
+ *
529
+ * Clients are allowed to rendered diagnostics with this tag strike through.
530
+ */
531
+ DiagnosticTag.Deprecated = 2;
532
+ })(DiagnosticTag = exports.DiagnosticTag || (exports.DiagnosticTag = {}));
533
+ /**
534
+ * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
535
+ *
536
+ * @since 3.16.0
537
+ */
538
+ var CodeDescription;
539
+ (function (CodeDescription) {
540
+ function is(value) {
541
+ var candidate = value;
542
+ return candidate !== undefined && candidate !== null && Is.string(candidate.href);
543
+ }
544
+ CodeDescription.is = is;
545
+ })(CodeDescription = exports.CodeDescription || (exports.CodeDescription = {}));
546
+ /**
547
+ * The Diagnostic namespace provides helper functions to work with
548
+ * [Diagnostic](#Diagnostic) literals.
549
+ */
550
+ var Diagnostic;
551
+ (function (Diagnostic) {
552
+ /**
553
+ * Creates a new Diagnostic literal.
554
+ */
555
+ function create(range, message, severity, code, source, relatedInformation) {
556
+ var result = { range: range, message: message };
557
+ if (Is.defined(severity)) {
558
+ result.severity = severity;
559
+ }
560
+ if (Is.defined(code)) {
561
+ result.code = code;
562
+ }
563
+ if (Is.defined(source)) {
564
+ result.source = source;
565
+ }
566
+ if (Is.defined(relatedInformation)) {
567
+ result.relatedInformation = relatedInformation;
568
+ }
569
+ return result;
570
+ }
571
+ Diagnostic.create = create;
572
+ /**
573
+ * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
574
+ */
575
+ function is(value) {
576
+ var _a;
577
+ var candidate = value;
578
+ return Is.defined(candidate)
579
+ && Range.is(candidate.range)
580
+ && Is.string(candidate.message)
581
+ && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
582
+ && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
583
+ && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
584
+ && (Is.string(candidate.source) || Is.undefined(candidate.source))
585
+ && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
586
+ }
587
+ Diagnostic.is = is;
588
+ })(Diagnostic = exports.Diagnostic || (exports.Diagnostic = {}));
589
+ /**
590
+ * The Command namespace provides helper functions to work with
591
+ * [Command](#Command) literals.
592
+ */
593
+ var Command;
594
+ (function (Command) {
595
+ /**
596
+ * Creates a new Command literal.
597
+ */
598
+ function create(title, command) {
599
+ var args = [];
600
+ for (var _i = 2; _i < arguments.length; _i++) {
601
+ args[_i - 2] = arguments[_i];
602
+ }
603
+ var result = { title: title, command: command };
604
+ if (Is.defined(args) && args.length > 0) {
605
+ result.arguments = args;
606
+ }
607
+ return result;
608
+ }
609
+ Command.create = create;
610
+ /**
611
+ * Checks whether the given literal conforms to the [Command](#Command) interface.
612
+ */
613
+ function is(value) {
614
+ var candidate = value;
615
+ return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
616
+ }
617
+ Command.is = is;
618
+ })(Command = exports.Command || (exports.Command = {}));
619
+ /**
620
+ * The TextEdit namespace provides helper function to create replace,
621
+ * insert and delete edits more easily.
622
+ */
623
+ var TextEdit;
624
+ (function (TextEdit) {
625
+ /**
626
+ * Creates a replace text edit.
627
+ * @param range The range of text to be replaced.
628
+ * @param newText The new text.
629
+ */
630
+ function replace(range, newText) {
631
+ return { range: range, newText: newText };
632
+ }
633
+ TextEdit.replace = replace;
634
+ /**
635
+ * Creates a insert text edit.
636
+ * @param position The position to insert the text at.
637
+ * @param newText The text to be inserted.
638
+ */
639
+ function insert(position, newText) {
640
+ return { range: { start: position, end: position }, newText: newText };
641
+ }
642
+ TextEdit.insert = insert;
643
+ /**
644
+ * Creates a delete text edit.
645
+ * @param range The range of text to be deleted.
646
+ */
647
+ function del(range) {
648
+ return { range: range, newText: '' };
649
+ }
650
+ TextEdit.del = del;
651
+ function is(value) {
652
+ var candidate = value;
653
+ return Is.objectLiteral(candidate)
654
+ && Is.string(candidate.newText)
655
+ && Range.is(candidate.range);
656
+ }
657
+ TextEdit.is = is;
658
+ })(TextEdit = exports.TextEdit || (exports.TextEdit = {}));
659
+ var ChangeAnnotation;
660
+ (function (ChangeAnnotation) {
661
+ function create(label, needsConfirmation, description) {
662
+ var result = { label: label };
663
+ if (needsConfirmation !== undefined) {
664
+ result.needsConfirmation = needsConfirmation;
665
+ }
666
+ if (description !== undefined) {
667
+ result.description = description;
668
+ }
669
+ return result;
670
+ }
671
+ ChangeAnnotation.create = create;
672
+ function is(value) {
673
+ var candidate = value;
674
+ return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
675
+ (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
676
+ (Is.string(candidate.description) || candidate.description === undefined);
677
+ }
678
+ ChangeAnnotation.is = is;
679
+ })(ChangeAnnotation = exports.ChangeAnnotation || (exports.ChangeAnnotation = {}));
680
+ var ChangeAnnotationIdentifier;
681
+ (function (ChangeAnnotationIdentifier) {
682
+ function is(value) {
683
+ var candidate = value;
684
+ return typeof candidate === 'string';
685
+ }
686
+ ChangeAnnotationIdentifier.is = is;
687
+ })(ChangeAnnotationIdentifier = exports.ChangeAnnotationIdentifier || (exports.ChangeAnnotationIdentifier = {}));
688
+ var AnnotatedTextEdit;
689
+ (function (AnnotatedTextEdit) {
690
+ /**
691
+ * Creates an annotated replace text edit.
692
+ *
693
+ * @param range The range of text to be replaced.
694
+ * @param newText The new text.
695
+ * @param annotation The annotation.
696
+ */
697
+ function replace(range, newText, annotation) {
698
+ return { range: range, newText: newText, annotationId: annotation };
699
+ }
700
+ AnnotatedTextEdit.replace = replace;
701
+ /**
702
+ * Creates an annotated insert text edit.
703
+ *
704
+ * @param position The position to insert the text at.
705
+ * @param newText The text to be inserted.
706
+ * @param annotation The annotation.
707
+ */
708
+ function insert(position, newText, annotation) {
709
+ return { range: { start: position, end: position }, newText: newText, annotationId: annotation };
710
+ }
711
+ AnnotatedTextEdit.insert = insert;
712
+ /**
713
+ * Creates an annotated delete text edit.
714
+ *
715
+ * @param range The range of text to be deleted.
716
+ * @param annotation The annotation.
717
+ */
718
+ function del(range, annotation) {
719
+ return { range: range, newText: '', annotationId: annotation };
720
+ }
721
+ AnnotatedTextEdit.del = del;
722
+ function is(value) {
723
+ var candidate = value;
724
+ return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
725
+ }
726
+ AnnotatedTextEdit.is = is;
727
+ })(AnnotatedTextEdit = exports.AnnotatedTextEdit || (exports.AnnotatedTextEdit = {}));
728
+ /**
729
+ * The TextDocumentEdit namespace provides helper function to create
730
+ * an edit that manipulates a text document.
731
+ */
732
+ var TextDocumentEdit;
733
+ (function (TextDocumentEdit) {
734
+ /**
735
+ * Creates a new `TextDocumentEdit`
736
+ */
737
+ function create(textDocument, edits) {
738
+ return { textDocument: textDocument, edits: edits };
739
+ }
740
+ TextDocumentEdit.create = create;
741
+ function is(value) {
742
+ var candidate = value;
743
+ return Is.defined(candidate)
744
+ && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
745
+ && Array.isArray(candidate.edits);
746
+ }
747
+ TextDocumentEdit.is = is;
748
+ })(TextDocumentEdit = exports.TextDocumentEdit || (exports.TextDocumentEdit = {}));
749
+ var CreateFile;
750
+ (function (CreateFile) {
751
+ function create(uri, options, annotation) {
752
+ var result = {
753
+ kind: 'create',
754
+ uri: uri
755
+ };
756
+ if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
757
+ result.options = options;
758
+ }
759
+ if (annotation !== undefined) {
760
+ result.annotationId = annotation;
761
+ }
762
+ return result;
763
+ }
764
+ CreateFile.create = create;
765
+ function is(value) {
766
+ var candidate = value;
767
+ return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
768
+ ((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));
769
+ }
770
+ CreateFile.is = is;
771
+ })(CreateFile = exports.CreateFile || (exports.CreateFile = {}));
772
+ var RenameFile;
773
+ (function (RenameFile) {
774
+ function create(oldUri, newUri, options, annotation) {
775
+ var result = {
776
+ kind: 'rename',
777
+ oldUri: oldUri,
778
+ newUri: newUri
779
+ };
780
+ if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
781
+ result.options = options;
782
+ }
783
+ if (annotation !== undefined) {
784
+ result.annotationId = annotation;
785
+ }
786
+ return result;
787
+ }
788
+ RenameFile.create = create;
789
+ function is(value) {
790
+ var candidate = value;
791
+ return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
792
+ ((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));
793
+ }
794
+ RenameFile.is = is;
795
+ })(RenameFile = exports.RenameFile || (exports.RenameFile = {}));
796
+ var DeleteFile;
797
+ (function (DeleteFile) {
798
+ function create(uri, options, annotation) {
799
+ var result = {
800
+ kind: 'delete',
801
+ uri: uri
802
+ };
803
+ if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
804
+ result.options = options;
805
+ }
806
+ if (annotation !== undefined) {
807
+ result.annotationId = annotation;
808
+ }
809
+ return result;
810
+ }
811
+ DeleteFile.create = create;
812
+ function is(value) {
813
+ var candidate = value;
814
+ return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
815
+ ((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));
816
+ }
817
+ DeleteFile.is = is;
818
+ })(DeleteFile = exports.DeleteFile || (exports.DeleteFile = {}));
819
+ var WorkspaceEdit;
820
+ (function (WorkspaceEdit) {
821
+ function is(value) {
822
+ var candidate = value;
823
+ return candidate &&
824
+ (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
825
+ (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
826
+ if (Is.string(change.kind)) {
827
+ return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
828
+ }
829
+ else {
830
+ return TextDocumentEdit.is(change);
831
+ }
832
+ }));
833
+ }
834
+ WorkspaceEdit.is = is;
835
+ })(WorkspaceEdit = exports.WorkspaceEdit || (exports.WorkspaceEdit = {}));
836
+ var TextEditChangeImpl = /** @class */ (function () {
837
+ function TextEditChangeImpl(edits, changeAnnotations) {
838
+ this.edits = edits;
839
+ this.changeAnnotations = changeAnnotations;
840
+ }
841
+ TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
842
+ var edit;
843
+ var id;
844
+ if (annotation === undefined) {
845
+ edit = TextEdit.insert(position, newText);
846
+ }
847
+ else if (ChangeAnnotationIdentifier.is(annotation)) {
848
+ id = annotation;
849
+ edit = AnnotatedTextEdit.insert(position, newText, annotation);
850
+ }
851
+ else {
852
+ this.assertChangeAnnotations(this.changeAnnotations);
853
+ id = this.changeAnnotations.manage(annotation);
854
+ edit = AnnotatedTextEdit.insert(position, newText, id);
855
+ }
856
+ this.edits.push(edit);
857
+ if (id !== undefined) {
858
+ return id;
859
+ }
860
+ };
861
+ TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
862
+ var edit;
863
+ var id;
864
+ if (annotation === undefined) {
865
+ edit = TextEdit.replace(range, newText);
866
+ }
867
+ else if (ChangeAnnotationIdentifier.is(annotation)) {
868
+ id = annotation;
869
+ edit = AnnotatedTextEdit.replace(range, newText, annotation);
870
+ }
871
+ else {
872
+ this.assertChangeAnnotations(this.changeAnnotations);
873
+ id = this.changeAnnotations.manage(annotation);
874
+ edit = AnnotatedTextEdit.replace(range, newText, id);
875
+ }
876
+ this.edits.push(edit);
877
+ if (id !== undefined) {
878
+ return id;
879
+ }
880
+ };
881
+ TextEditChangeImpl.prototype.delete = function (range, annotation) {
882
+ var edit;
883
+ var id;
884
+ if (annotation === undefined) {
885
+ edit = TextEdit.del(range);
886
+ }
887
+ else if (ChangeAnnotationIdentifier.is(annotation)) {
888
+ id = annotation;
889
+ edit = AnnotatedTextEdit.del(range, annotation);
890
+ }
891
+ else {
892
+ this.assertChangeAnnotations(this.changeAnnotations);
893
+ id = this.changeAnnotations.manage(annotation);
894
+ edit = AnnotatedTextEdit.del(range, id);
895
+ }
896
+ this.edits.push(edit);
897
+ if (id !== undefined) {
898
+ return id;
899
+ }
900
+ };
901
+ TextEditChangeImpl.prototype.add = function (edit) {
902
+ this.edits.push(edit);
903
+ };
904
+ TextEditChangeImpl.prototype.all = function () {
905
+ return this.edits;
906
+ };
907
+ TextEditChangeImpl.prototype.clear = function () {
908
+ this.edits.splice(0, this.edits.length);
909
+ };
910
+ TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
911
+ if (value === undefined) {
912
+ throw new Error("Text edit change is not configured to manage change annotations.");
913
+ }
914
+ };
915
+ return TextEditChangeImpl;
916
+ }());
917
+ /**
918
+ * A helper class
919
+ */
920
+ var ChangeAnnotations = /** @class */ (function () {
921
+ function ChangeAnnotations(annotations) {
922
+ this._annotations = annotations === undefined ? Object.create(null) : annotations;
923
+ this._counter = 0;
924
+ this._size = 0;
925
+ }
926
+ ChangeAnnotations.prototype.all = function () {
927
+ return this._annotations;
928
+ };
929
+ Object.defineProperty(ChangeAnnotations.prototype, "size", {
930
+ get: function () {
931
+ return this._size;
932
+ },
933
+ enumerable: false,
934
+ configurable: true
935
+ });
936
+ ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
937
+ var id;
938
+ if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
939
+ id = idOrAnnotation;
940
+ }
941
+ else {
942
+ id = this.nextId();
943
+ annotation = idOrAnnotation;
944
+ }
945
+ if (this._annotations[id] !== undefined) {
946
+ throw new Error("Id " + id + " is already in use.");
947
+ }
948
+ if (annotation === undefined) {
949
+ throw new Error("No annotation provided for id " + id);
950
+ }
951
+ this._annotations[id] = annotation;
952
+ this._size++;
953
+ return id;
954
+ };
955
+ ChangeAnnotations.prototype.nextId = function () {
956
+ this._counter++;
957
+ return this._counter.toString();
958
+ };
959
+ return ChangeAnnotations;
960
+ }());
961
+ /**
962
+ * A workspace change helps constructing changes to a workspace.
963
+ */
964
+ var WorkspaceChange = /** @class */ (function () {
965
+ function WorkspaceChange(workspaceEdit) {
966
+ var _this = this;
967
+ this._textEditChanges = Object.create(null);
968
+ if (workspaceEdit !== undefined) {
969
+ this._workspaceEdit = workspaceEdit;
970
+ if (workspaceEdit.documentChanges) {
971
+ this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
972
+ workspaceEdit.changeAnnotations = this._changeAnnotations.all();
973
+ workspaceEdit.documentChanges.forEach(function (change) {
974
+ if (TextDocumentEdit.is(change)) {
975
+ var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
976
+ _this._textEditChanges[change.textDocument.uri] = textEditChange;
977
+ }
978
+ });
979
+ }
980
+ else if (workspaceEdit.changes) {
981
+ Object.keys(workspaceEdit.changes).forEach(function (key) {
982
+ var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
983
+ _this._textEditChanges[key] = textEditChange;
984
+ });
985
+ }
986
+ }
987
+ else {
988
+ this._workspaceEdit = {};
989
+ }
990
+ }
991
+ Object.defineProperty(WorkspaceChange.prototype, "edit", {
992
+ /**
993
+ * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
994
+ * use to be returned from a workspace edit operation like rename.
995
+ */
996
+ get: function () {
997
+ this.initDocumentChanges();
998
+ if (this._changeAnnotations !== undefined) {
999
+ if (this._changeAnnotations.size === 0) {
1000
+ this._workspaceEdit.changeAnnotations = undefined;
1001
+ }
1002
+ else {
1003
+ this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
1004
+ }
1005
+ }
1006
+ return this._workspaceEdit;
1007
+ },
1008
+ enumerable: false,
1009
+ configurable: true
1010
+ });
1011
+ WorkspaceChange.prototype.getTextEditChange = function (key) {
1012
+ if (OptionalVersionedTextDocumentIdentifier.is(key)) {
1013
+ this.initDocumentChanges();
1014
+ if (this._workspaceEdit.documentChanges === undefined) {
1015
+ throw new Error('Workspace edit is not configured for document changes.');
1016
+ }
1017
+ var textDocument = { uri: key.uri, version: key.version };
1018
+ var result = this._textEditChanges[textDocument.uri];
1019
+ if (!result) {
1020
+ var edits = [];
1021
+ var textDocumentEdit = {
1022
+ textDocument: textDocument,
1023
+ edits: edits
1024
+ };
1025
+ this._workspaceEdit.documentChanges.push(textDocumentEdit);
1026
+ result = new TextEditChangeImpl(edits, this._changeAnnotations);
1027
+ this._textEditChanges[textDocument.uri] = result;
1028
+ }
1029
+ return result;
1030
+ }
1031
+ else {
1032
+ this.initChanges();
1033
+ if (this._workspaceEdit.changes === undefined) {
1034
+ throw new Error('Workspace edit is not configured for normal text edit changes.');
1035
+ }
1036
+ var result = this._textEditChanges[key];
1037
+ if (!result) {
1038
+ var edits = [];
1039
+ this._workspaceEdit.changes[key] = edits;
1040
+ result = new TextEditChangeImpl(edits);
1041
+ this._textEditChanges[key] = result;
1042
+ }
1043
+ return result;
1044
+ }
1045
+ };
1046
+ WorkspaceChange.prototype.initDocumentChanges = function () {
1047
+ if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
1048
+ this._changeAnnotations = new ChangeAnnotations();
1049
+ this._workspaceEdit.documentChanges = [];
1050
+ this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
1051
+ }
1052
+ };
1053
+ WorkspaceChange.prototype.initChanges = function () {
1054
+ if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
1055
+ this._workspaceEdit.changes = Object.create(null);
1056
+ }
1057
+ };
1058
+ WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
1059
+ this.initDocumentChanges();
1060
+ if (this._workspaceEdit.documentChanges === undefined) {
1061
+ throw new Error('Workspace edit is not configured for document changes.');
1062
+ }
1063
+ var annotation;
1064
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
1065
+ annotation = optionsOrAnnotation;
1066
+ }
1067
+ else {
1068
+ options = optionsOrAnnotation;
1069
+ }
1070
+ var operation;
1071
+ var id;
1072
+ if (annotation === undefined) {
1073
+ operation = CreateFile.create(uri, options);
1074
+ }
1075
+ else {
1076
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
1077
+ operation = CreateFile.create(uri, options, id);
1078
+ }
1079
+ this._workspaceEdit.documentChanges.push(operation);
1080
+ if (id !== undefined) {
1081
+ return id;
1082
+ }
1083
+ };
1084
+ WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
1085
+ this.initDocumentChanges();
1086
+ if (this._workspaceEdit.documentChanges === undefined) {
1087
+ throw new Error('Workspace edit is not configured for document changes.');
1088
+ }
1089
+ var annotation;
1090
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
1091
+ annotation = optionsOrAnnotation;
1092
+ }
1093
+ else {
1094
+ options = optionsOrAnnotation;
1095
+ }
1096
+ var operation;
1097
+ var id;
1098
+ if (annotation === undefined) {
1099
+ operation = RenameFile.create(oldUri, newUri, options);
1100
+ }
1101
+ else {
1102
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
1103
+ operation = RenameFile.create(oldUri, newUri, options, id);
1104
+ }
1105
+ this._workspaceEdit.documentChanges.push(operation);
1106
+ if (id !== undefined) {
1107
+ return id;
1108
+ }
1109
+ };
1110
+ WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
1111
+ this.initDocumentChanges();
1112
+ if (this._workspaceEdit.documentChanges === undefined) {
1113
+ throw new Error('Workspace edit is not configured for document changes.');
1114
+ }
1115
+ var annotation;
1116
+ if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
1117
+ annotation = optionsOrAnnotation;
1118
+ }
1119
+ else {
1120
+ options = optionsOrAnnotation;
1121
+ }
1122
+ var operation;
1123
+ var id;
1124
+ if (annotation === undefined) {
1125
+ operation = DeleteFile.create(uri, options);
1126
+ }
1127
+ else {
1128
+ id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
1129
+ operation = DeleteFile.create(uri, options, id);
1130
+ }
1131
+ this._workspaceEdit.documentChanges.push(operation);
1132
+ if (id !== undefined) {
1133
+ return id;
1134
+ }
1135
+ };
1136
+ return WorkspaceChange;
1137
+ }());
1138
+ exports.WorkspaceChange = WorkspaceChange;
1139
+ /**
1140
+ * The TextDocumentIdentifier namespace provides helper functions to work with
1141
+ * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
1142
+ */
1143
+ var TextDocumentIdentifier;
1144
+ (function (TextDocumentIdentifier) {
1145
+ /**
1146
+ * Creates a new TextDocumentIdentifier literal.
1147
+ * @param uri The document's uri.
1148
+ */
1149
+ function create(uri) {
1150
+ return { uri: uri };
1151
+ }
1152
+ TextDocumentIdentifier.create = create;
1153
+ /**
1154
+ * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
1155
+ */
1156
+ function is(value) {
1157
+ var candidate = value;
1158
+ return Is.defined(candidate) && Is.string(candidate.uri);
1159
+ }
1160
+ TextDocumentIdentifier.is = is;
1161
+ })(TextDocumentIdentifier = exports.TextDocumentIdentifier || (exports.TextDocumentIdentifier = {}));
1162
+ /**
1163
+ * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
1164
+ * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
1165
+ */
1166
+ var VersionedTextDocumentIdentifier;
1167
+ (function (VersionedTextDocumentIdentifier) {
1168
+ /**
1169
+ * Creates a new VersionedTextDocumentIdentifier literal.
1170
+ * @param uri The document's uri.
1171
+ * @param uri The document's text.
1172
+ */
1173
+ function create(uri, version) {
1174
+ return { uri: uri, version: version };
1175
+ }
1176
+ VersionedTextDocumentIdentifier.create = create;
1177
+ /**
1178
+ * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
1179
+ */
1180
+ function is(value) {
1181
+ var candidate = value;
1182
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
1183
+ }
1184
+ VersionedTextDocumentIdentifier.is = is;
1185
+ })(VersionedTextDocumentIdentifier = exports.VersionedTextDocumentIdentifier || (exports.VersionedTextDocumentIdentifier = {}));
1186
+ /**
1187
+ * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
1188
+ * [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
1189
+ */
1190
+ var OptionalVersionedTextDocumentIdentifier;
1191
+ (function (OptionalVersionedTextDocumentIdentifier) {
1192
+ /**
1193
+ * Creates a new OptionalVersionedTextDocumentIdentifier literal.
1194
+ * @param uri The document's uri.
1195
+ * @param uri The document's text.
1196
+ */
1197
+ function create(uri, version) {
1198
+ return { uri: uri, version: version };
1199
+ }
1200
+ OptionalVersionedTextDocumentIdentifier.create = create;
1201
+ /**
1202
+ * Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
1203
+ */
1204
+ function is(value) {
1205
+ var candidate = value;
1206
+ return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
1207
+ }
1208
+ OptionalVersionedTextDocumentIdentifier.is = is;
1209
+ })(OptionalVersionedTextDocumentIdentifier = exports.OptionalVersionedTextDocumentIdentifier || (exports.OptionalVersionedTextDocumentIdentifier = {}));
1210
+ /**
1211
+ * The TextDocumentItem namespace provides helper functions to work with
1212
+ * [TextDocumentItem](#TextDocumentItem) literals.
1213
+ */
1214
+ var TextDocumentItem;
1215
+ (function (TextDocumentItem) {
1216
+ /**
1217
+ * Creates a new TextDocumentItem literal.
1218
+ * @param uri The document's uri.
1219
+ * @param languageId The document's language identifier.
1220
+ * @param version The document's version number.
1221
+ * @param text The document's text.
1222
+ */
1223
+ function create(uri, languageId, version, text) {
1224
+ return { uri: uri, languageId: languageId, version: version, text: text };
1225
+ }
1226
+ TextDocumentItem.create = create;
1227
+ /**
1228
+ * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
1229
+ */
1230
+ function is(value) {
1231
+ var candidate = value;
1232
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
1233
+ }
1234
+ TextDocumentItem.is = is;
1235
+ })(TextDocumentItem = exports.TextDocumentItem || (exports.TextDocumentItem = {}));
1236
+ /**
1237
+ * Describes the content type that a client supports in various
1238
+ * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
1239
+ *
1240
+ * Please note that `MarkupKinds` must not start with a `$`. This kinds
1241
+ * are reserved for internal usage.
1242
+ */
1243
+ var MarkupKind;
1244
+ (function (MarkupKind) {
1245
+ /**
1246
+ * Plain text is supported as a content format
1247
+ */
1248
+ MarkupKind.PlainText = 'plaintext';
1249
+ /**
1250
+ * Markdown is supported as a content format
1251
+ */
1252
+ MarkupKind.Markdown = 'markdown';
1253
+ })(MarkupKind = exports.MarkupKind || (exports.MarkupKind = {}));
1254
+ (function (MarkupKind) {
1255
+ /**
1256
+ * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
1257
+ */
1258
+ function is(value) {
1259
+ var candidate = value;
1260
+ return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
1261
+ }
1262
+ MarkupKind.is = is;
1263
+ })(MarkupKind = exports.MarkupKind || (exports.MarkupKind = {}));
1264
+ var MarkupContent;
1265
+ (function (MarkupContent) {
1266
+ /**
1267
+ * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
1268
+ */
1269
+ function is(value) {
1270
+ var candidate = value;
1271
+ return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
1272
+ }
1273
+ MarkupContent.is = is;
1274
+ })(MarkupContent = exports.MarkupContent || (exports.MarkupContent = {}));
1275
+ /**
1276
+ * The kind of a completion entry.
1277
+ */
1278
+ var CompletionItemKind;
1279
+ (function (CompletionItemKind) {
1280
+ CompletionItemKind.Text = 1;
1281
+ CompletionItemKind.Method = 2;
1282
+ CompletionItemKind.Function = 3;
1283
+ CompletionItemKind.Constructor = 4;
1284
+ CompletionItemKind.Field = 5;
1285
+ CompletionItemKind.Variable = 6;
1286
+ CompletionItemKind.Class = 7;
1287
+ CompletionItemKind.Interface = 8;
1288
+ CompletionItemKind.Module = 9;
1289
+ CompletionItemKind.Property = 10;
1290
+ CompletionItemKind.Unit = 11;
1291
+ CompletionItemKind.Value = 12;
1292
+ CompletionItemKind.Enum = 13;
1293
+ CompletionItemKind.Keyword = 14;
1294
+ CompletionItemKind.Snippet = 15;
1295
+ CompletionItemKind.Color = 16;
1296
+ CompletionItemKind.File = 17;
1297
+ CompletionItemKind.Reference = 18;
1298
+ CompletionItemKind.Folder = 19;
1299
+ CompletionItemKind.EnumMember = 20;
1300
+ CompletionItemKind.Constant = 21;
1301
+ CompletionItemKind.Struct = 22;
1302
+ CompletionItemKind.Event = 23;
1303
+ CompletionItemKind.Operator = 24;
1304
+ CompletionItemKind.TypeParameter = 25;
1305
+ })(CompletionItemKind = exports.CompletionItemKind || (exports.CompletionItemKind = {}));
1306
+ /**
1307
+ * Defines whether the insert text in a completion item should be interpreted as
1308
+ * plain text or a snippet.
1309
+ */
1310
+ var InsertTextFormat;
1311
+ (function (InsertTextFormat) {
1312
+ /**
1313
+ * The primary text to be inserted is treated as a plain string.
1314
+ */
1315
+ InsertTextFormat.PlainText = 1;
1316
+ /**
1317
+ * The primary text to be inserted is treated as a snippet.
1318
+ *
1319
+ * A snippet can define tab stops and placeholders with `$1`, `$2`
1320
+ * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
1321
+ * the end of the snippet. Placeholders with equal identifiers are linked,
1322
+ * that is typing in one will update others too.
1323
+ *
1324
+ * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
1325
+ */
1326
+ InsertTextFormat.Snippet = 2;
1327
+ })(InsertTextFormat = exports.InsertTextFormat || (exports.InsertTextFormat = {}));
1328
+ /**
1329
+ * Completion item tags are extra annotations that tweak the rendering of a completion
1330
+ * item.
1331
+ *
1332
+ * @since 3.15.0
1333
+ */
1334
+ var CompletionItemTag;
1335
+ (function (CompletionItemTag) {
1336
+ /**
1337
+ * Render a completion as obsolete, usually using a strike-out.
1338
+ */
1339
+ CompletionItemTag.Deprecated = 1;
1340
+ })(CompletionItemTag = exports.CompletionItemTag || (exports.CompletionItemTag = {}));
1341
+ /**
1342
+ * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
1343
+ *
1344
+ * @since 3.16.0
1345
+ */
1346
+ var InsertReplaceEdit;
1347
+ (function (InsertReplaceEdit) {
1348
+ /**
1349
+ * Creates a new insert / replace edit
1350
+ */
1351
+ function create(newText, insert, replace) {
1352
+ return { newText: newText, insert: insert, replace: replace };
1353
+ }
1354
+ InsertReplaceEdit.create = create;
1355
+ /**
1356
+ * Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
1357
+ */
1358
+ function is(value) {
1359
+ var candidate = value;
1360
+ return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
1361
+ }
1362
+ InsertReplaceEdit.is = is;
1363
+ })(InsertReplaceEdit = exports.InsertReplaceEdit || (exports.InsertReplaceEdit = {}));
1364
+ /**
1365
+ * How whitespace and indentation is handled during completion
1366
+ * item insertion.
1367
+ *
1368
+ * @since 3.16.0
1369
+ */
1370
+ var InsertTextMode;
1371
+ (function (InsertTextMode) {
1372
+ /**
1373
+ * The insertion or replace strings is taken as it is. If the
1374
+ * value is multi line the lines below the cursor will be
1375
+ * inserted using the indentation defined in the string value.
1376
+ * The client will not apply any kind of adjustments to the
1377
+ * string.
1378
+ */
1379
+ InsertTextMode.asIs = 1;
1380
+ /**
1381
+ * The editor adjusts leading whitespace of new lines so that
1382
+ * they match the indentation up to the cursor of the line for
1383
+ * which the item is accepted.
1384
+ *
1385
+ * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
1386
+ * multi line completion item is indented using 2 tabs and all
1387
+ * following lines inserted will be indented using 2 tabs as well.
1388
+ */
1389
+ InsertTextMode.adjustIndentation = 2;
1390
+ })(InsertTextMode = exports.InsertTextMode || (exports.InsertTextMode = {}));
1391
+ /**
1392
+ * The CompletionItem namespace provides functions to deal with
1393
+ * completion items.
1394
+ */
1395
+ var CompletionItem;
1396
+ (function (CompletionItem) {
1397
+ /**
1398
+ * Create a completion item and seed it with a label.
1399
+ * @param label The completion item's label
1400
+ */
1401
+ function create(label) {
1402
+ return { label: label };
1403
+ }
1404
+ CompletionItem.create = create;
1405
+ })(CompletionItem = exports.CompletionItem || (exports.CompletionItem = {}));
1406
+ /**
1407
+ * The CompletionList namespace provides functions to deal with
1408
+ * completion lists.
1409
+ */
1410
+ var CompletionList;
1411
+ (function (CompletionList) {
1412
+ /**
1413
+ * Creates a new completion list.
1414
+ *
1415
+ * @param items The completion items.
1416
+ * @param isIncomplete The list is not complete.
1417
+ */
1418
+ function create(items, isIncomplete) {
1419
+ return { items: items ? items : [], isIncomplete: !!isIncomplete };
1420
+ }
1421
+ CompletionList.create = create;
1422
+ })(CompletionList = exports.CompletionList || (exports.CompletionList = {}));
1423
+ var MarkedString;
1424
+ (function (MarkedString) {
1425
+ /**
1426
+ * Creates a marked string from plain text.
1427
+ *
1428
+ * @param plainText The plain text.
1429
+ */
1430
+ function fromPlainText(plainText) {
1431
+ return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
1432
+ }
1433
+ MarkedString.fromPlainText = fromPlainText;
1434
+ /**
1435
+ * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
1436
+ */
1437
+ function is(value) {
1438
+ var candidate = value;
1439
+ return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
1440
+ }
1441
+ MarkedString.is = is;
1442
+ })(MarkedString = exports.MarkedString || (exports.MarkedString = {}));
1443
+ var Hover;
1444
+ (function (Hover) {
1445
+ /**
1446
+ * Checks whether the given value conforms to the [Hover](#Hover) interface.
1447
+ */
1448
+ function is(value) {
1449
+ var candidate = value;
1450
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
1451
+ MarkedString.is(candidate.contents) ||
1452
+ Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
1453
+ }
1454
+ Hover.is = is;
1455
+ })(Hover = exports.Hover || (exports.Hover = {}));
1456
+ /**
1457
+ * The ParameterInformation namespace provides helper functions to work with
1458
+ * [ParameterInformation](#ParameterInformation) literals.
1459
+ */
1460
+ var ParameterInformation;
1461
+ (function (ParameterInformation) {
1462
+ /**
1463
+ * Creates a new parameter information literal.
1464
+ *
1465
+ * @param label A label string.
1466
+ * @param documentation A doc string.
1467
+ */
1468
+ function create(label, documentation) {
1469
+ return documentation ? { label: label, documentation: documentation } : { label: label };
1470
+ }
1471
+ ParameterInformation.create = create;
1472
+ })(ParameterInformation = exports.ParameterInformation || (exports.ParameterInformation = {}));
1473
+ /**
1474
+ * The SignatureInformation namespace provides helper functions to work with
1475
+ * [SignatureInformation](#SignatureInformation) literals.
1476
+ */
1477
+ var SignatureInformation;
1478
+ (function (SignatureInformation) {
1479
+ function create(label, documentation) {
1480
+ var parameters = [];
1481
+ for (var _i = 2; _i < arguments.length; _i++) {
1482
+ parameters[_i - 2] = arguments[_i];
1483
+ }
1484
+ var result = { label: label };
1485
+ if (Is.defined(documentation)) {
1486
+ result.documentation = documentation;
1487
+ }
1488
+ if (Is.defined(parameters)) {
1489
+ result.parameters = parameters;
1490
+ }
1491
+ else {
1492
+ result.parameters = [];
1493
+ }
1494
+ return result;
1495
+ }
1496
+ SignatureInformation.create = create;
1497
+ })(SignatureInformation = exports.SignatureInformation || (exports.SignatureInformation = {}));
1498
+ /**
1499
+ * A document highlight kind.
1500
+ */
1501
+ var DocumentHighlightKind;
1502
+ (function (DocumentHighlightKind) {
1503
+ /**
1504
+ * A textual occurrence.
1505
+ */
1506
+ DocumentHighlightKind.Text = 1;
1507
+ /**
1508
+ * Read-access of a symbol, like reading a variable.
1509
+ */
1510
+ DocumentHighlightKind.Read = 2;
1511
+ /**
1512
+ * Write-access of a symbol, like writing to a variable.
1513
+ */
1514
+ DocumentHighlightKind.Write = 3;
1515
+ })(DocumentHighlightKind = exports.DocumentHighlightKind || (exports.DocumentHighlightKind = {}));
1516
+ /**
1517
+ * DocumentHighlight namespace to provide helper functions to work with
1518
+ * [DocumentHighlight](#DocumentHighlight) literals.
1519
+ */
1520
+ var DocumentHighlight;
1521
+ (function (DocumentHighlight) {
1522
+ /**
1523
+ * Create a DocumentHighlight object.
1524
+ * @param range The range the highlight applies to.
1525
+ */
1526
+ function create(range, kind) {
1527
+ var result = { range: range };
1528
+ if (Is.number(kind)) {
1529
+ result.kind = kind;
1530
+ }
1531
+ return result;
1532
+ }
1533
+ DocumentHighlight.create = create;
1534
+ })(DocumentHighlight = exports.DocumentHighlight || (exports.DocumentHighlight = {}));
1535
+ /**
1536
+ * A symbol kind.
1537
+ */
1538
+ var SymbolKind;
1539
+ (function (SymbolKind) {
1540
+ SymbolKind.File = 1;
1541
+ SymbolKind.Module = 2;
1542
+ SymbolKind.Namespace = 3;
1543
+ SymbolKind.Package = 4;
1544
+ SymbolKind.Class = 5;
1545
+ SymbolKind.Method = 6;
1546
+ SymbolKind.Property = 7;
1547
+ SymbolKind.Field = 8;
1548
+ SymbolKind.Constructor = 9;
1549
+ SymbolKind.Enum = 10;
1550
+ SymbolKind.Interface = 11;
1551
+ SymbolKind.Function = 12;
1552
+ SymbolKind.Variable = 13;
1553
+ SymbolKind.Constant = 14;
1554
+ SymbolKind.String = 15;
1555
+ SymbolKind.Number = 16;
1556
+ SymbolKind.Boolean = 17;
1557
+ SymbolKind.Array = 18;
1558
+ SymbolKind.Object = 19;
1559
+ SymbolKind.Key = 20;
1560
+ SymbolKind.Null = 21;
1561
+ SymbolKind.EnumMember = 22;
1562
+ SymbolKind.Struct = 23;
1563
+ SymbolKind.Event = 24;
1564
+ SymbolKind.Operator = 25;
1565
+ SymbolKind.TypeParameter = 26;
1566
+ })(SymbolKind = exports.SymbolKind || (exports.SymbolKind = {}));
1567
+ /**
1568
+ * Symbol tags are extra annotations that tweak the rendering of a symbol.
1569
+ * @since 3.16
1570
+ */
1571
+ var SymbolTag;
1572
+ (function (SymbolTag) {
1573
+ /**
1574
+ * Render a symbol as obsolete, usually using a strike-out.
1575
+ */
1576
+ SymbolTag.Deprecated = 1;
1577
+ })(SymbolTag = exports.SymbolTag || (exports.SymbolTag = {}));
1578
+ var SymbolInformation;
1579
+ (function (SymbolInformation) {
1580
+ /**
1581
+ * Creates a new symbol information literal.
1582
+ *
1583
+ * @param name The name of the symbol.
1584
+ * @param kind The kind of the symbol.
1585
+ * @param range The range of the location of the symbol.
1586
+ * @param uri The resource of the location of symbol, defaults to the current document.
1587
+ * @param containerName The name of the symbol containing the symbol.
1588
+ */
1589
+ function create(name, kind, range, uri, containerName) {
1590
+ var result = {
1591
+ name: name,
1592
+ kind: kind,
1593
+ location: { uri: uri, range: range }
1594
+ };
1595
+ if (containerName) {
1596
+ result.containerName = containerName;
1597
+ }
1598
+ return result;
1599
+ }
1600
+ SymbolInformation.create = create;
1601
+ })(SymbolInformation = exports.SymbolInformation || (exports.SymbolInformation = {}));
1602
+ var DocumentSymbol;
1603
+ (function (DocumentSymbol) {
1604
+ /**
1605
+ * Creates a new symbol information literal.
1606
+ *
1607
+ * @param name The name of the symbol.
1608
+ * @param detail The detail of the symbol.
1609
+ * @param kind The kind of the symbol.
1610
+ * @param range The range of the symbol.
1611
+ * @param selectionRange The selectionRange of the symbol.
1612
+ * @param children Children of the symbol.
1613
+ */
1614
+ function create(name, detail, kind, range, selectionRange, children) {
1615
+ var result = {
1616
+ name: name,
1617
+ detail: detail,
1618
+ kind: kind,
1619
+ range: range,
1620
+ selectionRange: selectionRange
1621
+ };
1622
+ if (children !== undefined) {
1623
+ result.children = children;
1624
+ }
1625
+ return result;
1626
+ }
1627
+ DocumentSymbol.create = create;
1628
+ /**
1629
+ * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
1630
+ */
1631
+ function is(value) {
1632
+ var candidate = value;
1633
+ return candidate &&
1634
+ Is.string(candidate.name) && Is.number(candidate.kind) &&
1635
+ Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
1636
+ (candidate.detail === undefined || Is.string(candidate.detail)) &&
1637
+ (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
1638
+ (candidate.children === undefined || Array.isArray(candidate.children)) &&
1639
+ (candidate.tags === undefined || Array.isArray(candidate.tags));
1640
+ }
1641
+ DocumentSymbol.is = is;
1642
+ })(DocumentSymbol = exports.DocumentSymbol || (exports.DocumentSymbol = {}));
1643
+ /**
1644
+ * A set of predefined code action kinds
1645
+ */
1646
+ var CodeActionKind;
1647
+ (function (CodeActionKind) {
1648
+ /**
1649
+ * Empty kind.
1650
+ */
1651
+ CodeActionKind.Empty = '';
1652
+ /**
1653
+ * Base kind for quickfix actions: 'quickfix'
1654
+ */
1655
+ CodeActionKind.QuickFix = 'quickfix';
1656
+ /**
1657
+ * Base kind for refactoring actions: 'refactor'
1658
+ */
1659
+ CodeActionKind.Refactor = 'refactor';
1660
+ /**
1661
+ * Base kind for refactoring extraction actions: 'refactor.extract'
1662
+ *
1663
+ * Example extract actions:
1664
+ *
1665
+ * - Extract method
1666
+ * - Extract function
1667
+ * - Extract variable
1668
+ * - Extract interface from class
1669
+ * - ...
1670
+ */
1671
+ CodeActionKind.RefactorExtract = 'refactor.extract';
1672
+ /**
1673
+ * Base kind for refactoring inline actions: 'refactor.inline'
1674
+ *
1675
+ * Example inline actions:
1676
+ *
1677
+ * - Inline function
1678
+ * - Inline variable
1679
+ * - Inline constant
1680
+ * - ...
1681
+ */
1682
+ CodeActionKind.RefactorInline = 'refactor.inline';
1683
+ /**
1684
+ * Base kind for refactoring rewrite actions: 'refactor.rewrite'
1685
+ *
1686
+ * Example rewrite actions:
1687
+ *
1688
+ * - Convert JavaScript function to class
1689
+ * - Add or remove parameter
1690
+ * - Encapsulate field
1691
+ * - Make method static
1692
+ * - Move method to base class
1693
+ * - ...
1694
+ */
1695
+ CodeActionKind.RefactorRewrite = 'refactor.rewrite';
1696
+ /**
1697
+ * Base kind for source actions: `source`
1698
+ *
1699
+ * Source code actions apply to the entire file.
1700
+ */
1701
+ CodeActionKind.Source = 'source';
1702
+ /**
1703
+ * Base kind for an organize imports source action: `source.organizeImports`
1704
+ */
1705
+ CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
1706
+ /**
1707
+ * Base kind for auto-fix source actions: `source.fixAll`.
1708
+ *
1709
+ * Fix all actions automatically fix errors that have a clear fix that do not require user input.
1710
+ * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
1711
+ *
1712
+ * @since 3.15.0
1713
+ */
1714
+ CodeActionKind.SourceFixAll = 'source.fixAll';
1715
+ })(CodeActionKind = exports.CodeActionKind || (exports.CodeActionKind = {}));
1716
+ /**
1717
+ * The CodeActionContext namespace provides helper functions to work with
1718
+ * [CodeActionContext](#CodeActionContext) literals.
1719
+ */
1720
+ var CodeActionContext;
1721
+ (function (CodeActionContext) {
1722
+ /**
1723
+ * Creates a new CodeActionContext literal.
1724
+ */
1725
+ function create(diagnostics, only) {
1726
+ var result = { diagnostics: diagnostics };
1727
+ if (only !== undefined && only !== null) {
1728
+ result.only = only;
1729
+ }
1730
+ return result;
1731
+ }
1732
+ CodeActionContext.create = create;
1733
+ /**
1734
+ * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
1735
+ */
1736
+ function is(value) {
1737
+ var candidate = value;
1738
+ return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
1739
+ }
1740
+ CodeActionContext.is = is;
1741
+ })(CodeActionContext = exports.CodeActionContext || (exports.CodeActionContext = {}));
1742
+ var CodeAction;
1743
+ (function (CodeAction) {
1744
+ function create(title, kindOrCommandOrEdit, kind) {
1745
+ var result = { title: title };
1746
+ var checkKind = true;
1747
+ if (typeof kindOrCommandOrEdit === 'string') {
1748
+ checkKind = false;
1749
+ result.kind = kindOrCommandOrEdit;
1750
+ }
1751
+ else if (Command.is(kindOrCommandOrEdit)) {
1752
+ result.command = kindOrCommandOrEdit;
1753
+ }
1754
+ else {
1755
+ result.edit = kindOrCommandOrEdit;
1756
+ }
1757
+ if (checkKind && kind !== undefined) {
1758
+ result.kind = kind;
1759
+ }
1760
+ return result;
1761
+ }
1762
+ CodeAction.create = create;
1763
+ function is(value) {
1764
+ var candidate = value;
1765
+ return candidate && Is.string(candidate.title) &&
1766
+ (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
1767
+ (candidate.kind === undefined || Is.string(candidate.kind)) &&
1768
+ (candidate.edit !== undefined || candidate.command !== undefined) &&
1769
+ (candidate.command === undefined || Command.is(candidate.command)) &&
1770
+ (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
1771
+ (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
1772
+ }
1773
+ CodeAction.is = is;
1774
+ })(CodeAction = exports.CodeAction || (exports.CodeAction = {}));
1775
+ /**
1776
+ * The CodeLens namespace provides helper functions to work with
1777
+ * [CodeLens](#CodeLens) literals.
1778
+ */
1779
+ var CodeLens;
1780
+ (function (CodeLens) {
1781
+ /**
1782
+ * Creates a new CodeLens literal.
1783
+ */
1784
+ function create(range, data) {
1785
+ var result = { range: range };
1786
+ if (Is.defined(data)) {
1787
+ result.data = data;
1788
+ }
1789
+ return result;
1790
+ }
1791
+ CodeLens.create = create;
1792
+ /**
1793
+ * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
1794
+ */
1795
+ function is(value) {
1796
+ var candidate = value;
1797
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
1798
+ }
1799
+ CodeLens.is = is;
1800
+ })(CodeLens = exports.CodeLens || (exports.CodeLens = {}));
1801
+ /**
1802
+ * The FormattingOptions namespace provides helper functions to work with
1803
+ * [FormattingOptions](#FormattingOptions) literals.
1804
+ */
1805
+ var FormattingOptions;
1806
+ (function (FormattingOptions) {
1807
+ /**
1808
+ * Creates a new FormattingOptions literal.
1809
+ */
1810
+ function create(tabSize, insertSpaces) {
1811
+ return { tabSize: tabSize, insertSpaces: insertSpaces };
1812
+ }
1813
+ FormattingOptions.create = create;
1814
+ /**
1815
+ * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
1816
+ */
1817
+ function is(value) {
1818
+ var candidate = value;
1819
+ return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
1820
+ }
1821
+ FormattingOptions.is = is;
1822
+ })(FormattingOptions = exports.FormattingOptions || (exports.FormattingOptions = {}));
1823
+ /**
1824
+ * The DocumentLink namespace provides helper functions to work with
1825
+ * [DocumentLink](#DocumentLink) literals.
1826
+ */
1827
+ var DocumentLink;
1828
+ (function (DocumentLink) {
1829
+ /**
1830
+ * Creates a new DocumentLink literal.
1831
+ */
1832
+ function create(range, target, data) {
1833
+ return { range: range, target: target, data: data };
1834
+ }
1835
+ DocumentLink.create = create;
1836
+ /**
1837
+ * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
1838
+ */
1839
+ function is(value) {
1840
+ var candidate = value;
1841
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
1842
+ }
1843
+ DocumentLink.is = is;
1844
+ })(DocumentLink = exports.DocumentLink || (exports.DocumentLink = {}));
1845
+ /**
1846
+ * The SelectionRange namespace provides helper function to work with
1847
+ * SelectionRange literals.
1848
+ */
1849
+ var SelectionRange;
1850
+ (function (SelectionRange) {
1851
+ /**
1852
+ * Creates a new SelectionRange
1853
+ * @param range the range.
1854
+ * @param parent an optional parent.
1855
+ */
1856
+ function create(range, parent) {
1857
+ return { range: range, parent: parent };
1858
+ }
1859
+ SelectionRange.create = create;
1860
+ function is(value) {
1861
+ var candidate = value;
1862
+ return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
1863
+ }
1864
+ SelectionRange.is = is;
1865
+ })(SelectionRange = exports.SelectionRange || (exports.SelectionRange = {}));
1866
+ exports.EOL = ['\n', '\r\n', '\r'];
1867
+ /**
1868
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
1869
+ */
1870
+ var TextDocument;
1871
+ (function (TextDocument) {
1872
+ /**
1873
+ * Creates a new ITextDocument literal from the given uri and content.
1874
+ * @param uri The document's uri.
1875
+ * @param languageId The document's language Id.
1876
+ * @param content The document's content.
1877
+ */
1878
+ function create(uri, languageId, version, content) {
1879
+ return new FullTextDocument(uri, languageId, version, content);
1880
+ }
1881
+ TextDocument.create = create;
1882
+ /**
1883
+ * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
1884
+ */
1885
+ function is(value) {
1886
+ var candidate = value;
1887
+ return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
1888
+ && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
1889
+ }
1890
+ TextDocument.is = is;
1891
+ function applyEdits(document, edits) {
1892
+ var text = document.getText();
1893
+ var sortedEdits = mergeSort(edits, function (a, b) {
1894
+ var diff = a.range.start.line - b.range.start.line;
1895
+ if (diff === 0) {
1896
+ return a.range.start.character - b.range.start.character;
1897
+ }
1898
+ return diff;
1899
+ });
1900
+ var lastModifiedOffset = text.length;
1901
+ for (var i = sortedEdits.length - 1; i >= 0; i--) {
1902
+ var e = sortedEdits[i];
1903
+ var startOffset = document.offsetAt(e.range.start);
1904
+ var endOffset = document.offsetAt(e.range.end);
1905
+ if (endOffset <= lastModifiedOffset) {
1906
+ text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
1907
+ }
1908
+ else {
1909
+ throw new Error('Overlapping edit');
1910
+ }
1911
+ lastModifiedOffset = startOffset;
1912
+ }
1913
+ return text;
1914
+ }
1915
+ TextDocument.applyEdits = applyEdits;
1916
+ function mergeSort(data, compare) {
1917
+ if (data.length <= 1) {
1918
+ // sorted
1919
+ return data;
1920
+ }
1921
+ var p = (data.length / 2) | 0;
1922
+ var left = data.slice(0, p);
1923
+ var right = data.slice(p);
1924
+ mergeSort(left, compare);
1925
+ mergeSort(right, compare);
1926
+ var leftIdx = 0;
1927
+ var rightIdx = 0;
1928
+ var i = 0;
1929
+ while (leftIdx < left.length && rightIdx < right.length) {
1930
+ var ret = compare(left[leftIdx], right[rightIdx]);
1931
+ if (ret <= 0) {
1932
+ // smaller_equal -> take left to preserve order
1933
+ data[i++] = left[leftIdx++];
1934
+ }
1935
+ else {
1936
+ // greater -> take right
1937
+ data[i++] = right[rightIdx++];
1938
+ }
1939
+ }
1940
+ while (leftIdx < left.length) {
1941
+ data[i++] = left[leftIdx++];
1942
+ }
1943
+ while (rightIdx < right.length) {
1944
+ data[i++] = right[rightIdx++];
1945
+ }
1946
+ return data;
1947
+ }
1948
+ })(TextDocument = exports.TextDocument || (exports.TextDocument = {}));
1949
+ /**
1950
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
1951
+ */
1952
+ var FullTextDocument = /** @class */ (function () {
1953
+ function FullTextDocument(uri, languageId, version, content) {
1954
+ this._uri = uri;
1955
+ this._languageId = languageId;
1956
+ this._version = version;
1957
+ this._content = content;
1958
+ this._lineOffsets = undefined;
1959
+ }
1960
+ Object.defineProperty(FullTextDocument.prototype, "uri", {
1961
+ get: function () {
1962
+ return this._uri;
1963
+ },
1964
+ enumerable: false,
1965
+ configurable: true
1966
+ });
1967
+ Object.defineProperty(FullTextDocument.prototype, "languageId", {
1968
+ get: function () {
1969
+ return this._languageId;
1970
+ },
1971
+ enumerable: false,
1972
+ configurable: true
1973
+ });
1974
+ Object.defineProperty(FullTextDocument.prototype, "version", {
1975
+ get: function () {
1976
+ return this._version;
1977
+ },
1978
+ enumerable: false,
1979
+ configurable: true
1980
+ });
1981
+ FullTextDocument.prototype.getText = function (range) {
1982
+ if (range) {
1983
+ var start = this.offsetAt(range.start);
1984
+ var end = this.offsetAt(range.end);
1985
+ return this._content.substring(start, end);
1986
+ }
1987
+ return this._content;
1988
+ };
1989
+ FullTextDocument.prototype.update = function (event, version) {
1990
+ this._content = event.text;
1991
+ this._version = version;
1992
+ this._lineOffsets = undefined;
1993
+ };
1994
+ FullTextDocument.prototype.getLineOffsets = function () {
1995
+ if (this._lineOffsets === undefined) {
1996
+ var lineOffsets = [];
1997
+ var text = this._content;
1998
+ var isLineStart = true;
1999
+ for (var i = 0; i < text.length; i++) {
2000
+ if (isLineStart) {
2001
+ lineOffsets.push(i);
2002
+ isLineStart = false;
2003
+ }
2004
+ var ch = text.charAt(i);
2005
+ isLineStart = (ch === '\r' || ch === '\n');
2006
+ if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
2007
+ i++;
2008
+ }
2009
+ }
2010
+ if (isLineStart && text.length > 0) {
2011
+ lineOffsets.push(text.length);
2012
+ }
2013
+ this._lineOffsets = lineOffsets;
2014
+ }
2015
+ return this._lineOffsets;
2016
+ };
2017
+ FullTextDocument.prototype.positionAt = function (offset) {
2018
+ offset = Math.max(Math.min(offset, this._content.length), 0);
2019
+ var lineOffsets = this.getLineOffsets();
2020
+ var low = 0, high = lineOffsets.length;
2021
+ if (high === 0) {
2022
+ return Position.create(0, offset);
2023
+ }
2024
+ while (low < high) {
2025
+ var mid = Math.floor((low + high) / 2);
2026
+ if (lineOffsets[mid] > offset) {
2027
+ high = mid;
2028
+ }
2029
+ else {
2030
+ low = mid + 1;
2031
+ }
2032
+ }
2033
+ // low is the least x for which the line offset is larger than the current offset
2034
+ // or array.length if no line offset is larger than the current offset
2035
+ var line = low - 1;
2036
+ return Position.create(line, offset - lineOffsets[line]);
2037
+ };
2038
+ FullTextDocument.prototype.offsetAt = function (position) {
2039
+ var lineOffsets = this.getLineOffsets();
2040
+ if (position.line >= lineOffsets.length) {
2041
+ return this._content.length;
2042
+ }
2043
+ else if (position.line < 0) {
2044
+ return 0;
2045
+ }
2046
+ var lineOffset = lineOffsets[position.line];
2047
+ var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
2048
+ return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
2049
+ };
2050
+ Object.defineProperty(FullTextDocument.prototype, "lineCount", {
2051
+ get: function () {
2052
+ return this.getLineOffsets().length;
2053
+ },
2054
+ enumerable: false,
2055
+ configurable: true
2056
+ });
2057
+ return FullTextDocument;
2058
+ }());
2059
+ var Is;
2060
+ (function (Is) {
2061
+ var toString = Object.prototype.toString;
2062
+ function defined(value) {
2063
+ return typeof value !== 'undefined';
2064
+ }
2065
+ Is.defined = defined;
2066
+ function undefined(value) {
2067
+ return typeof value === 'undefined';
2068
+ }
2069
+ Is.undefined = undefined;
2070
+ function boolean(value) {
2071
+ return value === true || value === false;
2072
+ }
2073
+ Is.boolean = boolean;
2074
+ function string(value) {
2075
+ return toString.call(value) === '[object String]';
2076
+ }
2077
+ Is.string = string;
2078
+ function number(value) {
2079
+ return toString.call(value) === '[object Number]';
2080
+ }
2081
+ Is.number = number;
2082
+ function numberRange(value, min, max) {
2083
+ return toString.call(value) === '[object Number]' && min <= value && value <= max;
2084
+ }
2085
+ Is.numberRange = numberRange;
2086
+ function integer(value) {
2087
+ return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
2088
+ }
2089
+ Is.integer = integer;
2090
+ function uinteger(value) {
2091
+ return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
2092
+ }
2093
+ Is.uinteger = uinteger;
2094
+ function func(value) {
2095
+ return toString.call(value) === '[object Function]';
2096
+ }
2097
+ Is.func = func;
2098
+ function objectLiteral(value) {
2099
+ // Strictly speaking class instances pass this check as well. Since the LSP
2100
+ // doesn't use classes we ignore this for now. If we do we need to add something
2101
+ // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
2102
+ return value !== null && typeof value === 'object';
2103
+ }
2104
+ Is.objectLiteral = objectLiteral;
2105
+ function typedArray(value, check) {
2106
+ return Array.isArray(value) && value.every(check);
2107
+ }
2108
+ Is.typedArray = typedArray;
2109
+ })(Is || (Is = {}));
2110
+ });
2111
+ //# sourceMappingURL=main.js.map;
1730
2112
  define('vscode-languageserver-types', ['vscode-languageserver-types/main'], function (main) { return main; });
1731
2113
 
1732
2114
  /**
@@ -1891,20 +2273,20 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
1891
2273
  this._configurationListener = Object.create(null);
1892
2274
  this._schemaListener = Object.create(null);
1893
2275
  var onModelAdd = function (model) {
1894
- var modeId = model.getModeId();
1895
- if (modeId !== _this._languageId) {
2276
+ var languageId = model.getLanguageId();
2277
+ if (languageId !== _this._languageId) {
1896
2278
  return;
1897
2279
  }
1898
- var debouncedValidation = _.debounce(function (intervals) { return _this._doValidate(model, modeId, intervals); }, 500);
2280
+ var debouncedValidation = _.debounce(function (intervals) { return _this._doValidate(model, languageId, intervals); }, 500);
1899
2281
  _this._contentListener[model.uri.toString()] = model.onDidChangeContent(function (e) {
1900
2282
  var intervalsToValidate = changeEventToIntervals(e);
1901
2283
  debouncedValidation(intervalsToValidate);
1902
2284
  });
1903
2285
  _this._configurationListener[model.uri.toString()] = _this.defaults.onDidChange(function () {
1904
- self.setTimeout(function () { return _this._doValidate(model, modeId, []); }, 0);
2286
+ self.setTimeout(function () { return _this._doValidate(model, languageId, []); }, 0);
1905
2287
  });
1906
2288
  _this._schemaListener[model.uri.toString()] = onSchemaChange(function () {
1907
- self.setTimeout(function () { return _this._doValidate(model, modeId, []); }, 0);
2289
+ self.setTimeout(function () { return _this._doValidate(model, languageId, []); }, 0);
1908
2290
  });
1909
2291
  };
1910
2292
  var onModelRemoved = function (model) {
@@ -1964,20 +2346,21 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
1964
2346
  }
1965
2347
  var markers = diagnostics.map(function (d) { return toDiagnostics(resource, d); });
1966
2348
  var model = _this._monacoInstance.editor.getModel(resource);
1967
- var oldDecorations = model.getAllDecorations()
1968
- .filter(function (decoration) { return decoration.options.className == "squiggly-error"; })
2349
+ var oldDecorations = model
2350
+ .getAllDecorations()
2351
+ .filter(function (decoration) { return decoration.options.className == 'squiggly-error'; })
1969
2352
  .map(function (decoration) { return decoration.id; });
1970
- if (model && model.getModeId() === languageId) {
2353
+ if (model && model.getLanguageId() === languageId) {
1971
2354
  var syntaxErrorAsMarkDown = _this.defaults.languageSettings.syntaxErrorAsMarkDown;
1972
2355
  if (!syntaxErrorAsMarkDown || !syntaxErrorAsMarkDown.enableSyntaxErrorAsMarkDown) {
1973
- // Remove previous syntax error decorations and set the new markers (for example, when disabling syntaxErrorAsMarkDown after it was enabled)
2356
+ // Remove previous syntax error decorations and set the new markers (for example, when disabling syntaxErrorAsMarkDown after it was enabled)
1974
2357
  model.deltaDecorations(oldDecorations, []);
1975
2358
  _this._monacoInstance.editor.setModelMarkers(model, languageId, markers);
1976
2359
  }
1977
2360
  else {
1978
2361
  // Add custom popup for syntax error: icon, header and message as markdown
1979
- var header = syntaxErrorAsMarkDown.header ? "**" + syntaxErrorAsMarkDown.header + "** \n\n" : "";
1980
- var icon = syntaxErrorAsMarkDown.icon ? "![](" + syntaxErrorAsMarkDown.icon + ")" : "";
2362
+ var header = syntaxErrorAsMarkDown.header ? "**" + syntaxErrorAsMarkDown.header + "** \n\n" : '';
2363
+ var icon = syntaxErrorAsMarkDown.icon ? "![](" + syntaxErrorAsMarkDown.icon + ")" : '';
1981
2364
  var popupErrorHoverHeaderMessage_1 = icon + " " + header;
1982
2365
  var newDecorations = markers.map(function (marker) {
1983
2366
  return {
@@ -1985,30 +2368,31 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
1985
2368
  startLineNumber: marker.startLineNumber,
1986
2369
  startColumn: marker.startColumn,
1987
2370
  endLineNumber: marker.endLineNumber,
1988
- endColumn: marker.endColumn
2371
+ endColumn: marker.endColumn,
1989
2372
  },
1990
2373
  options: {
1991
2374
  hoverMessage: {
1992
- value: popupErrorHoverHeaderMessage_1 + marker.message
2375
+ value: popupErrorHoverHeaderMessage_1 + marker.message,
1993
2376
  },
1994
- className: "squiggly-error",
2377
+ className: 'squiggly-error',
1995
2378
  zIndex: 100,
1996
2379
  overviewRuler: {
1997
2380
  // The color indication on the right ruler
1998
- color: "rgb(255, 18, 18, 0.7)",
1999
- position: monaco.editor.OverviewRulerLane.Right
2381
+ color: 'rgb(255, 18, 18, 0.7)',
2382
+ position: monaco.editor.OverviewRulerLane.Right,
2000
2383
  },
2001
2384
  minimap: {
2002
- color: "rgb(255, 18, 18, 0.7)",
2003
- position: monaco.editor.MinimapPosition.Inline
2004
- }
2005
- }
2385
+ color: 'rgb(255, 18, 18, 0.7)',
2386
+ position: monaco.editor.MinimapPosition.Inline,
2387
+ },
2388
+ },
2006
2389
  };
2007
2390
  });
2008
- var oldMarkers = monaco.editor.getModelMarkers({
2391
+ var oldMarkers = monaco.editor
2392
+ .getModelMarkers({
2009
2393
  owner: languageId,
2010
- resource: resource
2011
- }).filter(function (marker) { return marker.severity == monaco.MarkerSeverity.Error; });
2394
+ resource: resource,
2395
+ });
2012
2396
  if (oldMarkers && oldMarkers.length > 0) {
2013
2397
  // In case there were previous markers, remove their decorations (for example, when enabling syntaxErrorAsMarkDown after it was disabled)
2014
2398
  oldDecorations = [];
@@ -2155,11 +2539,11 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
2155
2539
  this.decorations = [];
2156
2540
  injectCss();
2157
2541
  var onModelAdd = function (model) {
2158
- var modeId = model.getModeId();
2159
- if (modeId !== _this._languageId) {
2542
+ var languageId = model.getLanguageId();
2543
+ if (languageId !== _this._languageId) {
2160
2544
  return;
2161
2545
  }
2162
- var debouncedColorization = _.debounce(function (intervals) { return _this._doColorization(model, modeId, intervals); }, 500);
2546
+ var debouncedColorization = _.debounce(function (intervals) { return _this._doColorization(model, languageId, intervals); }, 500);
2163
2547
  var handle;
2164
2548
  _this._contentListener[model.uri.toString()] = model.onDidChangeContent(function (e) {
2165
2549
  // Changes are represented as a range in doc before change, plus the text that it was replaced with.
@@ -2169,10 +2553,10 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
2169
2553
  debouncedColorization(intervalsToColorize);
2170
2554
  });
2171
2555
  _this._configurationListener[model.uri.toString()] = defaults.onDidChange(function () {
2172
- self.setTimeout(function () { return _this._doColorization(model, modeId, []); }, 0);
2556
+ self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
2173
2557
  });
2174
2558
  _this._schemaListener[model.uri.toString()] = onSchemaChange(function () {
2175
- self.setTimeout(function () { return _this._doColorization(model, modeId, []); }, 0);
2559
+ self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
2176
2560
  });
2177
2561
  };
2178
2562
  var onModelRemoved = function (model) {
@@ -2270,7 +2654,7 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
2270
2654
  .reduce(function (prev, curr) { return prev.concat(curr); }, []);
2271
2655
  // Flatten decoration groups to an array of decorations
2272
2656
  var newDecorations = decorationRanges.reduce(function (prev, next) { return prev.concat(next.decorations); }, []);
2273
- if (model && model.getModeId() === languageId) {
2657
+ if (model && model.getLanguageId() === languageId) {
2274
2658
  _this.decorations = model.deltaDecorations(oldDecorations, newDecorations);
2275
2659
  }
2276
2660
  })
@@ -2428,8 +2812,7 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
2428
2812
  var wordInfo = model.getWordUntilPosition(position);
2429
2813
  var wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
2430
2814
  var resource = model.uri;
2431
- var onDidProvideCompletionItems = this.languageSettings
2432
- .onDidProvideCompletionItems;
2815
+ var onDidProvideCompletionItems = this.languageSettings.onDidProvideCompletionItems;
2433
2816
  return this._worker(resource)
2434
2817
  .then(function (worker) {
2435
2818
  return worker.doComplete(resource.toString(), fromPosition(position));