@kusto/monaco-kusto 11.4.0 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +25 -1
  2. package/package.json +3 -1
  3. package/release/dev/kustoMode-d3f9e09a.js +1818 -0
  4. package/release/dev/kustoMode.js +4 -2040
  5. package/release/dev/kustoWorker.js +49 -90
  6. package/release/dev/{main-1587ba64.js → main-f36cb42f.js} +2 -2
  7. package/release/dev/monaco.contribution.js +254 -214
  8. package/release/dev/{schema-a5230652.js → schema-077630e6.js} +13 -2
  9. package/release/esm/extendedGlobalApi/getRangeHtml.d.ts +2 -0
  10. package/release/esm/extendedGlobalApi/getRangeHtml.js +11 -0
  11. package/release/esm/extendedGlobalApi/index.d.ts +1 -0
  12. package/release/esm/extendedGlobalApi/index.js +1 -0
  13. package/release/esm/globals.d.ts +1 -0
  14. package/release/esm/globals.js +1 -0
  15. package/release/esm/kusto.worker.js +39 -91
  16. package/release/esm/kustoMode-349f5467.js +957 -0
  17. package/release/esm/kustoMode.d.ts +4 -8
  18. package/release/esm/kustoMode.js +94 -104
  19. package/release/esm/kustoWorker.d.ts +2 -5
  20. package/release/esm/kustoWorker.js +2 -5
  21. package/release/esm/languageFeatures.d.ts +1 -14
  22. package/release/esm/languageFeatures.js +0 -299
  23. package/release/esm/languageServiceManager/kustoLanguageService.d.ts +2 -4
  24. package/release/esm/languageServiceManager/kustoLanguageService.js +58 -71
  25. package/release/esm/languageServiceManager/schema.d.ts +2 -2
  26. package/release/esm/languageServiceManager/settings.d.ts +0 -2
  27. package/release/esm/monaco.contribution.d.ts +1 -6
  28. package/release/esm/monaco.contribution.js +64 -88
  29. package/release/esm/{schema-c006895b.js → schema-b8f0ba9b.js} +12 -2
  30. package/release/esm/syntaxHighlighting/SemanticTokensProvider.d.ts +18 -0
  31. package/release/esm/syntaxHighlighting/SemanticTokensProvider.js +78 -0
  32. package/release/esm/syntaxHighlighting/kustoMonarchLanguageDefinition.d.ts +2 -0
  33. package/release/esm/syntaxHighlighting/kustoMonarchLanguageDefinition.js +401 -0
  34. package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.d.ts +6 -0
  35. package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.js +23 -0
  36. package/release/esm/syntaxHighlighting/themes.d.ts +11 -0
  37. package/release/esm/syntaxHighlighting/themes.js +103 -0
  38. package/release/esm/syntaxHighlighting/types.d.ts +41 -0
  39. package/release/esm/syntaxHighlighting/types.js +55 -0
  40. package/release/min/kustoMode-2dd4a01e.js +7 -0
  41. package/release/min/kustoMode.js +2 -2
  42. package/release/min/kustoWorker.js +4 -4
  43. package/release/min/{main-75aa3e71.js → main-86d6c837.js} +2 -2
  44. package/release/min/monaco.contribution.js +2 -2
  45. package/release/min/schema-a60c216c.js +7 -0
  46. package/release/esm/languageServiceManager/kustoMonarchLanguageDefinition.d.ts +0 -2
  47. package/release/esm/languageServiceManager/kustoMonarchLanguageDefinition.js +0 -211
  48. package/release/min/schema-192b3175.js +0 -7
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 11.4.0(7572339ea10d5d0fdd55c4a2b813f3663acab903)
3
+ * monaco-kusto version: 12.0.1(56b90ce0fd31e7d6792f5098d1e8204274966b6e)
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-c006895b.js';
11
+ import { a as getEntityDataTypeFromCslType, b as getCallName, c as getExpression, g as getCslTypeNameFromClrType } from './schema-b8f0ba9b.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';
@@ -67,19 +67,6 @@ let TokenKind = /*#__PURE__*/function (TokenKind) {
67
67
  * This issue started happening once upgrading to 0.20.0 from 0.15.5.
68
68
  */
69
69
 
70
- /**
71
- * convert the bridge.net object to a plain javascript object that only contains data.
72
- * @param k2Classifications @kusto/language-service-next bridge.net object
73
- */
74
- function toClassifiedRange(k2Classifications) {
75
- return k2Classifications.map(classification => ({
76
- start: classification.Start,
77
- end: classification.End,
78
- length: classification.Length,
79
- kind: classification.Kind
80
- }));
81
- }
82
-
83
70
  /**
84
71
  * colorization data for specific line range.
85
72
  */
@@ -334,22 +321,6 @@ class KustoLanguageService {
334
321
  }
335
322
  return k.CslDocumentation.Instance.GetTopic(completionOption);
336
323
  }
337
- disabledCompletionItemsV1 = {
338
- capacity: k.OptionKind.Policy,
339
- callout: k.OptionKind.Policy,
340
- encoding: k.OptionKind.Policy,
341
- batching: k.OptionKind.Policy,
342
- querythrottling: k.OptionKind.Policy,
343
- merge: k.OptionKind.Policy,
344
- querylimit: k.OptionKind.Policy,
345
- rowstore: k.OptionKind.Policy,
346
- streamingingestion: k.OptionKind.Policy,
347
- restricted_view_access: k.OptionKind.Policy,
348
- sharding: k.OptionKind.Policy,
349
- 'restricted-viewers': k.OptionKind.Policy,
350
- attach: k.OptionKind.Command,
351
- purge: k.OptionKind.Command
352
- };
353
324
  doRangeFormat(document, range) {
354
325
  if (!document) {
355
326
  return Promise.resolve([]);
@@ -586,44 +557,31 @@ class KustoLanguageService {
586
557
  return ls.Diagnostic.create(range, diag.Message, severity, diag.Code);
587
558
  });
588
559
  }
589
-
590
- /**
591
- * Colorize one or more kusto blocks (a.k.a commands), or just the entire document.
592
- * Supports multi-cursor editing (colorizes blocks on multiple changes).
593
- * @param document The document to colorize
594
- * @param changeIntervals an array containing 0 or more changed intervals. if the array is empty - just colorize the entire row.
595
- * if the array contains a single change - just color the kusto blocks that wraps this change. If multiple changes are provided,
596
- * colorize all blocks that intersect these changes.
597
- * The code will try to only parse once if this is the same command.
598
- */
599
- doColorization(document, changeIntervals) {
600
- if (!document || !this._languageSettings.useSemanticColorization) {
601
- return Promise.resolve([]);
602
- }
603
-
604
- // V2 intellisense
605
- const script = this.parseDocumentV2(document);
606
- if (changeIntervals.length > 0) {
607
- const blocks = this.toArray(script.Blocks);
608
- const affectedBlocks = this.getAffectedBlocks(blocks, changeIntervals);
609
- const result = affectedBlocks.map(block => ({
610
- classifications: toClassifiedRange(this.toArray(block.Service.GetClassifications(block.Start, block.End).Classifications)),
611
- absoluteStart: block.Start,
612
- absoluteEnd: block.End
613
- }));
614
- return Promise.resolve(result);
615
- }
616
-
617
- // Entire document requested
618
- const blocks = this.toArray(script.Blocks);
619
- const classifications = blocks.map(block => {
620
- return this.toArray(block.Service.GetClassifications(block.Start, block.Length).Classifications);
621
- }).reduce((prev, curr) => prev.concat(curr), []);
622
- return Promise.resolve([{
623
- classifications: toClassifiedRange(classifications),
624
- absoluteStart: 0,
625
- absoluteEnd: document.getText().length
626
- }]);
560
+ async getClassifications(document) {
561
+ const codeScript = this.parseDocumentV2(document);
562
+ const codeBlocks = this.toArray(codeScript.Blocks);
563
+ const classificationRanges = codeBlocks.map(block => {
564
+ const {
565
+ Classifications
566
+ } = block.Service.GetClassifications(block.Start, block.Length);
567
+ return this.toArray(Classifications);
568
+ });
569
+ return classificationRanges.flatMap(ranges => {
570
+ return ranges.map(range => {
571
+ const {
572
+ line,
573
+ character
574
+ } = document.positionAt(range.Start);
575
+ const length = range.Length;
576
+ const kind = range.Kind;
577
+ return {
578
+ line,
579
+ character,
580
+ length,
581
+ kind
582
+ };
583
+ });
584
+ });
627
585
  }
628
586
  getAffectedBlocks(blocks, changeIntervals) {
629
587
  return blocks.filter(block =>
@@ -1261,15 +1219,15 @@ class KustoLanguageService {
1261
1219
  * Here it gets converted to the bridge.Net schema
1262
1220
  * @param schema Language Service schema
1263
1221
  */
1264
- static convertToKustoJsSchema(schema) {
1265
- switch (schema.clusterType) {
1222
+ static convertToKustoJsSchema(schema$1) {
1223
+ switch (schema$1.clusterType) {
1266
1224
  case 'Engine':
1267
- const currentDatabaseName = schema.database ? schema.database.name : undefined;
1225
+ const currentDatabaseName = schema$1.database ? schema$1.database.name : undefined;
1268
1226
  const kCluster = new k.KustoIntelliSenseClusterEntity();
1269
1227
  let kDatabaseInContext = undefined;
1270
- kCluster.ConnectionString = schema.cluster.connectionString;
1228
+ kCluster.ConnectionString = schema$1.cluster.connectionString;
1271
1229
  const databases = [];
1272
- schema.cluster.databases.forEach(database => {
1230
+ schema$1.cluster.databases.forEach(database => {
1273
1231
  const kDatabase = new k.KustoIntelliSenseDatabaseEntity();
1274
1232
  kDatabase.Name = database.name;
1275
1233
  const tables = [];
@@ -1302,17 +1260,17 @@ class KustoLanguageService {
1302
1260
  const kSchema = new k.KustoIntelliSenseQuerySchema(kCluster, kDatabaseInContext);
1303
1261
  return kSchema;
1304
1262
  case 'ClusterManager':
1305
- const accounts = schema.accounts.map(account => {
1263
+ const accounts = schema$1.accounts.map(account => {
1306
1264
  const kAccount = new k.KustoIntelliSenseAccountEntity();
1307
1265
  kAccount.Name = account;
1308
1266
  return kAccount;
1309
1267
  });
1310
- const services = schema.services.map(service => {
1268
+ const services = schema$1.services.map(service => {
1311
1269
  const kService = new k.KustoIntelliSenseServiceEntity();
1312
1270
  kService.Name = service;
1313
1271
  return kService;
1314
1272
  });
1315
- const connectionString = schema.connectionString;
1273
+ const connectionString = schema$1.connectionString;
1316
1274
  const result = {
1317
1275
  accounts,
1318
1276
  services,
@@ -1322,7 +1280,7 @@ class KustoLanguageService {
1322
1280
  case 'DataManagement':
1323
1281
  return undefined;
1324
1282
  default:
1325
- return assertNever(schema);
1283
+ return assertNever(schema$1);
1326
1284
  }
1327
1285
  }
1328
1286
 
@@ -1530,8 +1488,7 @@ class KustoLanguageService {
1530
1488
  return command;
1531
1489
  }
1532
1490
  getCurrentCommandV2(script, offset) {
1533
- let block = script.GetBlockAtPosition(offset);
1534
- return block;
1491
+ return script.GetBlockAtPosition(offset);
1535
1492
  }
1536
1493
  getTextToInsert(rule, option) {
1537
1494
  const beforeApplyInfo = rule.GetBeforeApplyInfo(option.Value);
@@ -1754,7 +1711,6 @@ class KustoLanguageService {
1754
1711
  }
1755
1712
  let languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
1756
1713
  includeControlCommands: true,
1757
- useSemanticColorization: true,
1758
1714
  completionOptions: {
1759
1715
  includeExtendedSyntax: false
1760
1716
  }
@@ -1774,17 +1730,12 @@ function getKustoLanguageService() {
1774
1730
  */
1775
1731
 
1776
1732
  class KustoWorkerImpl {
1777
- // --- model sync -----------------------
1778
-
1779
1733
  constructor(ctx, createData) {
1780
1734
  this._ctx = ctx;
1781
1735
  this._languageSettings = createData.languageSettings;
1782
1736
  this._languageService = getKustoLanguageService();
1783
1737
  this._languageService.configure(this._languageSettings);
1784
1738
  }
1785
-
1786
- // --- language service host ---------------
1787
-
1788
1739
  setSchema(schema) {
1789
1740
  return this._languageService.setSchema(schema);
1790
1741
  }
@@ -1969,12 +1920,9 @@ class KustoWorkerImpl {
1969
1920
  const formatted = this._languageService.doCurrentCommandFormat(document, caretPosition);
1970
1921
  return formatted;
1971
1922
  }
1972
-
1973
- // Colorize document. if offsets provided, will only colorize commands at these offsets. otherwise - will color the entire document.
1974
- doColorization(uri, colorizationIntervals) {
1923
+ getClassifications(uri) {
1975
1924
  const document = this._getTextDocument(uri);
1976
- const colorizationInfo = this._languageService.doColorization(document, colorizationIntervals);
1977
- return colorizationInfo;
1925
+ return this._languageService.getClassifications(document);
1978
1926
  }
1979
1927
  getClientDirective(text) {
1980
1928
  return this._languageService.getClientDirective(text);