@kusto/monaco-kusto 6.0.0 → 6.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.
Files changed (52) hide show
  1. package/README.md +757 -0
  2. package/copyMonacoFilesAMD.js +28 -0
  3. package/package.json +14 -34
  4. package/release/dev/Kusto.Language.Bridge.min.js +2 -0
  5. package/release/dev/bridge.min.js +7 -0
  6. package/release/dev/commandFormatter.d.ts +1 -1
  7. package/release/dev/commandHighlighter.d.ts +2 -2
  8. package/release/dev/extendedEditor.d.ts +1 -1
  9. package/release/dev/kusto.javascript.client.min.js +1 -0
  10. package/release/dev/kustoMode.d.ts +3 -1
  11. package/release/dev/kustoMode.js +57 -24
  12. package/release/dev/kustoWorker.d.ts +5 -8
  13. package/release/dev/kustoWorker.js +146 -123
  14. package/release/dev/languageFeatures.d.ts +1 -1
  15. package/release/dev/languageService/kustoLanguageService.d.ts +3 -1
  16. package/release/dev/languageService/kustoMonarchLanguageDefinition.d.ts +2 -1
  17. package/release/dev/languageService/renderInfo.d.ts +5 -5
  18. package/release/dev/{main-24a15f15.js → main-068f3954.js} +2 -2
  19. package/release/dev/monaco.contribution.d.ts +3 -3
  20. package/release/dev/monaco.contribution.js +6 -10
  21. package/release/dev/newtonsoft.json.min.js +7 -0
  22. package/release/dev/workerManager.d.ts +1 -1
  23. package/release/esm/commandFormatter.d.ts +1 -1
  24. package/release/esm/commandHighlighter.d.ts +2 -2
  25. package/release/esm/extendedEditor.d.ts +1 -1
  26. package/release/esm/kusto.worker.js +50 -39
  27. package/release/esm/kustoMode.d.ts +3 -1
  28. package/release/esm/kustoMode.js +45 -17
  29. package/release/esm/kustoWorker.d.ts +5 -8
  30. package/release/esm/languageFeatures.d.ts +1 -1
  31. package/release/esm/languageService/kustoLanguageService.d.ts +3 -1
  32. package/release/esm/languageService/kustoMonarchLanguageDefinition.d.ts +2 -1
  33. package/release/esm/languageService/renderInfo.d.ts +5 -5
  34. package/release/esm/monaco.contribution.d.ts +3 -3
  35. package/release/esm/monaco.contribution.js +8 -9
  36. package/release/esm/workerManager.d.ts +1 -1
  37. package/release/min/commandFormatter.d.ts +1 -1
  38. package/release/min/commandHighlighter.d.ts +2 -2
  39. package/release/min/extendedEditor.d.ts +1 -1
  40. package/release/min/kustoMode.d.ts +3 -1
  41. package/release/min/kustoMode.js +2 -2
  42. package/release/min/kustoWorker.d.ts +5 -8
  43. package/release/min/kustoWorker.js +4 -4
  44. package/release/min/languageFeatures.d.ts +1 -1
  45. package/release/min/languageService/kustoLanguageService.d.ts +3 -1
  46. package/release/min/languageService/kustoMonarchLanguageDefinition.d.ts +2 -1
  47. package/release/min/languageService/renderInfo.d.ts +5 -5
  48. package/release/min/{main-1108181b.js → main-f5378257.js} +2 -2
  49. package/release/min/monaco.contribution.d.ts +3 -3
  50. package/release/min/monaco.contribution.js +2 -2
  51. package/release/min/workerManager.d.ts +1 -1
  52. package/release/monaco.d.ts +1 -1
@@ -1,8 +1,10 @@
1
+ /// <reference types="../monaco" />
2
+ /// <reference types="monaco-editor/monaco" />
1
3
  import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
2
4
  import { WorkerAccessor } from './languageFeatures';
3
5
  /**
4
6
  * Called when Kusto language is first needed (a model has the language set)
5
7
  * @param defaults
6
8
  */
7
- export declare function setupMode(defaults: LanguageServiceDefaultsImpl, monacoInstance: any): WorkerAccessor;
9
+ export declare function setupMode(defaults: LanguageServiceDefaultsImpl, monacoInstance: typeof monaco): WorkerAccessor;
8
10
  export declare function getKustoWorker(): Promise<WorkerAccessor>;
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.0.0(d333d5bf2aa3d56b17120ed36803a7fb5bcfb87a)
3
+ * monaco-kusto version: 6.1.1(678731e78268dbe877b517e302fa7db86fd96b3c)
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/kustoMode', ['exports', './main-24a15f15'], (function (exports, main) { 'use strict';
8
+ define('vs/language/kusto/kustoMode', ['exports', './main-068f3954'], (function (exports, main) { 'use strict';
9
9
 
10
10
  var _excluded = ["onDidProvideCompletionItems"];
11
11
  function _typeof$7(obj) { "@babel/helpers - typeof"; return _typeof$7 = "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$7(obj); }
@@ -135,10 +135,13 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
135
135
  displayName: 'Kusto',
136
136
  defaultToken: 'invalid',
137
137
  brackets: [['[', ']', 'delimiter.square'], ['(', ')', 'delimiter.parenthesis']],
138
+ // types are wrong
138
139
  wordDefinition: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
139
140
  // .slice() call is for creating a shallow copy of the array since bridge.net shoves a $type property on the array which monaco doesn't like.
140
- promotedOperatorCommandTokens: Kusto.Data.IntelliSense.CslCommandParser.PromotedOperatorCommandTokens.slice(0),
141
- operatorCommandTokens: Kusto.Data.IntelliSense.CslCommandParser.OperatorCommandTokens.slice(0),
141
+ // Kusto.Data.IntelliSense.CslCommandParser.PromotedOperatorCommandTokens.slice(0),
142
+ promotedOperatorCommandTokens: ['where', 'count', 'extend', 'join', 'limit', 'order', 'project', 'project-away', 'project-rename', 'project-reorder', 'project-keep', 'render', 'sort', 'summarize', 'distinct', 'take', 'top', 'top-nested', 'top-hitters', 'union', 'mv-expand', 'mv-apply', 'reduce', 'evaluate', 'parse', 'parse-where', 'parse-kv', 'sample', 'sample-distinct', 'make-series', 'getschema', 'serialize', 'invoke', 'as', 'scan'],
143
+ // Kusto.Data.IntelliSense.CslCommandParser.OperatorCommandTokens.slice(0),
144
+ operatorCommandTokens: ['filter', 'fork', 'facet', 'range', 'consume', 'find', 'search', 'print', 'partition', 'lookup', 'where', 'count', 'extend', 'join', 'limit', 'order', 'project', 'project-away', 'project-rename', 'project-reorder', 'project-keep', 'render', 'sort', 'summarize', 'distinct', 'take', 'top', 'top-nested', 'top-hitters', 'union', 'mv-expand', 'mv-apply', 'reduce', 'evaluate', 'parse', 'parse-where', 'parse-kv', 'sample', 'sample-distinct', 'make-series', 'getschema', 'serialize', 'invoke', 'as', 'scan'],
142
145
  keywords: ['by', 'on', 'contains', 'notcontains', 'containscs', 'notcontainscs', 'startswith', 'has', 'matches', 'regex', 'true', 'false', 'and', 'or', 'typeof', 'int', 'string', 'date', 'datetime', 'time', 'long', 'real', '​boolean', 'bool'],
143
146
  operators: ['+', '-', '*', '/', '>', '<', '==', '<>', '<=', '>=', '~', '!~'],
144
147
  builtinFunctions: ['countof', 'bin', 'extentid', 'extract', 'extractjson', 'floor', 'iif', 'isnull', 'isnotnull', 'notnull', 'isempty', 'isnotempty', 'notempty', 'now', 're2', 'strcat', 'strlen', 'toupper', 'tostring', 'count', 'cnt', 'sum', 'min', 'max', 'avg'],
@@ -673,7 +676,11 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
673
676
  return debounced;
674
677
  }
675
678
 
676
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
679
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
680
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest(); }
681
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
682
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
683
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
677
684
  function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); }
678
685
  function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
679
686
  function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
@@ -696,7 +703,6 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
696
703
  monaco.Thenable;
697
704
  monaco.CancellationToken;
698
705
  monaco.IDisposable;
699
- var ClassificationKind = Kusto.Language.Editor.ClassificationKind;
700
706
  var DiagnosticsAdapter = /*#__PURE__*/function () {
701
707
  function DiagnosticsAdapter(_monacoInstance, _languageId, _worker, defaults, onSchemaChange) {
702
708
  var _this = this;
@@ -861,14 +867,14 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
861
867
  while (1) switch (_context2.prev = _context2.next) {
862
868
  case 0:
863
869
  codeAction = codeActions[i];
864
- if (!codeAction.title.includes('Extract Function')) {
870
+ if (!codeAction.kind.includes('Extract Function')) {
865
871
  _context2.next = 3;
866
872
  break;
867
873
  }
868
874
  return _context2.abrupt("return", "continue");
869
875
  case 3:
870
- codeActionKind = (_this2$defaults$langu = _this2.defaults.languageSettings.quickFixCodeActions) !== null && _this2$defaults$langu !== void 0 && _this2$defaults$langu.find(function (actionTitle) {
871
- return codeAction.title.includes(actionTitle);
876
+ codeActionKind = (_this2$defaults$langu = _this2.defaults.languageSettings.quickFixCodeActions) !== null && _this2$defaults$langu !== void 0 && _this2$defaults$langu.find(function (actionKind) {
877
+ return codeAction.kind.includes(actionKind);
872
878
  }) ? 'quickfix' : 'custom';
873
879
  if (!(codeActionKind === 'quickfix' && !enableQuickFix)) {
874
880
  _context2.next = 6;
@@ -1089,6 +1095,44 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
1089
1095
  source: diag.source
1090
1096
  };
1091
1097
  }
1098
+ /**
1099
+ * Copy of Kusto.Language.Editor.ClassificationKind we don't have to depend on it in this file
1100
+ */
1101
+ var ClassificationKind = {
1102
+ PlainText: 0,
1103
+ Comment: 1,
1104
+ Punctuation: 2,
1105
+ Directive: 3,
1106
+ Literal: 4,
1107
+ StringLiteral: 5,
1108
+ Type: 6,
1109
+ Column: 7,
1110
+ Table: 8,
1111
+ Database: 9,
1112
+ Function: 10,
1113
+ Parameter: 11,
1114
+ Variable: 12,
1115
+ Identifier: 13,
1116
+ ClientParameter: 14,
1117
+ QueryParameter: 15,
1118
+ ScalarOperator: 16,
1119
+ MathOperator: 17,
1120
+ QueryOperator: 18,
1121
+ Command: 19,
1122
+ Keyword: 20,
1123
+ MaterializedView: 21,
1124
+ SchemaMember: 22,
1125
+ SignatureParameter: 23,
1126
+ Option: 24
1127
+ };
1128
+ var ClassificationKindNames = {};
1129
+ for (var _i = 0, _Object$entries = Object.entries(ClassificationKind); _i < _Object$entries.length; _i++) {
1130
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
1131
+ key = _Object$entries$_i[0],
1132
+ value = _Object$entries$_i[1];
1133
+ ClassificationKindNames[value] = key;
1134
+ }
1135
+
1092
1136
  // commented here is the color definitions are were defined by v1 intellisense terminology:
1093
1137
  // { token: 'comment', foreground: '008000' }, // CommentToken Green
1094
1138
  // { token: 'variable.predefined', foreground: '800080' }, // CalculatedColumnToken Purple
@@ -1226,8 +1270,8 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
1226
1270
  }));
1227
1271
  this._disposables.push({
1228
1272
  dispose: function dispose() {
1229
- for (var key in _this5._contentListener) {
1230
- _this5._contentListener[key].dispose();
1273
+ for (var _key3 in _this5._contentListener) {
1274
+ _this5._contentListener[_key3].dispose();
1231
1275
  }
1232
1276
  }
1233
1277
  });
@@ -1323,22 +1367,11 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
1323
1367
  return ColorizationAdapter;
1324
1368
  }();
1325
1369
 
1326
- /**
1327
- * Gets all keys of an enum (the string keys not the numeric values).
1328
- * @param e Enum type
1329
- */
1330
- function getEnumKeys(e) {
1331
- return Object.keys(e).filter(function (k) {
1332
- return typeof e[k] === 'number';
1333
- });
1334
- }
1335
-
1336
1370
  /**
1337
1371
  * Generates a mapping between ClassificationKind and color.
1338
1372
  */
1339
1373
  function getClassificationColorTriplets() {
1340
- var keys = getEnumKeys(ClassificationKind);
1341
- var result = keys.map(function (key) {
1374
+ var result = Object.keys(ClassificationKind).map(function (key) {
1342
1375
  return {
1343
1376
  classification: key,
1344
1377
  colorLight: classificationToColorLight[key],
@@ -1379,7 +1412,7 @@ define('vs/language/kusto/kustoMode', ['exports', './main-24a15f15'], (function
1379
1412
  var start = model.getPositionAt(classification.start);
1380
1413
  var end = model.getPositionAt(classification.start + classification.length);
1381
1414
  var range = new Range(start.lineNumber, start.column, end.lineNumber, end.column);
1382
- var inlineClassName = ClassificationKind.$names[classification.kind];
1415
+ var inlineClassName = ClassificationKindNames[classification.kind];
1383
1416
  return {
1384
1417
  range: range,
1385
1418
  options: {
@@ -1,18 +1,16 @@
1
- /// <reference types="monaco-editor-core/monaco" />
2
- type IWorkerContext = monaco.worker.IWorkerContext;
1
+ /// <reference types="monaco-editor/monaco" />
2
+ import * as ls from 'vscode-languageserver-types';
3
3
  import * as kustoService from './languageService/kustoLanguageService';
4
4
  import type { LanguageSettings } from './languageService/settings';
5
5
  import { Schema, showSchema, ScalarParameter, Database, TabularParameter } from './languageService/schema';
6
- import * as ls from 'vscode-languageserver-types';
7
6
  import type { ColorizationRange } from './languageService/kustoLanguageService';
8
7
  import type { RenderInfo } from './languageService/renderInfo';
9
- import type { FoldingRange } from 'vscode-languageserver-types';
10
8
  export declare class KustoWorker {
11
9
  private _ctx;
12
10
  private _languageService;
13
11
  private _languageId;
14
12
  private _languageSettings;
15
- constructor(ctx: IWorkerContext, createData: ICreateData);
13
+ constructor(ctx: monaco.worker.IWorkerContext, createData: ICreateData);
16
14
  setSchema(schema: Schema): Promise<void>;
17
15
  addClusterToSchema(uri: string, clusterName: string, databasesNames: string[]): Promise<void>;
18
16
  addDatabaseToSchema(uri: string, clusterName: string, databaseSchema: Database): Promise<void>;
@@ -60,7 +58,7 @@ export declare class KustoWorker {
60
58
  }[], includeWarnings?: boolean, includeSuggestions?: boolean): Promise<ls.Diagnostic[]>;
61
59
  getResultActions(uri: string, start: number, end: number): Promise<kustoService.ResultAction[]>;
62
60
  doRangeFormat(uri: string, range: ls.Range): Promise<ls.TextEdit[]>;
63
- doFolding(uri: string): Promise<FoldingRange[]>;
61
+ doFolding(uri: string): Promise<ls.FoldingRange[]>;
64
62
  doDocumentFormat(uri: string): Promise<ls.TextEdit[]>;
65
63
  doCurrentCommandFormat(uri: string, caretPosition: ls.Position): Promise<ls.TextEdit[]>;
66
64
  doColorization(uri: string, colorizationIntervals: {
@@ -88,5 +86,4 @@ export interface ICreateData {
88
86
  languageId: string;
89
87
  languageSettings: LanguageSettings;
90
88
  }
91
- export declare function create(ctx: IWorkerContext, createData: ICreateData): KustoWorker;
92
- export {};
89
+ export declare function create(ctx: monaco.worker.IWorkerContext, createData: ICreateData): KustoWorker;
@@ -1,94 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.0.0(d333d5bf2aa3d56b17120ed36803a7fb5bcfb87a)
3
+ * monaco-kusto version: 6.1.1(678731e78268dbe877b517e302fa7db86fd96b3c)
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/kustoWorker', ['exports', './main-24a15f15'], (function (exports, main) { 'use strict';
9
-
10
- // Definition of schema object in the context of language services. This model is exposed to consumers of this library.
11
-
12
- // an input parameter either be a scalar in which case it has a name, type and cslType, or it can be columnar, in which case
13
- // it will have a name, and a list of scalar types which are the column types.
14
-
15
- /**
16
- * Schema types:
17
- * Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
18
- * Cluster Manager – Internal only. A schema for clusters that manages other clusters.
19
- * Data Management – Internal only. A schema for ingestion point operations.
20
- */
21
-
22
- var dotnetTypeToKustoType = {
23
- 'System.SByte': 'bool',
24
- 'System.Byte': 'uint8',
25
- 'System.Int16': 'int16',
26
- 'System.UInt16': 'uint16',
27
- 'System.Int32': 'int',
28
- 'System.UInt32': 'uint',
29
- 'System.Int64': 'long',
30
- 'System.UInt64': 'ulong',
31
- 'System.String': 'string',
32
- 'System.Single': 'float',
33
- 'System.Double': 'real',
34
- 'System.DateTime': 'datetime',
35
- 'System.TimeSpan': 'timespan',
36
- 'System.Guid': 'guid',
37
- 'System.Boolean': 'bool',
38
- 'Newtonsoft.Json.Linq.JArray': 'dynamic',
39
- 'Newtonsoft.Json.Linq.JObject': 'dynamic',
40
- 'Newtonsoft.Json.Linq.JToken': 'dynamic',
41
- 'System.Object': 'dynamic',
42
- 'System.Data.SqlTypes.SqlDecimal': 'decimal'
43
- };
44
- var getCslTypeNameFromClrType = function getCslTypeNameFromClrType(clrType) {
45
- return dotnetTypeToKustoType[clrType] || clrType;
46
- };
47
- var kustoTypeToEntityDataType = {
48
- object: 'Object',
49
- bool: 'Boolean',
50
- uint8: 'Byte',
51
- int16: 'Int16',
52
- uint16: 'UInt16',
53
- int: 'Int32',
54
- uint: 'UInt32',
55
- long: 'Int64',
56
- ulong: 'UInt64',
57
- float: 'Single',
58
- real: 'Double',
59
- decimal: 'Decimal',
60
- datetime: 'DateTime',
61
- string: 'String',
62
- dynamic: 'Dynamic',
63
- timespan: 'TimeSpan'
64
- };
65
- var getEntityDataTypeFromCslType = function getEntityDataTypeFromCslType(cslType) {
66
- return kustoTypeToEntityDataType[cslType] || cslType;
67
- };
68
- var getCallName = function getCallName(fn) {
69
- return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) {
70
- return "{".concat(p.name, "}");
71
- }).join(','), ")");
72
- };
73
- var getExpression = function getExpression(fn) {
74
- return "let ".concat(fn.name, " = ").concat(getInputParametersAsCslString(fn.inputParameters), " ").concat(fn.body);
75
- };
76
- var getInputParametersAsCslString = function getInputParametersAsCslString(inputParameters) {
77
- return "(".concat(inputParameters.map(function (inputParameter) {
78
- return getInputParameterAsCslString(inputParameter);
79
- }).join(','), ")");
80
- };
81
- var getInputParameterAsCslString = function getInputParameterAsCslString(inputParameter) {
82
- // If this is a tabular parameter
83
- if (inputParameter.columns && inputParameter.columns.length > 0) {
84
- var attributesAsString = inputParameter.columns.map(function (col) {
85
- return "".concat(col.name, ":").concat(col.cslType || getCslTypeNameFromClrType(col.type));
86
- }).join(',');
87
- return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
88
- } else {
89
- return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
90
- }
91
- };
8
+ define('vs/language/kusto/kustoWorker', ['exports', './main-068f3954'], (function (exports, main) { 'use strict';
92
9
 
93
10
  function _slicedToArray$2(arr, i) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$2(); }
94
11
  function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -3517,6 +3434,104 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
3517
3434
  unicodeProperties(XRegExp);
3518
3435
  unicodeScripts(XRegExp);
3519
3436
 
3437
+ // Definition of schema object in the context of language services. This model is exposed to consumers of this library.
3438
+
3439
+ // an input parameter either be a scalar in which case it has a name, type and cslType, or it can be columnar, in which case
3440
+ // it will have a name, and a list of scalar types which are the column types.
3441
+
3442
+ /**
3443
+ * Schema types:
3444
+ * Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
3445
+ * Cluster Manager – Internal only. A schema for clusters that manages other clusters.
3446
+ * Data Management – Internal only. A schema for ingestion point operations.
3447
+ */
3448
+
3449
+ var dotnetTypeToKustoType = {
3450
+ 'System.SByte': 'bool',
3451
+ 'System.Byte': 'uint8',
3452
+ 'System.Int16': 'int16',
3453
+ 'System.UInt16': 'uint16',
3454
+ 'System.Int32': 'int',
3455
+ 'System.UInt32': 'uint',
3456
+ 'System.Int64': 'long',
3457
+ 'System.UInt64': 'ulong',
3458
+ 'System.String': 'string',
3459
+ 'System.Single': 'float',
3460
+ 'System.Double': 'real',
3461
+ 'System.DateTime': 'datetime',
3462
+ 'System.TimeSpan': 'timespan',
3463
+ 'System.Guid': 'guid',
3464
+ 'System.Boolean': 'bool',
3465
+ 'Newtonsoft.Json.Linq.JArray': 'dynamic',
3466
+ 'Newtonsoft.Json.Linq.JObject': 'dynamic',
3467
+ 'Newtonsoft.Json.Linq.JToken': 'dynamic',
3468
+ 'System.Object': 'dynamic',
3469
+ 'System.Data.SqlTypes.SqlDecimal': 'decimal'
3470
+ };
3471
+ var getCslTypeNameFromClrType = function getCslTypeNameFromClrType(clrType) {
3472
+ return dotnetTypeToKustoType[clrType] || clrType;
3473
+ };
3474
+ var kustoTypeToEntityDataType = {
3475
+ object: 'Object',
3476
+ bool: 'Boolean',
3477
+ uint8: 'Byte',
3478
+ int16: 'Int16',
3479
+ uint16: 'UInt16',
3480
+ int: 'Int32',
3481
+ uint: 'UInt32',
3482
+ long: 'Int64',
3483
+ ulong: 'UInt64',
3484
+ float: 'Single',
3485
+ real: 'Double',
3486
+ decimal: 'Decimal',
3487
+ datetime: 'DateTime',
3488
+ string: 'String',
3489
+ dynamic: 'Dynamic',
3490
+ timespan: 'TimeSpan'
3491
+ };
3492
+ var getEntityDataTypeFromCslType = function getEntityDataTypeFromCslType(cslType) {
3493
+ return kustoTypeToEntityDataType[cslType] || cslType;
3494
+ };
3495
+ var getCallName = function getCallName(fn) {
3496
+ return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) {
3497
+ return "{".concat(p.name, "}");
3498
+ }).join(','), ")");
3499
+ };
3500
+ var getExpression = function getExpression(fn) {
3501
+ return "let ".concat(fn.name, " = ").concat(getInputParametersAsCslString(fn.inputParameters), " ").concat(fn.body);
3502
+ };
3503
+ var getInputParametersAsCslString = function getInputParametersAsCslString(inputParameters) {
3504
+ return "(".concat(inputParameters.map(function (inputParameter) {
3505
+ return getInputParameterAsCslString(inputParameter);
3506
+ }).join(','), ")");
3507
+ };
3508
+ var getInputParameterAsCslString = function getInputParameterAsCslString(inputParameter) {
3509
+ // If this is a tabular parameter
3510
+ if (inputParameter.columns && inputParameter.columns.length > 0) {
3511
+ var attributesAsString = inputParameter.columns.map(function (col) {
3512
+ return "".concat(col.name, ":").concat(col.cslType || getCslTypeNameFromClrType(col.type));
3513
+ }).join(',');
3514
+ return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
3515
+ } else {
3516
+ return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
3517
+ }
3518
+ };
3519
+
3520
+ // If we're running in a web worker - which doesn't share global context with the main thread -
3521
+ // we need to manually load dependencies that are not explicit- meaning our non-module dependencies
3522
+ // generated by Bridge.Net
3523
+ if (typeof document == 'undefined') {
3524
+ // monaco will run the worker from vs/base/worker so the relative path needs
3525
+ // to be from there (hence going up 2 dirs) This stinks because we're
3526
+ // requiring the host app to put files in specific locations
3527
+ importScripts(
3528
+ '../../language/kusto/bridge.min.js',
3529
+ '../../language/kusto/kusto.javascript.client.min.js',
3530
+ '../../language/kusto/newtonsoft.json.min.js',
3531
+ '../../language/kusto/Kusto.Language.Bridge.min.js'
3532
+ );
3533
+ }
3534
+
3520
3535
  var _symbolKindToName;
3521
3536
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest(); }
3522
3537
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -3537,29 +3552,8 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
3537
3552
  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; }
3538
3553
  function _toPropertyKey$1(arg) { var key = _toPrimitive$1(arg, "string"); return _typeof$1(key) === "symbol" ? key : String(key); }
3539
3554
  function _toPrimitive$1(input, hint) { if (_typeof$1(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof$1(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3540
-
3541
- // polyfill string endsWith
3542
- if (!String.prototype.endsWith) {
3543
- String.prototype.endsWith = function (search, this_len) {
3544
- if (this_len === undefined || this_len > this.length) {
3545
- this_len = this.length;
3546
- }
3547
- return this.substring(this_len - search.length, this_len) === search;
3548
- };
3549
- }
3550
-
3551
- // If we're running in a web worker - which doesn't share global context with the main thread -
3552
- // we need to manually load dependencies that are not explicit- meaning our non-module dependencies
3553
- // generated by Bridge.Net
3554
- if (typeof document == 'undefined') {
3555
- // monaco will run the worker from vs/base/worker so the relative path needs to be from there (hence going up 2 dirs)
3556
- importScripts('../../language/kusto/bridge.min.js');
3557
- importScripts('../../language/kusto/kusto.javascript.client.min.js');
3558
- importScripts('../../language/kusto/Kusto.Language.Bridge.min.js');
3559
- }
3560
3555
  var k = Kusto.Data.IntelliSense;
3561
3556
  var parsing = Kusto.Language.Parsing;
3562
- Kusto.Language.Syntax;
3563
3557
  var k2 = Kusto.Language.Editor;
3564
3558
  var sym = Kusto.Language.Symbols;
3565
3559
  var GlobalState = Kusto.Language.GlobalState;
@@ -3586,15 +3580,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
3586
3580
  }]);
3587
3581
  return ParseProperties;
3588
3582
  }();
3589
- var TokenKind;
3590
-
3591
- /**
3592
- * A plain old javascript object that is roughly equivalent to the @kusto/language-service-next object, but without
3593
- * all the Bridge.Net properties and methods. this object is being sent from web worker to main thread and turns out
3594
- * that when posting the message we lose all properties (and functions), thus we use a POJO instead.
3595
- * This issue started happening once upgrading to 0.20.0 from 0.15.5.
3596
- */
3597
- (function (TokenKind) {
3583
+ var TokenKind = /*#__PURE__*/function (TokenKind) {
3598
3584
  TokenKind[TokenKind["TableToken"] = 2] = "TableToken";
3599
3585
  TokenKind[TokenKind["TableColumnToken"] = 4] = "TableColumnToken";
3600
3586
  TokenKind[TokenKind["OperatorToken"] = 8] = "OperatorToken";
@@ -3614,7 +3600,16 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
3614
3600
  TokenKind[TokenKind["PluginToken"] = 131072] = "PluginToken";
3615
3601
  TokenKind[TokenKind["BracketRangeToken"] = 262144] = "BracketRangeToken";
3616
3602
  TokenKind[TokenKind["ClientDirectiveToken"] = 524288] = "ClientDirectiveToken";
3617
- })(TokenKind || (TokenKind = {}));
3603
+ return TokenKind;
3604
+ }({});
3605
+
3606
+ /**
3607
+ * A plain old javascript object that is roughly equivalent to the @kusto/language-service-next object, but without
3608
+ * all the Bridge.Net properties and methods. this object is being sent from web worker to main thread and turns out
3609
+ * that when posting the message we lose all properties (and functions), thus we use a POJO instead.
3610
+ * This issue started happening once upgrading to 0.20.0 from 0.15.5.
3611
+ */
3612
+
3618
3613
  /**
3619
3614
  * convert the bridge.net object to a plain javascript object that only contains data.
3620
3615
  * @param k2Classifications @kusto/language-service-next bridge.net object
@@ -4107,12 +4102,12 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
4107
4102
  start: start,
4108
4103
  end: end
4109
4104
  }])[0];
4110
- var codeActionInfo = block.Service.GetCodeActions(start, start, end - start + 1, null, true, null, new Kusto.Language.Utils.CancellationToken());
4105
+ var codeActionInfo = block.Service.GetCodeActions(start, start, 0, null, true, null, new Kusto.Language.Utils.CancellationToken());
4111
4106
  var codeActions = this.toArray(codeActionInfo.Actions);
4112
4107
  // Some code actions are of type "MenuAction". We want to flat them out, to show them seperately.
4113
4108
  var flatCodeActions = [];
4114
4109
  for (var i = 0; i < codeActions.length; i++) {
4115
- flatCodeActions.push.apply(flatCodeActions, _toConsumableArray(this.flattenCodeActions(codeActions[i])));
4110
+ flatCodeActions.push.apply(flatCodeActions, _toConsumableArray(this.flattenCodeActions(codeActions[i], null)));
4116
4111
  }
4117
4112
  return flatCodeActions;
4118
4113
  }
@@ -4143,23 +4138,47 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
4143
4138
  }
4144
4139
  return {
4145
4140
  title: applyCodeAction.Title,
4146
- changes: changes
4141
+ changes: changes,
4142
+ kind: applyCodeAction.Kind
4147
4143
  };
4148
4144
  }).filter(function (resultAction) {
4149
4145
  return resultAction.changes.length;
4150
4146
  });
4151
4147
  return Promise.resolve(resultActionsMap);
4152
4148
  }
4149
+ }, {
4150
+ key: "transformCodeActionTitle",
4151
+ value: function transformCodeActionTitle(currentActionTitle, parentActionTitle) {
4152
+ var title = currentActionTitle;
4153
+ switch (title) {
4154
+ case 'Apply':
4155
+ title = 'Apply once';
4156
+ break;
4157
+ case 'Fix All':
4158
+ title = 'Apply to all';
4159
+ break;
4160
+ case 'Extract Value':
4161
+ title = 'Extract value';
4162
+ break;
4163
+ }
4164
+ if (parentActionTitle) {
4165
+ // We want to lower case the first character since it's going to be in brackets
4166
+ var parentActionTitleLowerCased = parentActionTitle.charAt(0).toUpperCase() + parentActionTitle.slice(1);
4167
+ title = "".concat(title, " (").concat(parentActionTitleLowerCased, ")");
4168
+ }
4169
+ return title;
4170
+ }
4153
4171
  }, {
4154
4172
  key: "flattenCodeActions",
4155
- value: function flattenCodeActions(codeAction) {
4173
+ value: function flattenCodeActions(codeAction, parentTitle) {
4156
4174
  var applyActions = [];
4157
4175
  if (codeAction instanceof k2.ApplyAction) {
4176
+ codeAction.Title = this.transformCodeActionTitle(codeAction.Title, parentTitle);
4158
4177
  applyActions.push(codeAction);
4159
4178
  } else if (codeAction instanceof k2.MenuAction) {
4160
4179
  var nestedCodeActions = this.toArray(codeAction.Actions);
4161
4180
  for (var i = 0; i < nestedCodeActions.length; i++) {
4162
- applyActions.push.apply(applyActions, _toConsumableArray(this.flattenCodeActions(nestedCodeActions[i])));
4181
+ applyActions.push.apply(applyActions, _toConsumableArray(this.flattenCodeActions(nestedCodeActions[i], codeAction.Title)));
4163
4182
  }
4164
4183
  }
4165
4184
  return applyActions;
@@ -5775,9 +5794,13 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-24a15f15'], (functio
5775
5794
  _result$location$rang = result.location.range,
5776
5795
  start = _result$location$rang.start,
5777
5796
  end = _result$location$rang.end;
5778
- var range = new monaco.Range(start.line + 1, start.character + 1, end.line + 1, end.character + 1);
5779
5797
  return {
5780
- range: range,
5798
+ range: {
5799
+ startLineNumber: start.line + 1,
5800
+ startColumn: start.character + 1,
5801
+ endLineNumber: end.line + 1,
5802
+ endColumn: end.character + 1
5803
+ },
5781
5804
  text: text
5782
5805
  };
5783
5806
  });
@@ -1,4 +1,4 @@
1
- /// <reference types="monaco-editor-core/monaco" />
1
+ /// <reference types="monaco-editor/monaco" />
2
2
  /// <reference types="../monaco" />
3
3
  import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
4
4
  import type { KustoWorker } from './kustoWorker';
@@ -1,10 +1,11 @@
1
1
  /// <reference types="@kusto/language-service-next/Kusto.Language.Bridge" />
2
2
  /// <reference types="@kusto/language-service/Kusto.JavaScript.Client" />
3
- import * as s from './schema';
4
3
  import * as ls from 'vscode-languageserver-types';
5
4
  import type { TextDocument } from 'vscode-languageserver-textdocument';
6
5
  import type { FoldingRange } from 'vscode-languageserver-types';
6
+ import * as s from './schema';
7
7
  import type { LanguageSettings } from './settings';
8
+ import 'language-service';
8
9
  import k = Kusto.Data.IntelliSense;
9
10
  import k2 = Kusto.Language.Editor;
10
11
  import { Database } from './schema';
@@ -57,6 +58,7 @@ export interface ResultAction {
57
58
  deleteLength: number;
58
59
  insertText: string | null;
59
60
  }[];
61
+ kind: string;
60
62
  }
61
63
  export interface LanguageService {
62
64
  doComplete(document: TextDocument, position: ls.Position): Promise<ls.CompletionList>;
@@ -1 +1,2 @@
1
- export declare const KustoLanguageDefinition: any;
1
+ /// <reference types="monaco-editor/monaco" />
2
+ export declare const KustoLanguageDefinition: monaco.languages.IMonarchLanguage;
@@ -1,8 +1,8 @@
1
- export declare type VisualizationType = 'anomalychart' | 'areachart' | 'barchart' | 'columnchart' | 'ladderchart' | 'linechart' | 'piechart' | 'pivotchart' | 'scatterchart' | 'stackedareachart' | 'timechart' | 'table' | 'timeline' | 'timepivot' | 'card';
2
- export declare type Scale = 'linear' | 'log';
3
- export declare type LegendVisibility = 'visible' | 'hidden';
4
- export declare type YSplit = 'none' | 'axes' | 'panels';
5
- export declare type Kind = 'default' | 'unstacked' | 'stacked' | 'stacked100' | 'map';
1
+ export type VisualizationType = 'anomalychart' | 'areachart' | 'barchart' | 'columnchart' | 'ladderchart' | 'linechart' | 'piechart' | 'pivotchart' | 'scatterchart' | 'stackedareachart' | 'timechart' | 'table' | 'timeline' | 'timepivot' | 'card';
2
+ export type Scale = 'linear' | 'log';
3
+ export type LegendVisibility = 'visible' | 'hidden';
4
+ export type YSplit = 'none' | 'axes' | 'panels';
5
+ export type Kind = 'default' | 'unstacked' | 'stacked' | 'stacked100' | 'map';
6
6
  export interface RenderOptions {
7
7
  visualization?: null | VisualizationType;
8
8
  title?: null | string;
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.0.0(d333d5bf2aa3d56b17120ed36803a7fb5bcfb87a)
3
+ * monaco-kusto version: 6.1.1(678731e78268dbe877b517e302fa7db86fd96b3c)
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-24a15f15', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/main-068f3954', ['exports'], (function (exports) { 'use strict';
9
9
 
10
10
  /* --------------------------------------------------------------------------------------------
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,12 +1,12 @@
1
1
  /// <reference types="../monaco" />
2
- /// <reference types="monaco-editor-core/monaco" />
3
- import IEvent = monaco.IEvent;
2
+ /// <reference types="monaco-editor/monaco" />
3
+ import 'monaco-editor';
4
4
  export declare class LanguageServiceDefaultsImpl implements monaco.languages.kusto.LanguageServiceDefaults {
5
5
  private _onDidChange;
6
6
  private _languageSettings;
7
7
  private _workerMaxIdleTime;
8
8
  constructor(languageSettings: monaco.languages.kusto.LanguageSettings);
9
- get onDidChange(): IEvent<monaco.languages.kusto.LanguageServiceDefaults>;
9
+ get onDidChange(): monaco.IEvent<monaco.languages.kusto.LanguageServiceDefaults>;
10
10
  get languageSettings(): monaco.languages.kusto.LanguageSettings;
11
11
  setLanguageSettings(options: monaco.languages.kusto.LanguageSettings): void;
12
12
  setMaximumWorkerIdleTime(value: number): void;