@kusto/monaco-kusto 14.0.1 → 14.2.2

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 (27) hide show
  1. package/README.md +93 -14
  2. package/package.json +1 -1
  3. package/release/dev/kustoMode.js +23 -13
  4. package/release/dev/kustoWorker.js +25 -5
  5. package/release/dev/{main-6dbedcd3.js → main-2d6da563.js} +2 -2
  6. package/release/dev/monaco.contribution.js +10 -4
  7. package/release/dev/{schema-954f3274.js → schema-c2628e1d.js} +2 -2
  8. package/release/dev/{types-dde70929.js → types-fb9b493a.js} +2 -2
  9. package/release/esm/{globals-5d7a5fa1.js → globals-2482dd04.js} +1 -1
  10. package/release/esm/kusto.worker.js +23 -5
  11. package/release/esm/kustoMode.d.ts +5 -1
  12. package/release/esm/kustoMode.js +19 -10
  13. package/release/esm/languageServiceManager/kustoLanguageService.js +19 -2
  14. package/release/esm/languageServiceManager/schema.d.ts +18 -0
  15. package/release/esm/monaco.contribution.d.ts +3 -0
  16. package/release/esm/monaco.contribution.js +12 -7
  17. package/release/esm/{schema-2df06016.js → schema-6e15bdaa.js} +1 -1
  18. package/release/esm/syntaxHighlighting/SemanticTokensProvider.d.ts +3 -1
  19. package/release/esm/syntaxHighlighting/SemanticTokensProvider.js +13 -9
  20. package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.d.ts +1 -1
  21. package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.js +4 -4
  22. package/release/min/kustoMode.js +2 -2
  23. package/release/min/kustoWorker.js +4 -4
  24. package/release/min/{main-29cd5afc.js → main-e541fd9c.js} +2 -2
  25. package/release/min/monaco.contribution.js +2 -2
  26. package/release/min/{schema-2dd5f468.js → schema-f5610a54.js} +2 -2
  27. package/release/min/{types-cdb0d790.js → types-3f592d79.js} +2 -2
package/README.md CHANGED
@@ -56,6 +56,24 @@ There are 2 APIs to set a Kusto schema:
56
56
  interface `Result` in `schema.ts`), so when this method is used, it also
57
57
  requires a cluster URI and the name of the database in context.
58
58
 
59
+ ### Schema Parsing Flow
60
+
61
+ The schema parsing process in Monaco-Kusto involves several components, starting from the Kusto command and ending with language features in the editor. Here is how the flow works:
62
+
63
+ Below is a diagram illustrating the schema parsing flow:
64
+
65
+ ![img_1.png](img_1.png)
66
+
67
+ ## Getting Started: Running the Local Demo App
68
+
69
+ To quickly try Monaco-Kusto locally, run the following command from the `package` folder:
70
+
71
+ ```
72
+ yarn start
73
+ ```
74
+
75
+ This will start a local development server and open the demo app at http://localhost:7777.
76
+
59
77
  ## Contributing
60
78
 
61
79
  Every PR should come with a test that checks it.
@@ -89,8 +107,83 @@ Every PR should come with a test that checks it.
89
107
  > Before running `yarn test:it` or `yarn test:it:watch`, first run `yarn test:it:serve`.
90
108
  > These scripts (`test:it` and `test:it:watch`) do **not** automatically rebuild the project, so running the server ensures your latest code is tested.
91
109
 
110
+ ## Running Monaco-Kusto Locally in Azure-Kusto-WebUX
111
+
112
+ To run monaco-kusto locally inside the Azure-Kusto-WebUX project (which should exist outside this project folder with the original project name `Azure-Kusto-WebUX`), you can use the provided script:
113
+
114
+ ```sh
115
+ ./debug-monaco-kusto.sh
116
+ ```
117
+
118
+ ### Script Modes: KustoWeb and Fabric
119
+
120
+ There are two ways to run the script:
121
+
122
+ - **KustoWeb (default):** The script is currently set up to run the `kustoweb` app inside Azure-Kusto-WebUX. This is the default behavior.
123
+ - **Fabric:** To run the Fabric app instead, simply comment out the Step 4 section for KustoWeb and uncomment the Step 4 section for Fabric in `debug-monaco-kusto.sh`.
124
+
125
+ This allows you to easily switch between running KustoWeb and Fabric for local development.
126
+
127
+ ### Project Structure Requirements
128
+
129
+ For the debug-monaco-kusto.sh script to work, ensure that your project structure resembles the following, with both `monaco-kusto` and `Azure-Kusto-WebUX` as sibling folders:
130
+
131
+ ```
132
+ /your-workspace-root
133
+ |-- monaco-kusto
134
+ | |-- ...
135
+ | |-- debug-monaco-kusto.sh
136
+ | |-- ...
137
+ |
138
+ |-- Azure-Kusto-WebUX
139
+ `-- ...
140
+ ```
141
+
142
+ The important part is that the `Azure-Kusto-WebUX` folder is a sibling to `monaco-kusto`, and that its `node_modules` folder and `package.json` file are at its root. The script relies on this structure to copy files and run the correct build steps.
143
+
144
+ ## Architecture Overview
145
+
146
+ This section provides a high-level overview of the main files and their responsibilities in the project.
147
+
148
+ ![img.png](img.png)
149
+
150
+ - **`monaco.contribution`**
151
+ Declares and exports the Kusto language as a Monaco Editor contribution, making it available for registration and use externally.
152
+
153
+ - **`kustoMode`** Sets up and registers the Kusto language in Monaco Editor, wiring together language features, workers, and configuration.
154
+
155
+ - **`workerManager`** Manages the lifecycle and communication with web workers that run language services in the background.
156
+
157
+ - **`kustoWorker`** Implements the actual worker logic, handling requests for language features from the main thread.
158
+
159
+ - **`kustoLanguageService`**
160
+ Implements the core logic for Kusto language features such as parsing, validation, and providing language intelligence (completion, diagnostics, etc.).
161
+ Uses the `language-service-next` library, which was originally created in C# and migrated to TypeScript using bridgejs.
162
+
163
+ - **`languageFeatures`**
164
+ Contains adapters and implementations for Monaco Editor language features (completion, hover, formatting, folding, etc.) specific to Kusto.
165
+
166
+ - **`monacoInstance`**
167
+ Represents the Monaco Editor instance itself. It is responsible for editor creation, configuration, and interaction with the registered Kusto language features.
168
+
92
169
  ## Changelog
93
170
 
171
+ ### 14.2.2
172
+
173
+ - docs: add external references to semver-classification skill
174
+
175
+ ### 14.2.1
176
+
177
+ - chore: bump CI Node.js version to 22
178
+
179
+ ### 14.2.0
180
+
181
+ - feat: add `onSchemaUpdateComplete` event emitter so consumers can react to schema refresh completion
182
+
183
+ ### 14.1.0
184
+
185
+ - feat: support graph schema
186
+
94
187
  ### 14.0.1
95
188
 
96
189
  - chore: Update @kusto/language-service-next upgrade to 12.2.0
@@ -1014,17 +1107,3 @@ Every PR should come with a test that checks it.
1014
1107
  #### Bug fixes
1015
1108
 
1016
1109
  - setSchema does not update syntax highlighting
1017
-
1018
- # Contributing
1019
-
1020
- This project welcomes contributions and suggestions. Most contributions require you to agree to a
1021
- Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
1022
- the rights to use your contribution. For details, visit https://cla.microsoft.com.
1023
-
1024
- When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
1025
- a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
1026
- provided by the bot. You will only need to do this once across all repos using our CLA.
1027
-
1028
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
1029
- For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
1030
- contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kusto/monaco-kusto",
3
- "version": "14.0.1",
3
+ "version": "14.2.2",
4
4
  "description": "CSL, KQL plugin for the Monaco Editor",
5
5
  "author": {
6
6
  "name": "Microsoft"
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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', 'vs/editor/editor.main', './main-6dbedcd3', './types-dde70929'], (function (exports, monaco, main, types$1) { 'use strict';
8
+ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-2d6da563', './types-fb9b493a'], (function (exports, monaco, main, types$1) { 'use strict';
9
9
 
10
10
  function _interopNamespaceDefault(e) {
11
11
  var n = Object.create(null);
@@ -1556,9 +1556,10 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1556
1556
  function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$2(i) ? i : i + ""; }
1557
1557
  function _toPrimitive$1(t, r) { if ("object" != _typeof$2(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$2(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1558
1558
  var SemanticTokensProvider = /*#__PURE__*/function () {
1559
- function SemanticTokensProvider(classificationsGetter) {
1559
+ function SemanticTokensProvider(classificationsGetter, onTokensProvided) {
1560
1560
  _classCallCheck(this, SemanticTokensProvider);
1561
1561
  this.classificationsGetter = classificationsGetter;
1562
+ this.onTokensProvided = onTokensProvided;
1562
1563
  }
1563
1564
  return _createClass(SemanticTokensProvider, [{
1564
1565
  key: "getLegend",
@@ -1572,7 +1573,8 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1572
1573
  key: "provideDocumentSemanticTokens",
1573
1574
  value: function () {
1574
1575
  var _provideDocumentSemanticTokens = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee(model) {
1575
- var resource, classifications, tokens, prevLine, prevChar, _iterator, _step, classification, parts, _i, _parts, part, _part, absLine, absChar, length, kind, modifiers, deltaLine, deltaChar;
1576
+ var _this$onTokensProvide;
1577
+ var resource, classifications, tokens, prevLine, prevChar, _iterator, _step, classification, parts, _i, _parts, part, _part, absLine, absChar, length, kind, modifiers, deltaLine, deltaChar, result;
1576
1578
  return _regeneratorRuntime$2().wrap(function _callee$(_context) {
1577
1579
  while (1) switch (_context.prev = _context.next) {
1578
1580
  case 0:
@@ -1604,11 +1606,13 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1604
1606
  } finally {
1605
1607
  _iterator.f();
1606
1608
  }
1607
- return _context.abrupt("return", {
1609
+ result = {
1608
1610
  data: new Uint32Array(tokens.flat(2)),
1609
1611
  resultId: model.getVersionId().toString()
1610
- });
1611
- case 10:
1612
+ };
1613
+ (_this$onTokensProvide = this.onTokensProvided) === null || _this$onTokensProvide === void 0 || _this$onTokensProvide.call(this, resource);
1614
+ return _context.abrupt("return", result);
1615
+ case 12:
1612
1616
  case "end":
1613
1617
  return _context.stop();
1614
1618
  }
@@ -1651,10 +1655,10 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1651
1655
  function _asyncToGenerator$1(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
1652
1656
  // Registers semantic token provider that utilizes the language service
1653
1657
  // for more context-relevant syntax highlighting.
1654
- function semanticTokensProviderRegistrarCreator() {
1658
+ function semanticTokensProviderRegistrarCreator(onTokensProvided) {
1655
1659
  var semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreatorForTest();
1656
1660
  return function (monacoInstance, workerAccessor) {
1657
- var semanticTokensProvider = semanticTokensProviderMaker(workerAccessor);
1661
+ var semanticTokensProvider = semanticTokensProviderMaker(workerAccessor, onTokensProvided);
1658
1662
  semanticTokensProviderRegistrar(monacoInstance, semanticTokensProvider);
1659
1663
  };
1660
1664
  }
@@ -1667,7 +1671,7 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1667
1671
  semanticTokensDisposable = monacoInstance.languages.registerDocumentSemanticTokensProvider(types$1.LANGUAGE_ID, semanticTokensProvider);
1668
1672
  };
1669
1673
  }
1670
- function semanticTokensProviderMaker(workerAccessor) {
1674
+ function semanticTokensProviderMaker(workerAccessor, onTokensProvided) {
1671
1675
  var classificationsGetter = /*#__PURE__*/function () {
1672
1676
  var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(resource) {
1673
1677
  var worker;
@@ -1689,7 +1693,7 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1689
1693
  return _ref.apply(this, arguments);
1690
1694
  };
1691
1695
  }();
1692
- return new SemanticTokensProvider(classificationsGetter);
1696
+ return new SemanticTokensProvider(classificationsGetter, onTokensProvided);
1693
1697
  }
1694
1698
 
1695
1699
  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); }
@@ -1717,10 +1721,16 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
1717
1721
  /**
1718
1722
  * Called when Kusto language is first needed (a model has the language set)
1719
1723
  * @param defaults
1724
+ * @param monacoInstance
1725
+ * @param onSchemaUpdateCompleteEmitter Optional,fired when the language service has finished all schema-related work
1720
1726
  */
1721
- function setupMode(defaults, monacoInstance) {
1727
+ function setupMode(defaults, monacoInstance, onSchemaUpdateCompleteEmitter) {
1722
1728
  var onSchemaChange = new monaco__namespace.Emitter();
1723
- var semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreator();
1729
+ var semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreator(function (uri) {
1730
+ onSchemaUpdateCompleteEmitter === null || onSchemaUpdateCompleteEmitter === void 0 || onSchemaUpdateCompleteEmitter.fire({
1731
+ uri: uri
1732
+ });
1733
+ });
1724
1734
  var client = new WorkerManager(monacoInstance, defaults);
1725
1735
  var workerAccessor = function workerAccessor(first) {
1726
1736
  var augmentedSetSchema = /*#__PURE__*/function () {
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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-6dbedcd3', './schema-954f3274'], (function (exports, main, schema) { 'use strict';
8
+ define('vs/language/kusto/kustoWorker', ['exports', './main-2d6da563', './schema-c2628e1d'], (function (exports, main, schema) { 'use strict';
9
9
 
10
10
  function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$2(); }
11
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."); }
@@ -4229,7 +4229,8 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-6dbedcd3', './schema
4229
4229
  _ref6$EntityGroups = _ref6.EntityGroups,
4230
4230
  EntityGroups = _ref6$EntityGroups === void 0 ? {} : _ref6$EntityGroups,
4231
4231
  MinorVersion = _ref6.MinorVersion,
4232
- MajorVersion = _ref6.MajorVersion;
4232
+ MajorVersion = _ref6.MajorVersion,
4233
+ Graphs = _ref6.Graphs;
4233
4234
  return {
4234
4235
  name: Name,
4235
4236
  alternateName: databaseInContextAlternateName,
@@ -4303,7 +4304,17 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-6dbedcd3', './schema
4303
4304
  };
4304
4305
  })
4305
4306
  };
4306
- })
4307
+ }),
4308
+ graphs: Object.values(Graphs).reduce(function (graphArray, graph) {
4309
+ var graphEntity = {
4310
+ name: graph.Name,
4311
+ entityType: 'Graph',
4312
+ edges: graph.Edges,
4313
+ nodes: graph.Nodes,
4314
+ snapshots: graph.Snapshots
4315
+ };
4316
+ return [].concat(_toConsumableArray(graphArray), [graphEntity]);
4317
+ }, []) // this is a temporary workaround as graphs are not included in the .show schema as json command output
4307
4318
  };
4308
4319
  });
4309
4320
  return {
@@ -5323,7 +5334,8 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-6dbedcd3', './schema
5323
5334
  var tableSymbols = (db.tables || []).map(this.createTableSymbol);
5324
5335
  var functionSymbols = (db.functions || []).map(this.createFunctionSymbol);
5325
5336
  var entityGroupsSymbols = (db.entityGroups || []).map(this.createEntityGroupSymbol);
5326
- var databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols));
5337
+ var graphModelSymbols = (db.graphs || []).map(this.createGraphModelSymbol);
5338
+ var databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols).concat(graphModelSymbols));
5327
5339
  return databaseSymbol;
5328
5340
  }
5329
5341
  }, {
@@ -5381,6 +5393,14 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-6dbedcd3', './schema
5381
5393
  value: function createEntityGroupSymbol(entityGroup) {
5382
5394
  return new sym.EntityGroupSymbol.$ctor3(entityGroup.name, entityGroup.members.join(), null);
5383
5395
  }
5396
+ }, {
5397
+ key: "createGraphModelSymbol",
5398
+ value: function createGraphModelSymbol(graph) {
5399
+ var edges = new Bridge.ArrayEnumerable(graph.edges || []);
5400
+ var nodes = new Bridge.ArrayEnumerable(graph.nodes || []);
5401
+ var snapshots = new Bridge.ArrayEnumerable(graph.snapshots || []);
5402
+ return new sym.GraphModelSymbol.$ctor1(graph.name, edges, nodes, snapshots);
5403
+ }
5384
5404
  }]);
5385
5405
  }();
5386
5406
  var languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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-6dbedcd3', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/main-2d6da563', ['exports'], (function (exports) { 'use strict';
9
9
 
10
10
  /* --------------------------------------------------------------------------------------------
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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', './types-dde70929', './schema-954f3274'], (function (require, exports, monaco, types, schema) { 'use strict';
8
+ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './types-fb9b493a', './schema-c2628e1d'], (function (require, exports, monaco, types, schema) { 'use strict';
9
9
 
10
10
  function _interopNamespaceDefault(e) {
11
11
  var n = Object.create(null);
@@ -594,6 +594,10 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
594
594
  });
595
595
  });
596
596
  }
597
+
598
+ // Fires after semantic tokens are (re)computed following a schema update; payload carries the model URI.
599
+ var onSchemaUpdateCompleteEmitter = new monaco__namespace.Emitter();
600
+ var onSchemaUpdateComplete = onSchemaUpdateCompleteEmitter.event;
597
601
  function withMode(callback) {
598
602
  return new Promise(function (resolve, reject) { require(['./kustoMode'], resolve, reject); }).then(callback);
599
603
  }
@@ -604,7 +608,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
604
608
  case 0:
605
609
  _context.next = 2;
606
610
  return withMode(function (mode) {
607
- return mode.setupMode(kustoDefaults, monaco__namespace);
611
+ return mode.setupMode(kustoDefaults, monaco__namespace, onSchemaUpdateCompleteEmitter);
608
612
  });
609
613
  case 2:
610
614
  case "end":
@@ -675,7 +679,8 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
675
679
  getEntityDataTypeFromCslType: schema.getEntityDataTypeFromCslType,
676
680
  kustoDefaults: kustoDefaults,
677
681
  getKustoWorker: getKustoWorker,
678
- getRangeHtml: getRangeHtml
682
+ getRangeHtml: getRangeHtml,
683
+ onSchemaUpdateComplete: onSchemaUpdateComplete
679
684
  };
680
685
  monaco__namespace.languages.kusto = globalApi;
681
686
 
@@ -688,5 +693,6 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
688
693
  exports.getKustoWorker = getKustoWorker;
689
694
  exports.getRangeHtml = getRangeHtml;
690
695
  exports.kustoDefaults = kustoDefaults;
696
+ exports.onSchemaUpdateComplete = onSchemaUpdateComplete;
691
697
 
692
698
  }));
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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-954f3274', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/schema-c2628e1d', ['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
 
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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/types-dde70929', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/types-fb9b493a', ['exports'], (function (exports) { 'use strict';
9
9
 
10
10
  var LANGUAGE_ID = 'kusto';
11
11
 
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
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-2df06016.js';
11
+ import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-6e15bdaa.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';
@@ -699,7 +699,8 @@ class KustoLanguageService {
699
699
  Functions,
700
700
  EntityGroups = {},
701
701
  MinorVersion,
702
- MajorVersion
702
+ MajorVersion,
703
+ Graphs
703
704
  }) => ({
704
705
  name: Name,
705
706
  alternateName: databaseInContextAlternateName,
@@ -750,7 +751,17 @@ class KustoLanguageService {
750
751
  cslType: col.CslType
751
752
  })) : inputParam.Columns
752
753
  }))
753
- }))
754
+ })),
755
+ graphs: Object.values(Graphs).reduce((graphArray, graph) => {
756
+ const graphEntity = {
757
+ name: graph.Name,
758
+ entityType: 'Graph',
759
+ edges: graph.Edges,
760
+ nodes: graph.Nodes,
761
+ snapshots: graph.Snapshots
762
+ };
763
+ return [...graphArray, graphEntity];
764
+ }, []) // this is a temporary workaround as graphs are not included in the .show schema as json command output
754
765
  }));
755
766
  return {
756
767
  clusterType: 'Engine',
@@ -1355,7 +1366,8 @@ class KustoLanguageService {
1355
1366
  const tableSymbols = (db.tables || []).map(this.createTableSymbol);
1356
1367
  const functionSymbols = (db.functions || []).map(this.createFunctionSymbol);
1357
1368
  const entityGroupsSymbols = (db.entityGroups || []).map(this.createEntityGroupSymbol);
1358
- const databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols));
1369
+ const graphModelSymbols = (db.graphs || []).map(this.createGraphModelSymbol);
1370
+ const databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols).concat(graphModelSymbols));
1359
1371
  return databaseSymbol;
1360
1372
  }
1361
1373
  convertToKustoJsSchemaV2(schema) {
@@ -1719,6 +1731,12 @@ class KustoLanguageService {
1719
1731
  static createEntityGroupSymbol(entityGroup) {
1720
1732
  return new sym.EntityGroupSymbol.$ctor3(entityGroup.name, entityGroup.members.join(), null);
1721
1733
  }
1734
+ static createGraphModelSymbol(graph) {
1735
+ const edges = new Bridge.ArrayEnumerable(graph.edges || []);
1736
+ const nodes = new Bridge.ArrayEnumerable(graph.nodes || []);
1737
+ const snapshots = new Bridge.ArrayEnumerable(graph.snapshots || []);
1738
+ return new sym.GraphModelSymbol.$ctor1(graph.name, edges, nodes, snapshots);
1739
+ }
1722
1740
  }
1723
1741
  let languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
1724
1742
  includeControlCommands: true,
@@ -9,6 +9,10 @@ export interface AugmentedWorkerAccessor {
9
9
  /**
10
10
  * Called when Kusto language is first needed (a model has the language set)
11
11
  * @param defaults
12
+ * @param monacoInstance
13
+ * @param onSchemaUpdateCompleteEmitter Optional,fired when the language service has finished all schema-related work
12
14
  */
13
- export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): void;
15
+ export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof monaco, onSchemaUpdateCompleteEmitter?: monaco.Emitter<{
16
+ uri: monaco.Uri;
17
+ }>): void;
14
18
  export declare function getKustoWorker(): Promise<AugmentedWorkerAccessor>;
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 14.0.1(d58ade77c070c9eb832c5ae067820b5be7eb3003)
3
+ * monaco-kusto version: 14.2.2(22fb70324f78ec316d3733a3c97919f80215e03d)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
@@ -9,7 +9,7 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
9
9
  import { languages } from 'monaco-editor/esm/vs/editor/editor.api';
10
10
  import * as ls from 'vscode-languageserver-types';
11
11
  import debounce from 'lodash-es/debounce';
12
- import { L as LANGUAGE_ID, T as Token, t as tokenTypes } from './globals-5d7a5fa1.js';
12
+ import { L as LANGUAGE_ID, T as Token, t as tokenTypes } from './globals-2482dd04.js';
13
13
 
14
14
  class WorkerManager {
15
15
  constructor(_monacoInstance, defaults) {
@@ -792,8 +792,9 @@ const kustoLanguageDefinition = {
792
792
  };
793
793
 
794
794
  class SemanticTokensProvider {
795
- constructor(classificationsGetter) {
795
+ constructor(classificationsGetter, onTokensProvided) {
796
796
  this.classificationsGetter = classificationsGetter;
797
+ this.onTokensProvided = onTokensProvided;
797
798
  }
798
799
  getLegend() {
799
800
  return {
@@ -818,10 +819,12 @@ class SemanticTokensProvider {
818
819
  prevChar = absChar;
819
820
  }
820
821
  }
821
- return {
822
+ const result = {
822
823
  data: new Uint32Array(tokens.flat(2)),
823
824
  resultId: model.getVersionId().toString()
824
825
  };
826
+ this.onTokensProvided?.(resource);
827
+ return result;
825
828
  }
826
829
  releaseDocumentSemanticTokens() {}
827
830
  }
@@ -850,10 +853,10 @@ function toSemanticTokens(classification, model) {
850
853
 
851
854
  // Registers semantic token provider that utilizes the language service
852
855
  // for more context-relevant syntax highlighting.
853
- function semanticTokensProviderRegistrarCreator() {
856
+ function semanticTokensProviderRegistrarCreator(onTokensProvided) {
854
857
  const semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreatorForTest();
855
858
  return (monacoInstance, workerAccessor) => {
856
- const semanticTokensProvider = semanticTokensProviderMaker(workerAccessor);
859
+ const semanticTokensProvider = semanticTokensProviderMaker(workerAccessor, onTokensProvided);
857
860
  semanticTokensProviderRegistrar(monacoInstance, semanticTokensProvider);
858
861
  };
859
862
  }
@@ -866,12 +869,12 @@ function semanticTokensProviderRegistrarCreatorForTest() {
866
869
  semanticTokensDisposable = monacoInstance.languages.registerDocumentSemanticTokensProvider(LANGUAGE_ID, semanticTokensProvider);
867
870
  };
868
871
  }
869
- function semanticTokensProviderMaker(workerAccessor) {
872
+ function semanticTokensProviderMaker(workerAccessor, onTokensProvided) {
870
873
  const classificationsGetter = async resource => {
871
874
  const worker = await workerAccessor(resource);
872
875
  return worker.getClassifications(resource.toString());
873
876
  };
874
- return new SemanticTokensProvider(classificationsGetter);
877
+ return new SemanticTokensProvider(classificationsGetter, onTokensProvided);
875
878
  }
876
879
 
877
880
  languages.LanguageConfiguration;
@@ -884,10 +887,16 @@ let workerPromise = new Promise((resolve, reject) => {
884
887
  /**
885
888
  * Called when Kusto language is first needed (a model has the language set)
886
889
  * @param defaults
890
+ * @param monacoInstance
891
+ * @param onSchemaUpdateCompleteEmitter Optional,fired when the language service has finished all schema-related work
887
892
  */
888
- function setupMode(defaults, monacoInstance) {
893
+ function setupMode(defaults, monacoInstance, onSchemaUpdateCompleteEmitter) {
889
894
  const onSchemaChange = new monaco.Emitter();
890
- const semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreator();
895
+ const semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreator(uri => {
896
+ onSchemaUpdateCompleteEmitter?.fire({
897
+ uri
898
+ });
899
+ });
891
900
  const client = new WorkerManager(monacoInstance, defaults);
892
901
  const workerAccessor = (first, ...more) => {
893
902
  const augmentedSetSchema = async (schema, worker) => {
@@ -814,7 +814,7 @@ var KustoLanguageService = /** @class */ (function () {
814
814
  var databases = Object.keys(schema.Databases)
815
815
  .map(function (key) { return schema.Databases[key]; })
816
816
  .map(function (_a) {
817
- var Name = _a.Name, Tables = _a.Tables, ExternalTables = _a.ExternalTables, MaterializedViews = _a.MaterializedViews, Functions = _a.Functions, _b = _a.EntityGroups, EntityGroups = _b === void 0 ? {} : _b, MinorVersion = _a.MinorVersion, MajorVersion = _a.MajorVersion;
817
+ var Name = _a.Name, Tables = _a.Tables, ExternalTables = _a.ExternalTables, MaterializedViews = _a.MaterializedViews, Functions = _a.Functions, _b = _a.EntityGroups, EntityGroups = _b === void 0 ? {} : _b, MinorVersion = _a.MinorVersion, MajorVersion = _a.MajorVersion, Graphs = _a.Graphs;
818
818
  return ({
819
819
  name: Name,
820
820
  alternateName: databaseInContextAlternateName,
@@ -879,6 +879,16 @@ var KustoLanguageService = /** @class */ (function () {
879
879
  }); }),
880
880
  });
881
881
  }),
882
+ graphs: Object.values(Graphs).reduce(function (graphArray, graph) {
883
+ var graphEntity = {
884
+ name: graph.Name,
885
+ entityType: 'Graph',
886
+ edges: graph.Edges,
887
+ nodes: graph.Nodes,
888
+ snapshots: graph.Snapshots,
889
+ };
890
+ return __spreadArray(__spreadArray([], graphArray, true), [graphEntity], false);
891
+ }, []), // this is a temporary workaround as graphs are not included in the .show schema as json command output
882
892
  });
883
893
  });
884
894
  return {
@@ -1467,7 +1477,8 @@ var KustoLanguageService = /** @class */ (function () {
1467
1477
  var tableSymbols = (db.tables || []).map(this.createTableSymbol);
1468
1478
  var functionSymbols = (db.functions || []).map(this.createFunctionSymbol);
1469
1479
  var entityGroupsSymbols = (db.entityGroups || []).map(this.createEntityGroupSymbol);
1470
- var databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols));
1480
+ var graphModelSymbols = (db.graphs || []).map(this.createGraphModelSymbol);
1481
+ var databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols).concat(graphModelSymbols));
1471
1482
  return databaseSymbol;
1472
1483
  };
1473
1484
  KustoLanguageService.prototype.convertToKustoJsSchemaV2 = function (schema) {
@@ -1737,6 +1748,12 @@ var KustoLanguageService = /** @class */ (function () {
1737
1748
  KustoLanguageService.createEntityGroupSymbol = function (entityGroup) {
1738
1749
  return new sym.EntityGroupSymbol.$ctor3(entityGroup.name, entityGroup.members.join(), null);
1739
1750
  };
1751
+ KustoLanguageService.createGraphModelSymbol = function (graph) {
1752
+ var edges = new Bridge.ArrayEnumerable(graph.edges || []);
1753
+ var nodes = new Bridge.ArrayEnumerable(graph.nodes || []);
1754
+ var snapshots = new Bridge.ArrayEnumerable(graph.snapshots || []);
1755
+ return new sym.GraphModelSymbol.$ctor1(graph.name, edges, nodes, snapshots);
1756
+ };
1740
1757
  return KustoLanguageService;
1741
1758
  }());
1742
1759
  var languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {