@kusto/monaco-kusto 8.2.0 → 9.0.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 (34) 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 +123 -96
  6. package/release/dev/{main-f25d1ca7.js → main-adf33640.js} +168 -381
  7. package/release/dev/monaco.contribution.js +6 -9
  8. package/release/dev/{schema-8dc56616.js → schema-9a35b99a.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 +48 -33
  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.d.ts +2 -2
  17. package/release/esm/languageService/kustoLanguageService.js +1943 -0
  18. package/release/esm/languageService/kustoMonarchLanguageDefinition.js +211 -0
  19. package/release/esm/languageService/renderInfo.js +1 -0
  20. package/release/esm/languageService/schema.d.ts +7 -0
  21. package/release/esm/languageService/schema.js +64 -0
  22. package/release/esm/languageService/settings.js +1 -0
  23. package/release/esm/monaco.contribution.js +178 -426
  24. package/release/esm/{schema-1d41f705.js → schema-6a20da13.js} +1 -2
  25. package/release/esm/types.js +1 -0
  26. package/release/esm/workerManager.js +102 -0
  27. package/release/min/Kusto.Language.Bridge.min.js +1 -1
  28. package/release/min/kusto.javascript.client.min.js +1 -1
  29. package/release/min/kustoMode.js +2 -2
  30. package/release/min/kustoWorker.js +4 -4
  31. package/release/min/main-6b448f4d.js +7 -0
  32. package/release/min/monaco.contribution.js +2 -2
  33. package/release/min/{schema-ef0ffe13.js → schema-7077f0b7.js} +2 -2
  34. 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: 9.0.0(faf7ed5043d2e79738847656c64ca42816963d09)
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-9a35b99a'], (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: 9.0.0(faf7ed5043d2e79738847656c64ca42816963d09)
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-9a35b99a', ['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: 9.0.0(faf7ed5043d2e79738847656c64ca42816963d09)
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-6a20da13.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';
@@ -813,9 +813,12 @@ class KustoLanguageService {
813
813
  * @param schema schema json as received from .show schema as json
814
814
  * @param clusterConnectionString cluster connection string
815
815
  * @param databaseInContextName name of database in context
816
+ * @param globalScalarParameters
817
+ * @param globalTabularParameters
818
+ * @param databaseInContextAlternateName alternate name of database in context
816
819
  */
817
- setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters) {
818
- return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName).then(normalized => this.setSchema({
820
+ setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters, databaseInContextAlternateName) {
821
+ return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName).then(normalized => this.setSchema({
819
822
  ...normalized,
820
823
  globalScalarParameters,
821
824
  globalTabularParameters
@@ -827,20 +830,27 @@ class KustoLanguageService {
827
830
  * @param schema result of show schema
828
831
  * @param clusterConnectionString cluster connection string`
829
832
  * @param databaseInContextName database in context name
833
+ * @param databaseInContextAlternateName database in context alternate name
830
834
  */
831
- normalizeSchema(schema, clusterConnectionString, databaseInContextName) {
835
+ normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
832
836
  const databases = Object.keys(schema.Databases).map(key => schema.Databases[key]).map(({
833
837
  Name,
834
838
  Tables,
835
839
  ExternalTables,
836
840
  MaterializedViews,
837
841
  Functions,
842
+ EntityGroups = {},
838
843
  MinorVersion,
839
844
  MajorVersion
840
845
  }) => ({
841
846
  name: Name,
847
+ alternateName: databaseInContextAlternateName || null,
842
848
  minorVersion: MinorVersion,
843
849
  majorVersion: MajorVersion,
850
+ entityGroups: Object.entries(EntityGroups).map(([name, members]) => ({
851
+ name,
852
+ members
853
+ })),
844
854
  tables: [].concat(...[[Tables, 'Table'], [MaterializedViews, 'MaterializedView'], [ExternalTables, 'ExternalTable']].filter(([tableContainer]) => tableContainer).map(([tableContainer, tableEntity]) => Object.values(tableContainer).map(({
845
855
  Name,
846
856
  OrderedColumns,
@@ -1332,7 +1342,9 @@ class KustoLanguageService {
1332
1342
  const database = {
1333
1343
  majorVersion: 0,
1334
1344
  minorVersion: 0,
1345
+ entityGroups: [],
1335
1346
  name: 'Kuskus',
1347
+ alternateName: null,
1336
1348
  tables: [{
1337
1349
  name: 'KustoLogs',
1338
1350
  columns: [{
@@ -1510,34 +1522,10 @@ class KustoLanguageService {
1510
1522
  return new sym.Parameter.$ctor2(param.name, argumentType);
1511
1523
  }
1512
1524
  static convertToDatabaseSymbol(db) {
1513
- const createFunctionSymbol = fn => {
1514
- const parameters = fn.inputParameters.map(param => KustoLanguageService.createParameter(param));
1515
-
1516
- // TODO: handle outputColumns (right now it doesn't seem to be implemented for any function).
1517
- return new sym.FunctionSymbol.$ctor14(fn.name, fn.body, KustoLanguageService.toBridgeList(parameters), fn.docstring);
1518
- };
1519
- const createTableSymbol = tbl => {
1520
- const columnSymbols = tbl.columns.map(col => KustoLanguageService.createColumnSymbol(col));
1521
- let symbol = new sym.TableSymbol.$ctor4(tbl.name, columnSymbols);
1522
- symbol.Description = tbl.docstring;
1523
- switch (tbl.entityType) {
1524
- case 'MaterializedViewTable':
1525
- const mvQuery = tbl.mvQuery ?? null;
1526
- symbol = new sym.MaterializedViewSymbol.$ctor2(tbl.name, symbol.Columns, mvQuery, tbl.docstring);
1527
- symbol = symbol.WithIsMaterializedView(true);
1528
- break;
1529
- case 'ExternalTable':
1530
- symbol = symbol.WithIsExternal(true);
1531
- break;
1532
- }
1533
- return symbol;
1534
- };
1535
- const createDatabaseSymbol = db => {
1536
- const tableSymbols = db.tables ? db.tables.map(tbl => createTableSymbol(tbl)) : [];
1537
- const functionSymbols = db.functions ? db.functions.map(fun => createFunctionSymbol(fun)) : [];
1538
- return new sym.DatabaseSymbol.ctor(db.name, tableSymbols.concat(functionSymbols));
1539
- };
1540
- const databaseSymbol = createDatabaseSymbol(db);
1525
+ const tableSymbols = (db.tables || []).map(this.createTableSymbol);
1526
+ const functionSymbols = (db.functions || []).map(this.createFunctionSymbol);
1527
+ const entityGroupsSymbols = (db.entityGroups || []).map(this.createEntityGroupSymbol);
1528
+ const databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols));
1541
1529
  return databaseSymbol;
1542
1530
  }
1543
1531
  convertToKustoJsSchemaV2(schema) {
@@ -1898,6 +1886,33 @@ class KustoLanguageService {
1898
1886
  const parsedAndAnalyzed = Kusto.Language.KustoCode.ParseAndAnalyze(text, this._kustoJsSchemaV2);
1899
1887
  return parsedAndAnalyzed;
1900
1888
  }
1889
+ static createFunctionSymbol(fn) {
1890
+ const parameters = fn.inputParameters.map(param => KustoLanguageService.createParameter(param));
1891
+
1892
+ // TODO: handle outputColumns (right now it doesn't seem to be implemented for any function).
1893
+ return new sym.FunctionSymbol.$ctor14(fn.name, fn.body, KustoLanguageService.toBridgeList(parameters), fn.docstring);
1894
+ }
1895
+ static createTableSymbol({
1896
+ name,
1897
+ columns,
1898
+ entityType,
1899
+ docstring,
1900
+ ...tbl
1901
+ }) {
1902
+ const columnSymbols = new Bridge.ArrayEnumerable(columns.map(col => KustoLanguageService.createColumnSymbol(col)));
1903
+ switch (entityType) {
1904
+ case 'MaterializedViewTable':
1905
+ const mvQuery = tbl.mvQuery ?? null;
1906
+ return new sym.MaterializedViewSymbol.$ctor2(name, columnSymbols, mvQuery, docstring);
1907
+ case 'ExternalTable':
1908
+ return new sym.ExternalTableSymbol.$ctor3(name, columnSymbols, docstring);
1909
+ default:
1910
+ return new sym.TableSymbol.$ctor6(name, columnSymbols, docstring);
1911
+ }
1912
+ }
1913
+ static createEntityGroupSymbol(entityGroup) {
1914
+ return new sym.EntityGroupSymbol.$ctor3(entityGroup.name, entityGroup.members.join(), null);
1915
+ }
1901
1916
  }
1902
1917
  let languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
1903
1918
  includeControlCommands: true,