@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,11 +1,11 @@
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/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-8dc56616'], (function (require, exports, monaco, schema) { 'use strict';
8
+ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-7d65ed04'], (function (require, exports, monaco, schema) { 'use strict';
9
9
 
10
10
  function _interopNamespaceDefault(e) {
11
11
  var n = Object.create(null);
@@ -76,7 +76,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
76
76
  };
77
77
  }
78
78
 
79
- function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "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$2(obj); }
79
+ function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "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$2(o); }
80
80
  function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
81
81
  function _defineProperties$2(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$2(descriptor.key), descriptor); } }
82
82
  function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -143,7 +143,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
143
143
  className: 'selectionHighlight'
144
144
  });
145
145
 
146
- function _typeof$1(obj) { "@babel/helpers - typeof"; return _typeof$1 = "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$1(obj); }
146
+ function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "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$1(o); }
147
147
  function _defineProperties$1(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$1(descriptor.key), descriptor); } }
148
148
  function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
149
149
  function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -182,7 +182,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
182
182
  });
183
183
  });
184
184
 
185
- 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); }
185
+ 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); }
186
186
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
187
187
  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); } }
188
188
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -526,10 +526,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
526
526
  exports.getEntityDataTypeFromCslType = schema.getEntityDataTypeFromCslType;
527
527
  exports.getExpression = schema.getExpression;
528
528
  exports.getInputParametersAsCslString = schema.getInputParametersAsCslString;
529
- Object.defineProperty(exports, 'showSchema', {
530
- enumerable: true,
531
- get: function () { return schema.showSchema; }
532
- });
529
+ exports.showSchema = schema.showSchema;
533
530
  exports.getCurrentCommandRange = getCurrentCommandRange;
534
531
  exports.getKustoWorker = getKustoWorker;
535
532
  exports.kustoDefaults = kustoDefaults;
@@ -1,11 +1,11 @@
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/schema-8dc56616', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/schema-7d65ed04', ['exports'], (function (exports) { 'use strict';
9
9
 
10
10
  // Definition of schema object in the context of language services. This model is exposed to consumers of this library.
11
11
 
@@ -97,13 +97,13 @@ define('vs/language/kusto/schema-8dc56616', ['exports'], (function (exports) { '
97
97
  * This is the schema of the output of kusto command
98
98
  * .show schema as json
99
99
  */
100
- exports.showSchema = void 0;
101
- (function (_showSchema) {})(exports.showSchema || (exports.showSchema = {}));
100
+ var showSchema;
102
101
 
103
102
  exports.getCallName = getCallName;
104
103
  exports.getCslTypeNameFromClrType = getCslTypeNameFromClrType;
105
104
  exports.getEntityDataTypeFromCslType = getEntityDataTypeFromCslType;
106
105
  exports.getExpression = getExpression;
107
106
  exports.getInputParametersAsCslString = getInputParametersAsCslString;
107
+ exports.showSchema = showSchema;
108
108
 
109
109
  }));
@@ -0,0 +1,37 @@
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
2
+ var KustoCommandFormatter = /** @class */ (function () {
3
+ function KustoCommandFormatter(editor) {
4
+ var _this = this;
5
+ this.editor = editor;
6
+ this.actionAdded = false;
7
+ // selection also represents no selection - for example the event gets triggered when moving cursor from point
8
+ // a to point b. in the case start position will equal end position.
9
+ editor.onDidChangeCursorSelection(function (changeEvent) {
10
+ if (_this.editor.getModel().getLanguageId() !== 'kusto') {
11
+ return;
12
+ }
13
+ // Theoretically you would expect this code to run only once in onDidCreateEditor.
14
+ // Turns out that onDidCreateEditor is fired before the IStandaloneEditor is completely created (it is emitted by
15
+ // the super ctor before the child ctor was able to fully run).
16
+ // Thus we don't have a key binding provided yet when onDidCreateEditor is run, which is essential to call addAction.
17
+ // By adding the action here in onDidChangeCursorSelection we're making sure that the editor has a key binding provider,
18
+ // and we just need to make sure that this happens only once.
19
+ if (!_this.actionAdded) {
20
+ editor.addAction({
21
+ id: 'editor.action.kusto.formatCurrentCommand',
22
+ label: 'Format Command Under Cursor',
23
+ keybindings: [
24
+ monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyF),
25
+ ],
26
+ run: function (ed) {
27
+ editor.trigger('KustoCommandFormatter', 'editor.action.formatSelection', null);
28
+ },
29
+ contextMenuGroupId: '1_modification',
30
+ });
31
+ _this.actionAdded = true;
32
+ }
33
+ });
34
+ }
35
+ return KustoCommandFormatter;
36
+ }());
37
+ export default KustoCommandFormatter;
@@ -0,0 +1,52 @@
1
+ import { getCurrentCommandRange } from './extendedEditor';
2
+ /**
3
+ * Highlights the command that surround cursor location
4
+ */
5
+ var KustoCommandHighlighter = /** @class */ (function () {
6
+ /**
7
+ * Register to cursor movement and selection events.
8
+ * @param editor monaco editor instance
9
+ */
10
+ function KustoCommandHighlighter(editor) {
11
+ var _this = this;
12
+ this.editor = editor;
13
+ this.disposables = [];
14
+ this.decorations = [];
15
+ // Note that selection update is triggered not only for selection changes, but also just when no text selection is occurring and cursor just moves around.
16
+ // This case is counted as a 0-length selection starting and ending on the cursor position.
17
+ this.editor.onDidChangeCursorSelection(function (changeEvent) {
18
+ if (_this.editor.getModel().getLanguageId() !== 'kusto') {
19
+ return;
20
+ }
21
+ _this.highlightCommandUnderCursor(changeEvent);
22
+ });
23
+ }
24
+ KustoCommandHighlighter.prototype.getId = function () {
25
+ return KustoCommandHighlighter.ID;
26
+ };
27
+ KustoCommandHighlighter.prototype.dispose = function () {
28
+ this.disposables.forEach(function (d) { return d.dispose(); });
29
+ };
30
+ KustoCommandHighlighter.prototype.highlightCommandUnderCursor = function (changeEvent) {
31
+ // Looks like the user selected a bunch of text. we don't want to highlight the entire command in this case - since highlighting
32
+ // the text is more helpful.
33
+ if (!changeEvent.selection.isEmpty()) {
34
+ this.decorations = this.editor.deltaDecorations(this.decorations, []);
35
+ return;
36
+ }
37
+ var commandRange = getCurrentCommandRange(this.editor, changeEvent.selection.getStartPosition());
38
+ var decorations = [
39
+ {
40
+ range: commandRange,
41
+ options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT,
42
+ },
43
+ ];
44
+ this.decorations = this.editor.deltaDecorations(this.decorations, decorations);
45
+ };
46
+ KustoCommandHighlighter.ID = 'editor.contrib.kustoCommandHighlighter';
47
+ KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT = {
48
+ className: 'selectionHighlight',
49
+ };
50
+ return KustoCommandHighlighter;
51
+ }());
52
+ export default KustoCommandHighlighter;
@@ -0,0 +1,41 @@
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
2
+ export function getCurrentCommandRange(editor, cursorPosition) {
3
+ var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
4
+ var lines = editor.getModel().getLinesContent();
5
+ var commandOrdinal = 0;
6
+ var linesWithCommandOrdinal = [];
7
+ for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
8
+ var isEmptyLine = lines[lineNumber].trim() === '';
9
+ if (isEmptyLine) {
10
+ // increase commandCounter - we'll be starting a new command.
11
+ linesWithCommandOrdinal.push({ commandOrdinal: commandOrdinal++, lineNumber: lineNumber });
12
+ }
13
+ else {
14
+ linesWithCommandOrdinal.push({ commandOrdinal: commandOrdinal, lineNumber: lineNumber });
15
+ }
16
+ // No need to keep scanning if we're past our line and we've seen an empty line.
17
+ if (lineNumber > zeroBasedCursorLineNumber &&
18
+ commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
19
+ break;
20
+ }
21
+ }
22
+ var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
23
+ var currentCommandLines = linesWithCommandOrdinal.filter(function (line) { return line.commandOrdinal === currentCommandOrdinal; });
24
+ var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
25
+ var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
26
+ // End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
27
+ // Start-column of 1 and End column of 2 means 1st character is selected.
28
+ // Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
29
+ var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
30
+ return new monaco.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
31
+ }
32
+ /**
33
+ * Extending ICode editor to contain additional kusto-specific methods.
34
+ * note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
35
+ */
36
+ export function extend(editor) {
37
+ var proto = Object.getPrototypeOf(editor);
38
+ proto.getCurrentCommandRange = function (cursorPosition) {
39
+ getCurrentCommandRange(this, cursorPosition);
40
+ };
41
+ }
@@ -1,6 +1,6 @@
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
  *-----------------------------------------------------------------------------*/
@@ -8,7 +8,7 @@
8
8
  import * as worker from 'monaco-editor/esm/vs/editor/editor.worker';
9
9
  import * as ls from 'vscode-languageserver-types';
10
10
  import XRegExp from 'xregexp';
11
- import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-1d41f705.js';
11
+ import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-ee621489.js';
12
12
  import '@kusto/language-service/bridge.min';
13
13
  import '@kusto/language-service/Kusto.JavaScript.Client.min';
14
14
  import '@kusto/language-service/newtonsoft.json.min';