@kusto/monaco-kusto 5.3.10 → 5.3.11

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.
@@ -95,13 +95,12 @@ define('vs/language/kusto/commandFormatter',["require", "exports"], function (re
95
95
  exports.default = KustoCommandFormatter;
96
96
  });
97
97
 
98
- /// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
99
98
  define('vs/language/kusto/extendedEditor',["require", "exports"], function (require, exports) {
100
99
  "use strict";
101
100
  Object.defineProperty(exports, "__esModule", { value: true });
102
101
  exports.extend = void 0;
103
102
  /**
104
- * Extending ICode editor to contain additional kusto-speicifc methods.
103
+ * Extending ICode editor to contain additional kusto-specific methods.
105
104
  * note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
106
105
  */
107
106
  function extend(editor) {
@@ -122,7 +121,8 @@ define('vs/language/kusto/extendedEditor',["require", "exports"], function (requ
122
121
  linesWithCommandOrdinal.push({ commandOrdinal: commandOrdinal, lineNumber: lineNumber });
123
122
  }
124
123
  // No need to keep scanning if we're past our line and we've seen an empty line.
125
- if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
124
+ if (lineNumber > zeroBasedCursorLineNumber &&
125
+ commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
126
126
  break;
127
127
  }
128
128
  }
@@ -204,7 +204,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
204
204
  },
205
205
  enableQueryWarnings: false,
206
206
  enableQuerySuggestions: false,
207
- disabledDiagnoticCodes: [],
207
+ disabledDiagnosticCodes: [],
208
208
  };
209
209
  function getKustoWorker() {
210
210
  return new Promise(function (resolve, reject) {
@@ -232,7 +232,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
232
232
  id: 'kusto',
233
233
  extensions: ['.csl', '.kql'],
234
234
  });
235
- // TODO: asked if there's a cleaner way to register an editor contribution. looks like monaco has an internal contribution regstrar but it's no exposed in the API.
235
+ // TODO: asked if there's a cleaner way to register an editor contribution. looks like monaco has an internal contribution registrar but it's no exposed in the API.
236
236
  // https://stackoverflow.com/questions/46700245/how-to-add-an-ieditorcontribution-to-monaco-editor
237
237
  var commandHighlighter;
238
238
  var commandFormatter;
@@ -298,7 +298,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
298
298
  // Most other language features are initialized in kustoMode.ts
299
299
  monacoInstance.editor.onDidCreateEditor(function (editor) {
300
300
  // hook up extension methods to editor.
301
- extendedEditor_1.extend(editor);
301
+ (0, extendedEditor_1.extend)(editor);
302
302
  commandHighlighter = new commandHighlighter_1.default(editor);
303
303
  if (isStandaloneCodeEditor(editor)) {
304
304
  commandFormatter = new commandFormatter_1.default(editor);
@@ -307,14 +307,15 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
307
307
  });
308
308
  function triggerSuggestDialogWhenCompletionItemSelected(editor) {
309
309
  editor.onDidChangeCursorSelection(function (event) {
310
- // checking the condition inside the event makes sure we will stay up to date whne kusto configuration changes at runtime.
310
+ // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
311
311
  if (kustoDefaults &&
312
312
  kustoDefaults.languageSettings &&
313
313
  kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
314
314
  var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
315
315
  // If the word at the current position is not null - meaning we did not add a space after completion.
316
316
  // In this case we don't want to activate the eager mode, since it will display the current selected word..
317
- if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
317
+ if (!didAcceptSuggestion ||
318
+ editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
318
319
  return;
319
320
  }
320
321
  event.selection;
@@ -1,6 +1,5 @@
1
- /// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
2
1
  /**
3
- * Extending ICode editor to contain additional kusto-speicifc methods.
2
+ * Extending ICode editor to contain additional kusto-specific methods.
4
3
  * note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
5
4
  */
6
5
  export function extend(editor) {
@@ -21,7 +20,8 @@ export function extend(editor) {
21
20
  linesWithCommandOrdinal.push({ commandOrdinal: commandOrdinal, lineNumber: lineNumber });
22
21
  }
23
22
  // No need to keep scanning if we're past our line and we've seen an empty line.
24
- if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
23
+ if (lineNumber > zeroBasedCursorLineNumber &&
24
+ commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
25
25
  break;
26
26
  }
27
27
  }
@@ -46,7 +46,10 @@ export function setupMode(defaults, monacoInstance) {
46
46
  return (__assign(__assign({}, worker), { setSchema: function (schema) { return augmentedSetSchema(schema, worker); }, setSchemaFromShowSchema: function (schema, connection, database, globalScalarParameters, globalTabularParameters) {
47
47
  worker
48
48
  .normalizeSchema(schema, connection, database)
49
- .then(function (schema) { return (globalScalarParameters ? __assign(__assign({}, schema), { globalScalarParameters: globalScalarParameters, globalTabularParameters: globalTabularParameters }) : schema); })
49
+ .then(function (schema) {
50
+ return globalScalarParameters
51
+ ? __assign(__assign({}, schema), { globalScalarParameters: globalScalarParameters, globalTabularParameters: globalTabularParameters }) : schema;
52
+ })
50
53
  .then(function (normalized) { return augmentedSetSchema(normalized, worker); });
51
54
  } }));
52
55
  });
@@ -14,7 +14,7 @@ var KustoWorker = /** @class */ (function () {
14
14
  KustoWorker.prototype.addClusterToSchema = function (uri, clusterName, databasesNames) {
15
15
  var document = this._getTextDocument(uri);
16
16
  if (!document) {
17
- console.error("addClusterToSchema: document is " + document + ". uri is " + uri);
17
+ console.error("addClusterToSchema: document is ".concat(document, ". uri is ").concat(uri));
18
18
  return Promise.resolve();
19
19
  }
20
20
  return this._languageService.addClusterToSchema(document, clusterName, databasesNames);
@@ -22,7 +22,7 @@ var KustoWorker = /** @class */ (function () {
22
22
  KustoWorker.prototype.addDatabaseToSchema = function (uri, clusterName, databaseSchema) {
23
23
  var document = this._getTextDocument(uri);
24
24
  if (!document) {
25
- console.error("addDatabaseToSchema: document is " + document + ". uri is " + uri);
25
+ console.error("addDatabaseToSchema: document is ".concat(document, ". uri is ").concat(uri));
26
26
  return Promise.resolve();
27
27
  }
28
28
  return this._languageService.addDatabaseToSchema(document, clusterName, databaseSchema);
@@ -39,7 +39,7 @@ var KustoWorker = /** @class */ (function () {
39
39
  KustoWorker.prototype.getCommandInContext = function (uri, cursorOffset) {
40
40
  var document = this._getTextDocument(uri);
41
41
  if (!document) {
42
- console.error("getCommandInContext: document is " + document + ". uri is " + uri);
42
+ console.error("getCommandInContext: document is ".concat(document, ". uri is ").concat(uri));
43
43
  return null;
44
44
  }
45
45
  var commandInContext = this._languageService.getCommandInContext(document, cursorOffset);
@@ -51,7 +51,7 @@ var KustoWorker = /** @class */ (function () {
51
51
  KustoWorker.prototype.getQueryParams = function (uri, cursorOffset) {
52
52
  var document = this._getTextDocument(uri);
53
53
  if (!document) {
54
- console.error("getQueryParams: document is " + document + ". uri is " + uri);
54
+ console.error("getQueryParams: document is ".concat(document, ". uri is ").concat(uri));
55
55
  return null;
56
56
  }
57
57
  var queryParams = this._languageService.getQueryParams(document, cursorOffset);
@@ -63,7 +63,7 @@ var KustoWorker = /** @class */ (function () {
63
63
  KustoWorker.prototype.getGlobalParams = function (uri) {
64
64
  var document = this._getTextDocument(uri);
65
65
  if (!document) {
66
- console.error("getGLobalParams: document is " + document + ". uri is " + uri);
66
+ console.error("getGLobalParams: document is ".concat(document, ". uri is ").concat(uri));
67
67
  return null;
68
68
  }
69
69
  var globalParams = this._languageService.getGlobalParams(document);
@@ -75,7 +75,7 @@ var KustoWorker = /** @class */ (function () {
75
75
  KustoWorker.prototype.getReferencedGlobalParams = function (uri, cursorOffest) {
76
76
  var document = this._getTextDocument(uri);
77
77
  if (!document) {
78
- console.error("getReferencedGlobalParams: document is " + document + ". uri is " + uri);
78
+ console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
79
79
  return null;
80
80
  }
81
81
  var referencedParams = this._languageService.getReferencedGlobalParams(document, cursorOffest);
@@ -87,7 +87,7 @@ var KustoWorker = /** @class */ (function () {
87
87
  KustoWorker.prototype.getRenderInfo = function (uri, cursorOffset) {
88
88
  var document = this._getTextDocument(uri);
89
89
  if (!document) {
90
- console.error("getRenderInfo: document is " + document + ". uri is " + uri);
90
+ console.error("getRenderInfo: document is ".concat(document, ". uri is ").concat(uri));
91
91
  }
92
92
  return this._languageService.getRenderInfo(document, cursorOffset).then(function (result) {
93
93
  if (!result) {
@@ -105,7 +105,7 @@ var KustoWorker = /** @class */ (function () {
105
105
  KustoWorker.prototype.getCommandAndLocationInContext = function (uri, cursorOffset) {
106
106
  var document = this._getTextDocument(uri);
107
107
  if (!document) {
108
- console.error("getCommandAndLocationInContext: document is " + document + ". uri is " + uri);
108
+ console.error("getCommandAndLocationInContext: document is ".concat(document, ". uri is ").concat(uri));
109
109
  return Promise.resolve(null);
110
110
  }
111
111
  return this._languageService.getCommandAndLocationInContext(document, cursorOffset).then(function (result) {
@@ -124,7 +124,7 @@ var KustoWorker = /** @class */ (function () {
124
124
  KustoWorker.prototype.getCommandsInDocument = function (uri) {
125
125
  var document = this._getTextDocument(uri);
126
126
  if (!document) {
127
- console.error("getCommandInDocument: document is " + document + ". uri is " + uri);
127
+ console.error("getCommandInDocument: document is ".concat(document, ". uri is ").concat(uri));
128
128
  return null;
129
129
  }
130
130
  return this._languageService.getCommandsInDocument(document);
@@ -3,7 +3,6 @@ import * as _ from './_deps/lodash/lodash';
3
3
  var Uri = monaco.Uri;
4
4
  var Range = monaco.Range;
5
5
  var ClassificationKind = Kusto.Language.Editor.ClassificationKind;
6
- // --- diagnostics ---
7
6
  var DiagnosticsAdapter = /** @class */ (function () {
8
7
  function DiagnosticsAdapter(_monacoInstance, _languageId, _worker, defaults, onSchemaChange) {
9
8
  var _this = this;
@@ -146,9 +145,9 @@ var DiagnosticsAdapter = /** @class */ (function () {
146
145
  }
147
146
  else {
148
147
  // Add custom popup for syntax error: icon, header and message as markdown
149
- var header = syntaxErrorAsMarkDown.header ? "**" + syntaxErrorAsMarkDown.header + "** \n\n" : '';
150
- var icon = syntaxErrorAsMarkDown.icon ? "![](" + syntaxErrorAsMarkDown.icon + ")" : '';
151
- var popupErrorHoverHeaderMessage_1 = icon + " " + header;
148
+ var header = syntaxErrorAsMarkDown.header ? "**".concat(syntaxErrorAsMarkDown.header, "** \n\n") : '';
149
+ var icon = syntaxErrorAsMarkDown.icon ? "![](".concat(syntaxErrorAsMarkDown.icon, ")") : '';
150
+ var popupErrorHoverHeaderMessage_1 = "".concat(icon, " ").concat(header);
152
151
  var newDecorations = markers.map(function (marker) {
153
152
  return {
154
153
  range: {
@@ -175,8 +174,7 @@ var DiagnosticsAdapter = /** @class */ (function () {
175
174
  },
176
175
  };
177
176
  });
178
- var oldMarkers = monaco.editor
179
- .getModelMarkers({
177
+ var oldMarkers = monaco.editor.getModelMarkers({
180
178
  owner: languageId,
181
179
  resource: resource,
182
180
  });
@@ -482,7 +480,7 @@ function getCssForClassification() {
482
480
  var classificationColorTriplets = getClassificationColorTriplets();
483
481
  var cssInnerHtml = classificationColorTriplets
484
482
  .map(function (pair) {
485
- return ".vs ." + pair.classification + " {color: #" + pair.colorLight + ";} .vs-dark ." + pair.classification + " {color: #" + pair.colorDark + ";}";
483
+ return ".vs .".concat(pair.classification, " {color: #").concat(pair.colorLight, ";} .vs-dark .").concat(pair.classification, " {color: #").concat(pair.colorDark, ";}");
486
484
  })
487
485
  .join('\n');
488
486
  return cssInnerHtml;
@@ -583,7 +581,7 @@ function toTextEdit(textEdit) {
583
581
  text: textEdit.newText,
584
582
  };
585
583
  }
586
- var DOCS_BASE_URL = "https://learn.microsoft.com/azure/data-explorer/kusto/query";
584
+ var DOCS_BASE_URL = 'https://learn.microsoft.com/azure/data-explorer/kusto/query';
587
585
  function formatDocLink(docString) {
588
586
  // If the docString is empty, we want to return undefined to prevent an empty documentation popup.
589
587
  if (!docString) {
@@ -593,9 +591,11 @@ function formatDocLink(docString) {
593
591
  var urisProxy = new Proxy(target, {
594
592
  get: function (_target, prop, _receiver) {
595
593
  // The link comes with a postfix of ".md" that we want to remove
596
- var linkWithoutPostfix = prop.toString().replace(".md", "");
594
+ var linkWithoutPostfix = prop.toString().replace('.md', '');
597
595
  // Sometimes we get the link as a full URL. For example in the main doc link of the item
598
- var fullURL = linkWithoutPostfix.startsWith("https") ? linkWithoutPostfix : DOCS_BASE_URL + "/" + linkWithoutPostfix;
596
+ var fullURL = linkWithoutPostfix.startsWith('https')
597
+ ? linkWithoutPostfix
598
+ : "".concat(DOCS_BASE_URL, "/").concat(linkWithoutPostfix);
599
599
  return monaco.Uri.parse(fullURL);
600
600
  },
601
601
  });
@@ -9,16 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __spreadArrays = (this && this.__spreadArrays) || function () {
13
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
14
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
15
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
16
- r[k] = a[j];
17
- return r;
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
18
20
  };
19
- /// <reference path="../../node_modules/@kusto/language-service/Kusto.JavaScript.Client.d.ts" />
20
- /// <reference path="../../node_modules/@kusto/language-service-next/Kusto.Language.Bridge.d.ts" />
21
- /// <reference path="../typings/refs.d.ts" />
22
21
  import * as s from './schema';
23
22
  // polyfill string endsWith
24
23
  if (!String.prototype.endsWith) {
@@ -124,7 +123,7 @@ var KustoLanguageService = /** @class */ (function () {
124
123
  /**
125
124
  * Taken from:
126
125
  * https://msazure.visualstudio.com/One/_git/Azure-Kusto-Service?path=/Src/Tools/Kusto.Explorer.Control/QueryEditors/KustoScriptEditor/KustoScriptEditorControl2.xaml.cs&version=GBdev&line=2075&lineEnd=2075&lineStartColumn=9&lineEndColumn=77&lineStyle=plain&_a=contents
127
- */
126
+ */
128
127
  this._toOptionKind = (_a = {},
129
128
  _a[k2.CompletionKind.AggregateFunction] = k.OptionKind.FunctionAggregation,
130
129
  _a[k2.CompletionKind.BuiltInFunction] = k.OptionKind.FunctionScalar,
@@ -271,7 +270,7 @@ var KustoLanguageService = /** @class */ (function () {
271
270
  this._newlineAppendPipePolicy.Text = '\n| ';
272
271
  }
273
272
  KustoLanguageService.prototype.createDatabaseUniqueName = function (clusterName, databaseName) {
274
- return clusterName + "_" + databaseName;
273
+ return "".concat(clusterName, "_").concat(databaseName);
275
274
  };
276
275
  Object.defineProperty(KustoLanguageService.prototype, "_kustoJsSchemaV2", {
277
276
  /**
@@ -318,20 +317,20 @@ var KustoLanguageService = /** @class */ (function () {
318
317
  */
319
318
  KustoLanguageService.prototype.debugGlobalState = function (globals) {
320
319
  // iterate over clusters
321
- console.log("globals.Clusters.Count: " + globals.Clusters.Count);
320
+ console.log("globals.Clusters.Count: ".concat(globals.Clusters.Count));
322
321
  for (var i = 0; i < globals.Clusters.Count; i++) {
323
322
  var cluster = globals.Clusters.getItem(i);
324
- console.log("cluster: " + cluster.Name);
323
+ console.log("cluster: ".concat(cluster.Name));
325
324
  // iterate over databases
326
- console.log("cluster.Databases.Count: " + cluster.Databases.Count);
325
+ console.log("cluster.Databases.Count: ".concat(cluster.Databases.Count));
327
326
  for (var i2 = 0; i2 < cluster.Databases.Count; i2++) {
328
327
  var database = cluster.Databases.getItem(i2);
329
- console.log("cluster.database: [" + cluster.Name + "].[" + database.Name + "]");
328
+ console.log("cluster.database: [".concat(cluster.Name, "].[").concat(database.Name, "]"));
330
329
  // iterate over tables
331
- console.log("cluster.Databases.Tables.Count: " + database.Tables.Count);
330
+ console.log("cluster.Databases.Tables.Count: ".concat(database.Tables.Count));
332
331
  for (var i3 = 0; i3 < database.Tables.Count; i3++) {
333
332
  var table = database.Tables.getItem(i3);
334
- console.log("cluster.database.table: [" + cluster.Name + "].[" + database.Name + "].[" + table.Name + "]");
333
+ console.log("cluster.database.table: [".concat(cluster.Name, "].[").concat(database.Name, "].[").concat(table.Name, "]"));
335
334
  }
336
335
  }
337
336
  }
@@ -340,7 +339,7 @@ var KustoLanguageService = /** @class */ (function () {
340
339
  * Prepending the doc of the actual topic at the top
341
340
  */
342
341
  KustoLanguageService.prototype.formatHelpTopic = function (helpTopic) {
343
- return "**" + helpTopic.Name + " [(view online)](" + helpTopic.Url + ")**\n\n" + helpTopic.LongDescription;
342
+ return "**".concat(helpTopic.Name, " [(view online)](").concat(helpTopic.Url, ")**\n\n").concat(helpTopic.LongDescription);
344
343
  };
345
344
  KustoLanguageService.prototype.doCompleteV2 = function (document, position) {
346
345
  var _this = this;
@@ -382,7 +381,7 @@ var KustoLanguageService = /** @class */ (function () {
382
381
  ? {
383
382
  // Need to escape dollar sign since it is used as a placeholder in snippet.
384
383
  // Usually dollar sign is not a valid character in a function name, but grafana uses macros that start with dollars.
385
- textToInsert: kItem.EditText.replace('$', '\\$') + "$0" + kItem.AfterText,
384
+ textToInsert: "".concat(kItem.EditText.replace('$', '\\$'), "$0").concat(kItem.AfterText),
386
385
  format: ls.InsertTextFormat.Snippet,
387
386
  }
388
387
  : {
@@ -792,7 +791,7 @@ var KustoLanguageService = /** @class */ (function () {
792
791
  this._script = undefined;
793
792
  this._parsePropertiesV2 = undefined;
794
793
  }
795
- // since V2 doesn't support control commands, we're initializing V1 intellisense for both cases and we'll going to use V1 intellisense for contorl commands.
794
+ // since V2 doesn't support control commands, we're initializing V1 intellisense for both cases and we'll going to use V1 intellisense for control commands.
796
795
  return new Promise(function (resolve, reject) {
797
796
  var kustoJsSchema = schema ? KustoLanguageService.convertToKustoJsSchema(schema) : undefined;
798
797
  _this._kustoJsSchema = kustoJsSchema;
@@ -807,8 +806,10 @@ var KustoLanguageService = /** @class */ (function () {
807
806
  this._schema.globalScalarParameters = scalarParameters;
808
807
  this._schema.globalTabularParameters = tabularParameters;
809
808
  var scalarSymbols = scalarParameters.map(function (param) { return KustoLanguageService.createParameterSymbol(param); });
810
- var tabularSymbols = tabularParameters.map(function (param) { return KustoLanguageService.createTabularParameterSymbol(param); });
811
- this._kustoJsSchemaV2 = this._kustoJsSchemaV2.WithParameters(KustoLanguageService.toBridgeList(__spreadArrays(scalarSymbols, tabularSymbols)));
809
+ var tabularSymbols = tabularParameters.map(function (param) {
810
+ return KustoLanguageService.createTabularParameterSymbol(param);
811
+ });
812
+ this._kustoJsSchemaV2 = this._kustoJsSchemaV2.WithParameters(KustoLanguageService.toBridgeList(__spreadArray(__spreadArray([], scalarSymbols, true), tabularSymbols, true)));
812
813
  return Promise.resolve(undefined);
813
814
  };
814
815
  /**
@@ -1455,8 +1456,8 @@ var KustoLanguageService = /** @class */ (function () {
1455
1456
  * @param params scalar parameters
1456
1457
  */
1457
1458
  KustoLanguageService.scalarParametersToSignature = function (params) {
1458
- var signatureWithoutParens = params.map(function (param) { return param.name + ": " + param.cslType; }).join(', ');
1459
- return "(" + signatureWithoutParens + ")";
1459
+ var signatureWithoutParens = params.map(function (param) { return "".concat(param.name, ": ").concat(param.cslType); }).join(', ');
1460
+ return "(".concat(signatureWithoutParens, ")");
1460
1461
  };
1461
1462
  /**
1462
1463
  * Returns something like '(x: string, T: (y: int))'
@@ -1468,14 +1469,14 @@ var KustoLanguageService = /** @class */ (function () {
1468
1469
  .map(function (param) {
1469
1470
  if (param.columns) {
1470
1471
  var tableSignature = _this.scalarParametersToSignature(param.columns);
1471
- return param.name + ": " + tableSignature;
1472
+ return "".concat(param.name, ": ").concat(tableSignature);
1472
1473
  }
1473
1474
  else {
1474
- return param.name + ": " + param.cslType;
1475
+ return "".concat(param.name, ": ").concat(param.cslType);
1475
1476
  }
1476
1477
  })
1477
1478
  .join(', ');
1478
- return "(" + signatureWithoutParens + ")";
1479
+ return "(".concat(signatureWithoutParens, ")");
1479
1480
  };
1480
1481
  /**
1481
1482
  * converts a function definition to a let statement.
@@ -1483,7 +1484,7 @@ var KustoLanguageService = /** @class */ (function () {
1483
1484
  */
1484
1485
  KustoLanguageService.toLetStatement = function (fn) {
1485
1486
  var signature = this.inputParameterToSignature(fn.inputParameters);
1486
- return "let " + fn.name + " = " + signature + " " + fn.body;
1487
+ return "let ".concat(fn.name, " = ").concat(signature, " ").concat(fn.body);
1487
1488
  };
1488
1489
  KustoLanguageService.createColumnSymbol = function (col) {
1489
1490
  return new sym.ColumnSymbol(col.name, sym.ScalarTypes.GetSymbol(getCslTypeNameFromClrType(col.type)), col.docstring, null, null, col.examples ? KustoLanguageService.toBridgeList(col.examples) : null);
@@ -1591,11 +1592,15 @@ var KustoLanguageService = /** @class */ (function () {
1591
1592
  globalState = globalState.WithDatabase(databaseInContext);
1592
1593
  }
1593
1594
  // Inject global scalar parameters to global scope.
1594
- var scalarParameters = ((_a = schema.globalScalarParameters) !== null && _a !== void 0 ? _a : []).map(function (param) { return KustoLanguageService.createParameterSymbol(param); });
1595
+ var scalarParameters = ((_a = schema.globalScalarParameters) !== null && _a !== void 0 ? _a : []).map(function (param) {
1596
+ return KustoLanguageService.createParameterSymbol(param);
1597
+ });
1595
1598
  // Inject global tabular parameters to global scope.
1596
- var tabularParameters = ((_b = schema.globalTabularParameters) !== null && _b !== void 0 ? _b : []).map(function (param) { return KustoLanguageService.createTabularParameterSymbol(param); });
1599
+ var tabularParameters = ((_b = schema.globalTabularParameters) !== null && _b !== void 0 ? _b : []).map(function (param) {
1600
+ return KustoLanguageService.createTabularParameterSymbol(param);
1601
+ });
1597
1602
  if (tabularParameters.length || scalarParameters.length) {
1598
- globalState = globalState.WithParameters(KustoLanguageService.toBridgeList(__spreadArrays(scalarParameters, tabularParameters)));
1603
+ globalState = globalState.WithParameters(KustoLanguageService.toBridgeList(__spreadArray(__spreadArray([], scalarParameters, true), tabularParameters, true)));
1599
1604
  }
1600
1605
  return globalState;
1601
1606
  };
@@ -1632,7 +1637,7 @@ var KustoLanguageService = /** @class */ (function () {
1632
1637
  */
1633
1638
  KustoLanguageService.prototype.getSortText = function (order) {
1634
1639
  if (order <= 0) {
1635
- throw new RangeError("order should be a number >= 1. instead got " + order);
1640
+ throw new RangeError("order should be a number >= 1. instead got ".concat(order));
1636
1641
  }
1637
1642
  var sortText = '';
1638
1643
  var numCharacters = 26; // "z" - "a" + 1;
@@ -1,23 +1,69 @@
1
1
  export var KustoLanguageDefinition = {
2
2
  name: 'kusto',
3
3
  mimeTypes: ['text/kusto'],
4
- displayName: "Kusto",
5
- defaultToken: "invalid",
6
- brackets: [['[', ']', 'delimiter.square'],
7
- ['(', ')', 'delimiter.parenthesis']],
4
+ displayName: 'Kusto',
5
+ defaultToken: 'invalid',
6
+ brackets: [
7
+ ['[', ']', 'delimiter.square'],
8
+ ['(', ')', 'delimiter.parenthesis'],
9
+ ],
8
10
  wordDefinition: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
9
11
  // .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.
10
12
  promotedOperatorCommandTokens: Kusto.Data.IntelliSense.CslCommandParser.PromotedOperatorCommandTokens.slice(0),
11
13
  operatorCommandTokens: Kusto.Data.IntelliSense.CslCommandParser.OperatorCommandTokens.slice(0),
12
14
  keywords: [
13
- 'by', 'on', 'contains', 'notcontains', 'containscs', 'notcontainscs', 'startswith', 'has', 'matches', 'regex', 'true',
14
- 'false', 'and', 'or', 'typeof', 'int', 'string', 'date', 'datetime', 'time', 'long', 'real', '​boolean', 'bool'
15
+ 'by',
16
+ 'on',
17
+ 'contains',
18
+ 'notcontains',
19
+ 'containscs',
20
+ 'notcontainscs',
21
+ 'startswith',
22
+ 'has',
23
+ 'matches',
24
+ 'regex',
25
+ 'true',
26
+ 'false',
27
+ 'and',
28
+ 'or',
29
+ 'typeof',
30
+ 'int',
31
+ 'string',
32
+ 'date',
33
+ 'datetime',
34
+ 'time',
35
+ 'long',
36
+ 'real',
37
+ '​boolean',
38
+ 'bool',
15
39
  ],
16
40
  operators: ['+', '-', '*', '/', '>', '<', '==', '<>', '<=', '>=', '~', '!~'],
17
41
  builtinFunctions: [
18
- 'countof', 'bin', 'extentid', 'extract', 'extractjson', 'floor', 'iif', 'isnull', 'isnotnull', 'notnull', 'isempty',
19
- 'isnotempty', 'notempty', 'now', 're2', 'strcat', 'strlen', 'toupper',
20
- 'tostring', 'count', 'cnt', 'sum', 'min', 'max', 'avg'
42
+ 'countof',
43
+ 'bin',
44
+ 'extentid',
45
+ 'extract',
46
+ 'extractjson',
47
+ 'floor',
48
+ 'iif',
49
+ 'isnull',
50
+ 'isnotnull',
51
+ 'notnull',
52
+ 'isempty',
53
+ 'isnotempty',
54
+ 'notempty',
55
+ 'now',
56
+ 're2',
57
+ 'strcat',
58
+ 'strlen',
59
+ 'toupper',
60
+ 'tostring',
61
+ 'count',
62
+ 'cnt',
63
+ 'sum',
64
+ 'min',
65
+ 'max',
66
+ 'avg',
21
67
  ],
22
68
  tokenizer: {
23
69
  root: [
@@ -30,7 +76,9 @@ export var KustoLanguageDefinition = {
30
76
  [/[;,.]/, 'delimiter'],
31
77
  [/[()\[\]]/, '@brackets'],
32
78
  [/[<>=!%&+\-*/|~^]/, 'operator'],
33
- [/[\w@#\-$]+/, {
79
+ [
80
+ /[\w@#\-$]+/,
81
+ {
34
82
  cases: {
35
83
  '@keywords': 'keyword',
36
84
  '@promotedOperatorCommandTokens': 'operator.sql',
@@ -38,39 +86,42 @@ export var KustoLanguageDefinition = {
38
86
  '@operators': 'operator',
39
87
  '@builtinFunctions': 'predefined',
40
88
  '@default': 'identifier',
41
- }
42
- }],
89
+ },
90
+ },
91
+ ],
43
92
  ],
44
93
  whitespace: [[/\s+/, 'white']],
45
- comments: [["\\/\\/+.*", "comment"]],
94
+ comments: [['\\/\\/+.*', 'comment']],
46
95
  numbers: [
47
96
  [/0[xX][0-9a-fA-F]*/, 'number'],
48
97
  [/[$][+-]*\d*(\.\d*)?/, 'number'],
49
- [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number']
98
+ [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number'],
50
99
  ],
51
100
  strings: [
52
101
  [/H'/, { token: 'string.quote', bracket: '@open', next: '@string' }],
53
102
  [/h'/, { token: 'string.quote', bracket: '@open', next: '@string' }],
54
- [/'/, { token: 'string.quote', bracket: '@open', next: '@string' }]
103
+ [/'/, { token: 'string.quote', bracket: '@open', next: '@string' }],
55
104
  ],
56
105
  string: [
57
106
  [/[^']+/, 'string'],
58
107
  [/''/, 'string'],
59
- [/'/, { token: 'string.quote', bracket: '@close', next: '@pop' }]
108
+ [/'/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
60
109
  ],
61
110
  dqstrings: [
62
111
  [/H"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }],
63
112
  [/h"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }],
64
- [/"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }]
113
+ [/"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }],
65
114
  ],
66
115
  dqstring: [
67
116
  [/[^"]+/, 'string'],
68
117
  [/""/, 'string'],
69
- [/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }]
118
+ [/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
70
119
  ],
71
- literals: [[/datetime\(\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}(:\d{2}(\.\d{0,3})?)?)?\)/, 'number'],
120
+ literals: [
121
+ [/datetime\(\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}(:\d{2}(\.\d{0,3})?)?)?\)/, 'number'],
72
122
  [/time\((\d+(s(ec(onds?)?)?|m(in(utes?)?)?|h(ours?)?|d(ays?)?)|(\s*(('[^']+')|("[^"]+"))\s*))\)/, 'number'],
73
123
  [/guid\([\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}\)/, 'number'],
74
- [/typeof\((int|string|date|datetime|time|long|real|boolean|bool)\)/, 'number']]
75
- }
124
+ [/typeof\((int|string|date|datetime|time|long|real|boolean|bool)\)/, 'number'],
125
+ ],
126
+ },
76
127
  };
@@ -19,7 +19,7 @@ var dotnetTypeToKustoType = {
19
19
  'Newtonsoft.Json.Linq.JObject': 'dynamic',
20
20
  'Newtonsoft.Json.Linq.JToken': 'dynamic',
21
21
  'System.Object': 'dynamic',
22
- 'System.Data.SqlTypes.SqlDecimal': 'decimal'
22
+ 'System.Data.SqlTypes.SqlDecimal': 'decimal',
23
23
  };
24
24
  export var getCslTypeNameFromClrType = function (clrType) { return dotnetTypeToKustoType[clrType] || clrType; };
25
25
  var kustoTypeToEntityDataType = {
@@ -38,27 +38,27 @@ var kustoTypeToEntityDataType = {
38
38
  datetime: 'DateTime',
39
39
  string: 'String',
40
40
  dynamic: 'Dynamic',
41
- timespan: 'TimeSpan'
41
+ timespan: 'TimeSpan',
42
42
  };
43
43
  export var getEntityDataTypeFromCslType = function (cslType) { return kustoTypeToEntityDataType[cslType] || cslType; };
44
44
  export var getCallName = function (fn) {
45
- return fn.name + "(" + fn.inputParameters.map(function (p) { return "{" + p.name + "}"; }).join(',') + ")";
45
+ return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) { return "{".concat(p.name, "}"); }).join(','), ")");
46
46
  };
47
47
  export var getExpression = function (fn) {
48
- return "let " + fn.name + " = " + getInputParametersAsCslString(fn.inputParameters) + " " + fn.body;
48
+ return "let ".concat(fn.name, " = ").concat(getInputParametersAsCslString(fn.inputParameters), " ").concat(fn.body);
49
49
  };
50
50
  export var getInputParametersAsCslString = function (inputParameters) {
51
- return "(" + inputParameters.map(function (inputParameter) { return getInputParameterAsCslString(inputParameter); }).join(',') + ")";
51
+ return "(".concat(inputParameters.map(function (inputParameter) { return getInputParameterAsCslString(inputParameter); }).join(','), ")");
52
52
  };
53
53
  var getInputParameterAsCslString = function (inputParameter) {
54
54
  // If this is a tabular parameter
55
55
  if (inputParameter.columns && inputParameter.columns.length > 0) {
56
56
  var attributesAsString = inputParameter.columns
57
- .map(function (col) { return col.name + ":" + (col.cslType || getCslTypeNameFromClrType(col.type)); })
57
+ .map(function (col) { return "".concat(col.name, ":").concat(col.cslType || getCslTypeNameFromClrType(col.type)); })
58
58
  .join(',');
59
- return inputParameter.name + ":" + (attributesAsString === '' ? '*' : attributesAsString);
59
+ return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
60
60
  }
61
61
  else {
62
- return inputParameter.name + ":" + (inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
62
+ return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
63
63
  }
64
64
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="monaco-editor-core/monaco" />
1
2
  import IEvent = monaco.IEvent;
2
3
  export declare class LanguageServiceDefaultsImpl implements monaco.languages.kusto.LanguageServiceDefaults {
3
4
  private _onDidChange;