@kusto/monaco-kusto 8.2.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/package.json +16 -16
  2. package/release/dev/Kusto.Language.Bridge.min.js +1 -1
  3. package/release/dev/kusto.javascript.client.min.js +1 -1
  4. package/release/dev/kustoMode.js +21 -21
  5. package/release/dev/kustoWorker.js +23 -21
  6. package/release/dev/{main-f25d1ca7.js → main-e6ef956d.js} +168 -381
  7. package/release/dev/monaco.contribution.js +6 -9
  8. package/release/dev/{schema-8dc56616.js → schema-7d65ed04.js} +4 -4
  9. package/release/esm/commandFormatter.js +37 -0
  10. package/release/esm/commandHighlighter.js +52 -0
  11. package/release/esm/extendedEditor.js +41 -0
  12. package/release/esm/kusto.worker.js +2 -2
  13. package/release/esm/kustoMode.js +139 -1158
  14. package/release/esm/kustoWorker.js +252 -0
  15. package/release/esm/languageFeatures.js +1072 -0
  16. package/release/esm/languageService/kustoLanguageService.js +1923 -0
  17. package/release/esm/languageService/kustoMonarchLanguageDefinition.js +211 -0
  18. package/release/esm/languageService/renderInfo.js +1 -0
  19. package/release/esm/languageService/schema.js +64 -0
  20. package/release/esm/languageService/settings.js +1 -0
  21. package/release/esm/monaco.contribution.js +178 -426
  22. package/release/esm/{schema-1d41f705.js → schema-ee621489.js} +1 -2
  23. package/release/esm/types.js +1 -0
  24. package/release/esm/workerManager.js +102 -0
  25. package/release/min/Kusto.Language.Bridge.min.js +1 -1
  26. package/release/min/kusto.javascript.client.min.js +1 -1
  27. package/release/min/kustoMode.js +2 -2
  28. package/release/min/kustoWorker.js +2 -2
  29. package/release/min/main-04a9f035.js +7 -0
  30. package/release/min/monaco.contribution.js +2 -2
  31. package/release/min/{schema-ef0ffe13.js → schema-095fdf5a.js} +2 -2
  32. package/release/min/main-c1317e01.js +0 -7
@@ -1,18 +1,23 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 8.2.0(fa67d42b5fffde7c13ac41861bb1dbf769c5e00e)
3
+ * monaco-kusto version: 8.3.0(b1e36a8cfc8e35c070743997d6e7770ea8081289)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
7
7
 
8
- define('vs/language/kusto/main-f25d1ca7', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/main-e6ef956d', ['exports'], (function (exports) { 'use strict';
9
9
 
10
10
  /* --------------------------------------------------------------------------------------------
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License. See License.txt in the project root for license information.
13
13
  * ------------------------------------------------------------------------------------------ */
14
14
 
15
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
15
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
21
  var DocumentUri;
17
22
  (function (DocumentUri) {
18
23
  function is(value) {
@@ -431,14 +436,13 @@ define('vs/language/kusto/main-f25d1ca7', ['exports'], (function (exports) { 'us
431
436
  * Creates a new Command literal.
432
437
  */
433
438
  function create(title, command) {
434
- var args = [];
435
- for (var _i = 2; _i < arguments.length; _i++) {
436
- args[_i - 2] = arguments[_i];
437
- }
438
439
  var result = {
439
440
  title: title,
440
441
  command: command
441
442
  };
443
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
444
+ args[_key - 2] = arguments[_key];
445
+ }
442
446
  if (Is.defined(args) && args.length > 0) {
443
447
  result.arguments = args;
444
448
  }
@@ -691,294 +695,6 @@ define('vs/language/kusto/main-f25d1ca7', ['exports'], (function (exports) { 'us
691
695
  }
692
696
  WorkspaceEdit.is = is;
693
697
  })(WorkspaceEdit || (WorkspaceEdit = {}));
694
- var TextEditChangeImpl = /** @class */function () {
695
- function TextEditChangeImpl(edits, changeAnnotations) {
696
- this.edits = edits;
697
- this.changeAnnotations = changeAnnotations;
698
- }
699
- TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
700
- var edit;
701
- var id;
702
- if (annotation === undefined) {
703
- edit = exports.TextEdit.insert(position, newText);
704
- } else if (ChangeAnnotationIdentifier.is(annotation)) {
705
- id = annotation;
706
- edit = AnnotatedTextEdit.insert(position, newText, annotation);
707
- } else {
708
- this.assertChangeAnnotations(this.changeAnnotations);
709
- id = this.changeAnnotations.manage(annotation);
710
- edit = AnnotatedTextEdit.insert(position, newText, id);
711
- }
712
- this.edits.push(edit);
713
- if (id !== undefined) {
714
- return id;
715
- }
716
- };
717
- TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
718
- var edit;
719
- var id;
720
- if (annotation === undefined) {
721
- edit = exports.TextEdit.replace(range, newText);
722
- } else if (ChangeAnnotationIdentifier.is(annotation)) {
723
- id = annotation;
724
- edit = AnnotatedTextEdit.replace(range, newText, annotation);
725
- } else {
726
- this.assertChangeAnnotations(this.changeAnnotations);
727
- id = this.changeAnnotations.manage(annotation);
728
- edit = AnnotatedTextEdit.replace(range, newText, id);
729
- }
730
- this.edits.push(edit);
731
- if (id !== undefined) {
732
- return id;
733
- }
734
- };
735
- TextEditChangeImpl.prototype.delete = function (range, annotation) {
736
- var edit;
737
- var id;
738
- if (annotation === undefined) {
739
- edit = exports.TextEdit.del(range);
740
- } else if (ChangeAnnotationIdentifier.is(annotation)) {
741
- id = annotation;
742
- edit = AnnotatedTextEdit.del(range, annotation);
743
- } else {
744
- this.assertChangeAnnotations(this.changeAnnotations);
745
- id = this.changeAnnotations.manage(annotation);
746
- edit = AnnotatedTextEdit.del(range, id);
747
- }
748
- this.edits.push(edit);
749
- if (id !== undefined) {
750
- return id;
751
- }
752
- };
753
- TextEditChangeImpl.prototype.add = function (edit) {
754
- this.edits.push(edit);
755
- };
756
- TextEditChangeImpl.prototype.all = function () {
757
- return this.edits;
758
- };
759
- TextEditChangeImpl.prototype.clear = function () {
760
- this.edits.splice(0, this.edits.length);
761
- };
762
- TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
763
- if (value === undefined) {
764
- throw new Error("Text edit change is not configured to manage change annotations.");
765
- }
766
- };
767
- return TextEditChangeImpl;
768
- }();
769
- /**
770
- * A helper class
771
- */
772
- var ChangeAnnotations = /** @class */function () {
773
- function ChangeAnnotations(annotations) {
774
- this._annotations = annotations === undefined ? Object.create(null) : annotations;
775
- this._counter = 0;
776
- this._size = 0;
777
- }
778
- ChangeAnnotations.prototype.all = function () {
779
- return this._annotations;
780
- };
781
- Object.defineProperty(ChangeAnnotations.prototype, "size", {
782
- get: function get() {
783
- return this._size;
784
- },
785
- enumerable: false,
786
- configurable: true
787
- });
788
- ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
789
- var id;
790
- if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
791
- id = idOrAnnotation;
792
- } else {
793
- id = this.nextId();
794
- annotation = idOrAnnotation;
795
- }
796
- if (this._annotations[id] !== undefined) {
797
- throw new Error("Id ".concat(id, " is already in use."));
798
- }
799
- if (annotation === undefined) {
800
- throw new Error("No annotation provided for id ".concat(id));
801
- }
802
- this._annotations[id] = annotation;
803
- this._size++;
804
- return id;
805
- };
806
- ChangeAnnotations.prototype.nextId = function () {
807
- this._counter++;
808
- return this._counter.toString();
809
- };
810
- return ChangeAnnotations;
811
- }();
812
- /**
813
- * A workspace change helps constructing changes to a workspace.
814
- */
815
- /** @class */(function () {
816
- function WorkspaceChange(workspaceEdit) {
817
- var _this = this;
818
- this._textEditChanges = Object.create(null);
819
- if (workspaceEdit !== undefined) {
820
- this._workspaceEdit = workspaceEdit;
821
- if (workspaceEdit.documentChanges) {
822
- this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
823
- workspaceEdit.changeAnnotations = this._changeAnnotations.all();
824
- workspaceEdit.documentChanges.forEach(function (change) {
825
- if (TextDocumentEdit.is(change)) {
826
- var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
827
- _this._textEditChanges[change.textDocument.uri] = textEditChange;
828
- }
829
- });
830
- } else if (workspaceEdit.changes) {
831
- Object.keys(workspaceEdit.changes).forEach(function (key) {
832
- var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
833
- _this._textEditChanges[key] = textEditChange;
834
- });
835
- }
836
- } else {
837
- this._workspaceEdit = {};
838
- }
839
- }
840
- Object.defineProperty(WorkspaceChange.prototype, "edit", {
841
- /**
842
- * Returns the underlying {@link WorkspaceEdit} literal
843
- * use to be returned from a workspace edit operation like rename.
844
- */
845
- get: function get() {
846
- this.initDocumentChanges();
847
- if (this._changeAnnotations !== undefined) {
848
- if (this._changeAnnotations.size === 0) {
849
- this._workspaceEdit.changeAnnotations = undefined;
850
- } else {
851
- this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
852
- }
853
- }
854
- return this._workspaceEdit;
855
- },
856
- enumerable: false,
857
- configurable: true
858
- });
859
- WorkspaceChange.prototype.getTextEditChange = function (key) {
860
- if (OptionalVersionedTextDocumentIdentifier.is(key)) {
861
- this.initDocumentChanges();
862
- if (this._workspaceEdit.documentChanges === undefined) {
863
- throw new Error('Workspace edit is not configured for document changes.');
864
- }
865
- var textDocument = {
866
- uri: key.uri,
867
- version: key.version
868
- };
869
- var result = this._textEditChanges[textDocument.uri];
870
- if (!result) {
871
- var edits = [];
872
- var textDocumentEdit = {
873
- textDocument: textDocument,
874
- edits: edits
875
- };
876
- this._workspaceEdit.documentChanges.push(textDocumentEdit);
877
- result = new TextEditChangeImpl(edits, this._changeAnnotations);
878
- this._textEditChanges[textDocument.uri] = result;
879
- }
880
- return result;
881
- } else {
882
- this.initChanges();
883
- if (this._workspaceEdit.changes === undefined) {
884
- throw new Error('Workspace edit is not configured for normal text edit changes.');
885
- }
886
- var result = this._textEditChanges[key];
887
- if (!result) {
888
- var edits = [];
889
- this._workspaceEdit.changes[key] = edits;
890
- result = new TextEditChangeImpl(edits);
891
- this._textEditChanges[key] = result;
892
- }
893
- return result;
894
- }
895
- };
896
- WorkspaceChange.prototype.initDocumentChanges = function () {
897
- if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
898
- this._changeAnnotations = new ChangeAnnotations();
899
- this._workspaceEdit.documentChanges = [];
900
- this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
901
- }
902
- };
903
- WorkspaceChange.prototype.initChanges = function () {
904
- if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
905
- this._workspaceEdit.changes = Object.create(null);
906
- }
907
- };
908
- WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
909
- this.initDocumentChanges();
910
- if (this._workspaceEdit.documentChanges === undefined) {
911
- throw new Error('Workspace edit is not configured for document changes.');
912
- }
913
- var annotation;
914
- if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
915
- annotation = optionsOrAnnotation;
916
- } else {
917
- options = optionsOrAnnotation;
918
- }
919
- var operation;
920
- var id;
921
- if (annotation === undefined) {
922
- operation = CreateFile.create(uri, options);
923
- } else {
924
- id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
925
- operation = CreateFile.create(uri, options, id);
926
- }
927
- this._workspaceEdit.documentChanges.push(operation);
928
- if (id !== undefined) {
929
- return id;
930
- }
931
- };
932
- WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
933
- this.initDocumentChanges();
934
- if (this._workspaceEdit.documentChanges === undefined) {
935
- throw new Error('Workspace edit is not configured for document changes.');
936
- }
937
- var annotation;
938
- if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
939
- annotation = optionsOrAnnotation;
940
- } else {
941
- options = optionsOrAnnotation;
942
- }
943
- var operation;
944
- var id;
945
- if (annotation === undefined) {
946
- operation = RenameFile.create(oldUri, newUri, options);
947
- } else {
948
- id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
949
- operation = RenameFile.create(oldUri, newUri, options, id);
950
- }
951
- this._workspaceEdit.documentChanges.push(operation);
952
- if (id !== undefined) {
953
- return id;
954
- }
955
- };
956
- WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
957
- this.initDocumentChanges();
958
- if (this._workspaceEdit.documentChanges === undefined) {
959
- throw new Error('Workspace edit is not configured for document changes.');
960
- }
961
- var annotation;
962
- if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
963
- annotation = optionsOrAnnotation;
964
- } else {
965
- options = optionsOrAnnotation;
966
- }
967
- var operation;
968
- var id;
969
- if (annotation === undefined) {
970
- operation = DeleteFile.create(uri, options);
971
- } else {
972
- id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
973
- operation = DeleteFile.create(uri, options, id);
974
- }
975
- this._workspaceEdit.documentChanges.push(operation);
976
- if (id !== undefined) {
977
- return id;
978
- }
979
- };
980
- return WorkspaceChange;
981
- })();
982
698
  /**
983
699
  * The TextDocumentIdentifier namespace provides helper functions to work with
984
700
  * {@link TextDocumentIdentifier} literals.
@@ -1352,16 +1068,15 @@ define('vs/language/kusto/main-f25d1ca7', ['exports'], (function (exports) { 'us
1352
1068
  var SignatureInformation;
1353
1069
  (function (SignatureInformation) {
1354
1070
  function create(label, documentation) {
1355
- var parameters = [];
1356
- for (var _i = 2; _i < arguments.length; _i++) {
1357
- parameters[_i - 2] = arguments[_i];
1358
- }
1359
1071
  var result = {
1360
1072
  label: label
1361
1073
  };
1362
1074
  if (Is.defined(documentation)) {
1363
1075
  result.documentation = documentation;
1364
1076
  }
1077
+ for (var _len2 = arguments.length, parameters = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
1078
+ parameters[_key2 - 2] = arguments[_key2];
1079
+ }
1365
1080
  if (Is.defined(parameters)) {
1366
1081
  result.parameters = parameters;
1367
1082
  } else {
@@ -2020,6 +1735,74 @@ define('vs/language/kusto/main-f25d1ca7', ['exports'], (function (exports) { 'us
2020
1735
  }
2021
1736
  InlayHint.is = is;
2022
1737
  })(InlayHint || (InlayHint = {}));
1738
+ var StringValue;
1739
+ (function (StringValue) {
1740
+ function createSnippet(value) {
1741
+ return {
1742
+ kind: 'snippet',
1743
+ value: value
1744
+ };
1745
+ }
1746
+ StringValue.createSnippet = createSnippet;
1747
+ })(StringValue || (StringValue = {}));
1748
+ var InlineCompletionItem;
1749
+ (function (InlineCompletionItem) {
1750
+ function create(insertText, filterText, range, command) {
1751
+ return {
1752
+ insertText: insertText,
1753
+ filterText: filterText,
1754
+ range: range,
1755
+ command: command
1756
+ };
1757
+ }
1758
+ InlineCompletionItem.create = create;
1759
+ })(InlineCompletionItem || (InlineCompletionItem = {}));
1760
+ var InlineCompletionList;
1761
+ (function (InlineCompletionList) {
1762
+ function create(items) {
1763
+ return {
1764
+ items: items
1765
+ };
1766
+ }
1767
+ InlineCompletionList.create = create;
1768
+ })(InlineCompletionList || (InlineCompletionList = {}));
1769
+ /**
1770
+ * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
1771
+ *
1772
+ * @since 3.18.0
1773
+ * @proposed
1774
+ */
1775
+ var InlineCompletionTriggerKind;
1776
+ (function (InlineCompletionTriggerKind) {
1777
+ /**
1778
+ * Completion was triggered explicitly by a user gesture.
1779
+ */
1780
+ InlineCompletionTriggerKind.Invoked = 0;
1781
+ /**
1782
+ * Completion was triggered automatically while editing.
1783
+ */
1784
+ InlineCompletionTriggerKind.Automatic = 1;
1785
+ })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
1786
+ var SelectedCompletionInfo;
1787
+ (function (SelectedCompletionInfo) {
1788
+ function create(range, text) {
1789
+ return {
1790
+ range: range,
1791
+ text: text
1792
+ };
1793
+ }
1794
+ SelectedCompletionInfo.create = create;
1795
+ })(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
1796
+ var InlineCompletionContext;
1797
+ (function (InlineCompletionContext) {
1798
+ function create(triggerKind, selectedCompletionInfo) {
1799
+ return {
1800
+ triggerKind: triggerKind,
1801
+ selectedCompletionInfo: selectedCompletionInfo
1802
+ };
1803
+ }
1804
+ InlineCompletionContext.create = create;
1805
+ })(InlineCompletionContext || (InlineCompletionContext = {}));
2023
1806
  var WorkspaceFolder;
2024
1807
  (function (WorkspaceFolder) {
2025
1808
  function is(value) {
@@ -2111,110 +1894,114 @@ define('vs/language/kusto/main-f25d1ca7', ['exports'], (function (exports) { 'us
2111
1894
  /**
2112
1895
  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
2113
1896
  */
2114
- var FullTextDocument = /** @class */function () {
1897
+ var FullTextDocument = /*#__PURE__*/function () {
2115
1898
  function FullTextDocument(uri, languageId, version, content) {
1899
+ _classCallCheck(this, FullTextDocument);
2116
1900
  this._uri = uri;
2117
1901
  this._languageId = languageId;
2118
1902
  this._version = version;
2119
1903
  this._content = content;
2120
1904
  this._lineOffsets = undefined;
2121
1905
  }
2122
- Object.defineProperty(FullTextDocument.prototype, "uri", {
1906
+ _createClass(FullTextDocument, [{
1907
+ key: "uri",
2123
1908
  get: function get() {
2124
1909
  return this._uri;
2125
- },
2126
- enumerable: false,
2127
- configurable: true
2128
- });
2129
- Object.defineProperty(FullTextDocument.prototype, "languageId", {
1910
+ }
1911
+ }, {
1912
+ key: "languageId",
2130
1913
  get: function get() {
2131
1914
  return this._languageId;
2132
- },
2133
- enumerable: false,
2134
- configurable: true
2135
- });
2136
- Object.defineProperty(FullTextDocument.prototype, "version", {
1915
+ }
1916
+ }, {
1917
+ key: "version",
2137
1918
  get: function get() {
2138
1919
  return this._version;
2139
- },
2140
- enumerable: false,
2141
- configurable: true
2142
- });
2143
- FullTextDocument.prototype.getText = function (range) {
2144
- if (range) {
2145
- var start = this.offsetAt(range.start);
2146
- var end = this.offsetAt(range.end);
2147
- return this._content.substring(start, end);
2148
1920
  }
2149
- return this._content;
2150
- };
2151
- FullTextDocument.prototype.update = function (event, version) {
2152
- this._content = event.text;
2153
- this._version = version;
2154
- this._lineOffsets = undefined;
2155
- };
2156
- FullTextDocument.prototype.getLineOffsets = function () {
2157
- if (this._lineOffsets === undefined) {
2158
- var lineOffsets = [];
2159
- var text = this._content;
2160
- var isLineStart = true;
2161
- for (var i = 0; i < text.length; i++) {
2162
- if (isLineStart) {
2163
- lineOffsets.push(i);
2164
- isLineStart = false;
1921
+ }, {
1922
+ key: "getText",
1923
+ value: function getText(range) {
1924
+ if (range) {
1925
+ var start = this.offsetAt(range.start);
1926
+ var end = this.offsetAt(range.end);
1927
+ return this._content.substring(start, end);
1928
+ }
1929
+ return this._content;
1930
+ }
1931
+ }, {
1932
+ key: "update",
1933
+ value: function update(event, version) {
1934
+ this._content = event.text;
1935
+ this._version = version;
1936
+ this._lineOffsets = undefined;
1937
+ }
1938
+ }, {
1939
+ key: "getLineOffsets",
1940
+ value: function getLineOffsets() {
1941
+ if (this._lineOffsets === undefined) {
1942
+ var lineOffsets = [];
1943
+ var text = this._content;
1944
+ var isLineStart = true;
1945
+ for (var i = 0; i < text.length; i++) {
1946
+ if (isLineStart) {
1947
+ lineOffsets.push(i);
1948
+ isLineStart = false;
1949
+ }
1950
+ var ch = text.charAt(i);
1951
+ isLineStart = ch === '\r' || ch === '\n';
1952
+ if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
1953
+ i++;
1954
+ }
2165
1955
  }
2166
- var ch = text.charAt(i);
2167
- isLineStart = ch === '\r' || ch === '\n';
2168
- if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
2169
- i++;
1956
+ if (isLineStart && text.length > 0) {
1957
+ lineOffsets.push(text.length);
2170
1958
  }
1959
+ this._lineOffsets = lineOffsets;
2171
1960
  }
2172
- if (isLineStart && text.length > 0) {
2173
- lineOffsets.push(text.length);
1961
+ return this._lineOffsets;
1962
+ }
1963
+ }, {
1964
+ key: "positionAt",
1965
+ value: function positionAt(offset) {
1966
+ offset = Math.max(Math.min(offset, this._content.length), 0);
1967
+ var lineOffsets = this.getLineOffsets();
1968
+ var low = 0,
1969
+ high = lineOffsets.length;
1970
+ if (high === 0) {
1971
+ return Position.create(0, offset);
2174
1972
  }
2175
- this._lineOffsets = lineOffsets;
2176
- }
2177
- return this._lineOffsets;
2178
- };
2179
- FullTextDocument.prototype.positionAt = function (offset) {
2180
- offset = Math.max(Math.min(offset, this._content.length), 0);
2181
- var lineOffsets = this.getLineOffsets();
2182
- var low = 0,
2183
- high = lineOffsets.length;
2184
- if (high === 0) {
2185
- return Position.create(0, offset);
2186
- }
2187
- while (low < high) {
2188
- var mid = Math.floor((low + high) / 2);
2189
- if (lineOffsets[mid] > offset) {
2190
- high = mid;
2191
- } else {
2192
- low = mid + 1;
1973
+ while (low < high) {
1974
+ var mid = Math.floor((low + high) / 2);
1975
+ if (lineOffsets[mid] > offset) {
1976
+ high = mid;
1977
+ } else {
1978
+ low = mid + 1;
1979
+ }
2193
1980
  }
1981
+ // low is the least x for which the line offset is larger than the current offset
1982
+ // or array.length if no line offset is larger than the current offset
1983
+ var line = low - 1;
1984
+ return Position.create(line, offset - lineOffsets[line]);
1985
+ }
1986
+ }, {
1987
+ key: "offsetAt",
1988
+ value: function offsetAt(position) {
1989
+ var lineOffsets = this.getLineOffsets();
1990
+ if (position.line >= lineOffsets.length) {
1991
+ return this._content.length;
1992
+ } else if (position.line < 0) {
1993
+ return 0;
1994
+ }
1995
+ var lineOffset = lineOffsets[position.line];
1996
+ var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
1997
+ return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
2194
1998
  }
2195
- // low is the least x for which the line offset is larger than the current offset
2196
- // or array.length if no line offset is larger than the current offset
2197
- var line = low - 1;
2198
- return Position.create(line, offset - lineOffsets[line]);
2199
- };
2200
- FullTextDocument.prototype.offsetAt = function (position) {
2201
- var lineOffsets = this.getLineOffsets();
2202
- if (position.line >= lineOffsets.length) {
2203
- return this._content.length;
2204
- } else if (position.line < 0) {
2205
- return 0;
2206
- }
2207
- var lineOffset = lineOffsets[position.line];
2208
- var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
2209
- return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
2210
- };
2211
- Object.defineProperty(FullTextDocument.prototype, "lineCount", {
1999
+ }, {
2000
+ key: "lineCount",
2212
2001
  get: function get() {
2213
2002
  return this.getLineOffsets().length;
2214
- },
2215
- enumerable: false,
2216
- configurable: true
2217
- });
2003
+ }
2004
+ }]);
2218
2005
  return FullTextDocument;
2219
2006
  }();
2220
2007
  var Is;