@kusto/monaco-kusto 11.3.0 → 12.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 (46) hide show
  1. package/README.md +23 -1
  2. package/package.json +3 -1
  3. package/release/dev/globals-0aacfe72.js +46 -0
  4. package/release/dev/kustoMode.js +235 -507
  5. package/release/dev/kustoWorker.js +49 -93
  6. package/release/dev/{main-80b384b2.js → main-b690e47e.js} +2 -2
  7. package/release/dev/monaco.contribution.js +235 -201
  8. package/release/dev/{schema-89d23a07.js → schema-957f5e9b.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-88d92b64.js +40 -0
  14. package/release/esm/globals.d.ts +1 -0
  15. package/release/esm/globals.js +1 -0
  16. package/release/esm/kusto.worker.js +39 -94
  17. package/release/esm/kustoMode.js +39 -29
  18. package/release/esm/kustoWorker.d.ts +2 -5
  19. package/release/esm/kustoWorker.js +2 -5
  20. package/release/esm/languageFeatures.d.ts +0 -13
  21. package/release/esm/languageFeatures.js +7 -304
  22. package/release/esm/languageFeatures.utils.d.ts +2 -1
  23. package/release/esm/languageFeatures.utils.js +13 -5
  24. package/release/esm/languageServiceManager/kustoLanguageService.d.ts +2 -4
  25. package/release/esm/languageServiceManager/kustoLanguageService.js +58 -72
  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 +22 -79
  29. package/release/esm/{schema-aeb83929.js → schema-66580db4.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/themes.d.ts +11 -0
  35. package/release/esm/syntaxHighlighting/themes.js +103 -0
  36. package/release/esm/syntaxHighlighting/types.d.ts +41 -0
  37. package/release/esm/syntaxHighlighting/types.js +55 -0
  38. package/release/min/globals-cce7b304.js +7 -0
  39. package/release/min/kustoMode.js +2 -2
  40. package/release/min/kustoWorker.js +4 -4
  41. package/release/min/{main-b6454357.js → main-13659fc4.js} +2 -2
  42. package/release/min/monaco.contribution.js +2 -2
  43. package/release/min/schema-ab3cbb28.js +7 -0
  44. package/release/esm/languageServiceManager/kustoMonarchLanguageDefinition.d.ts +0 -2
  45. package/release/esm/languageServiceManager/kustoMonarchLanguageDefinition.js +0 -211
  46. package/release/min/schema-1c89ac80.js +0 -7
@@ -47,7 +47,7 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
47
47
  import * as ls from 'vscode-languageserver-types';
48
48
  import debounce from 'lodash-es/debounce';
49
49
  import { createCompletionCacheManager } from './completionCacheManager/completionCacheManager';
50
- import { createCompletionFilteredText } from './languageFeatures.utils';
50
+ import { createCompletionFilteredText, getFocusedItem } from './languageFeatures.utils';
51
51
  var DiagnosticsAdapter = /** @class */ (function () {
52
52
  function DiagnosticsAdapter(_monacoInstance, _languageId, _worker, defaults, onSchemaChange) {
53
53
  var _this = this;
@@ -362,305 +362,6 @@ function toDiagnostics(resource, diag) {
362
362
  source: diag.source,
363
363
  };
364
364
  }
365
- /**
366
- * Copy of Kusto.Language.Editor.ClassificationKind we don't have to depend on it in this file
367
- */
368
- var ClassificationKind = {
369
- PlainText: 0,
370
- Comment: 1,
371
- Punctuation: 2,
372
- Directive: 3,
373
- Literal: 4,
374
- StringLiteral: 5,
375
- Type: 6,
376
- Column: 7,
377
- Table: 8,
378
- Database: 9,
379
- Function: 10,
380
- Parameter: 11,
381
- Variable: 12,
382
- Identifier: 13,
383
- ClientParameter: 14,
384
- QueryParameter: 15,
385
- ScalarOperator: 16,
386
- MathOperator: 17,
387
- QueryOperator: 18,
388
- Command: 19,
389
- Keyword: 20,
390
- MaterializedView: 21,
391
- SchemaMember: 22,
392
- SignatureParameter: 23,
393
- Option: 24,
394
- };
395
- var ClassificationKindNames = {};
396
- for (var _i = 0, _a = Object.entries(ClassificationKind); _i < _a.length; _i++) {
397
- var _b = _a[_i], key = _b[0], value = _b[1];
398
- ClassificationKindNames[value] = key;
399
- }
400
- // commented here is the color definitions are were defined by v1 intellisense terminology:
401
- // { token: 'comment', foreground: '008000' }, // CommentToken Green
402
- // { token: 'variable.predefined', foreground: '800080' }, // CalculatedColumnToken Purple
403
- // { token: 'function', foreground: '0000FF' }, // FunctionNameToken Blue
404
- // { token: 'operator.sql', foreground: 'FF4500' }, // OperatorToken OrangeRed (now changed to darker color CC3700 because wasn't accessible)
405
- // { token: 'string', foreground: 'B22222' }, // StringLiteralToken Firebrick
406
- // { token: 'operator.scss', foreground: '0000FF' }, // SubOperatorToken Blue
407
- // { token: 'variable', foreground: 'C71585' }, // TableColumnToken MediumVioletRed
408
- // { token: 'variable.parameter', foreground: '9932CC' }, // TableToken DarkOrchid
409
- // { token: '', foreground: '000000' }, // UnknownToken, PlainTextToken Black
410
- // { token: 'type', foreground: '0000FF' }, // DataTypeToken Blue
411
- // { token: 'tag', foreground: '0000FF' }, // ControlCommandToken Blue
412
- // { token: 'annotation', foreground: '2B91AF' }, // QueryParametersToken FF2B91AF
413
- // { token: 'keyword', foreground: '0000FF' }, // CslCommandToken, PluginToken Blue
414
- // { token: 'number', foreground: '191970' }, // LetVariablesToken MidnightBlue
415
- // { token: 'annotation', foreground: '9400D3' }, // ClientDirectiveToken DarkViolet
416
- // { token: 'invalid', background: 'cd3131' },
417
- var classificationToColorLight = {
418
- Column: 'C71585',
419
- Comment: '008000',
420
- Database: 'C71585',
421
- Function: '0000FF',
422
- Identifier: '000000',
423
- Keyword: '0000FF',
424
- Literal: 'B22222',
425
- ScalarOperator: '0000FF',
426
- MaterializedView: 'C71585',
427
- MathOperator: '000000',
428
- Command: '0000FF',
429
- Parameter: '2B91AF',
430
- PlainText: '000000',
431
- Punctuation: '000000',
432
- QueryOperator: 'CC3700',
433
- QueryParameter: 'CC3700',
434
- StringLiteral: 'B22222',
435
- Table: 'C71585',
436
- Type: '0000FF',
437
- Variable: '191970',
438
- Directive: '9400D3',
439
- ClientParameter: 'b5cea8',
440
- SchemaMember: 'C71585',
441
- SignatureParameter: '2B91AF',
442
- Option: '000000',
443
- };
444
- var classificationToColorDark = {
445
- Column: '4ec9b0',
446
- Comment: '6A9B34',
447
- Database: 'c586c0',
448
- Function: 'dcdcaa',
449
- Identifier: 'd4d4d4',
450
- Keyword: '569cd6',
451
- Literal: 'ce9178',
452
- ScalarOperator: '569cd6',
453
- MaterializedView: 'c586c0',
454
- MathOperator: 'd4d4d4',
455
- Command: 'd4d4d4',
456
- Parameter: '2B91AF',
457
- PlainText: 'd4d4d4',
458
- Punctuation: 'd4d4d4',
459
- QueryOperator: '9cdcfe',
460
- QueryParameter: '9cdcfe',
461
- StringLiteral: 'ce9178',
462
- Table: 'c586c0',
463
- Type: '569cd6',
464
- Variable: 'd7ba7d',
465
- Directive: 'b5cea8',
466
- ClientParameter: 'b5cea8',
467
- SchemaMember: '4ec9b0',
468
- SignatureParameter: '2B91AF',
469
- Option: 'd4d4d4',
470
- };
471
- var ColorizationAdapter = /** @class */ (function () {
472
- function ColorizationAdapter(_monacoInstance, _languageId, _worker, defaults, onSchemaChange) {
473
- var _this = this;
474
- this._monacoInstance = _monacoInstance;
475
- this._languageId = _languageId;
476
- this._worker = _worker;
477
- this._disposables = [];
478
- this._contentListener = Object.create(null);
479
- this._configurationListener = Object.create(null);
480
- this._schemaListener = Object.create(null);
481
- this.decorations = [];
482
- injectCss();
483
- var onModelAdd = function (model) {
484
- var languageId = model.getLanguageId();
485
- if (languageId !== _this._languageId) {
486
- return;
487
- }
488
- var debouncedColorization = debounce(function (intervals) { return _this._doColorization(model, languageId, intervals); }, 500);
489
- var handle;
490
- _this._contentListener[model.uri.toString()] = model.onDidChangeContent(function (e) {
491
- // Changes are represented as a range in doc before change, plus the text that it was replaced with.
492
- // We are interested in the range _after_ the change (since that's what we need to colorize).
493
- // following logic calculates that.
494
- var intervalsToColorize = changeEventToIntervals(e);
495
- debouncedColorization(intervalsToColorize);
496
- });
497
- _this._configurationListener[model.uri.toString()] = defaults.onDidChange(function () {
498
- self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
499
- });
500
- _this._schemaListener[model.uri.toString()] = onSchemaChange(function () {
501
- self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
502
- });
503
- };
504
- var onModelRemoved = function (model) {
505
- model.deltaDecorations(_this.decorations, []);
506
- var uriStr = model.uri.toString();
507
- var contentListener = _this._contentListener[uriStr];
508
- if (contentListener) {
509
- contentListener.dispose();
510
- delete _this._contentListener[uriStr];
511
- }
512
- var configurationListener = _this._configurationListener[uriStr];
513
- if (configurationListener) {
514
- configurationListener.dispose();
515
- delete _this._configurationListener[uriStr];
516
- }
517
- var schemaListener = _this._configurationListener[uriStr];
518
- if (schemaListener) {
519
- schemaListener.dispose();
520
- delete _this._schemaListener[uriStr];
521
- }
522
- };
523
- this._disposables.push(this._monacoInstance.editor.onDidCreateModel(onModelAdd));
524
- this._disposables.push(this._monacoInstance.editor.onWillDisposeModel(onModelRemoved));
525
- this._disposables.push(this._monacoInstance.editor.onDidChangeModelLanguage(function (event) {
526
- onModelRemoved(event.model);
527
- onModelAdd(event.model);
528
- }));
529
- this._disposables.push({
530
- dispose: function () {
531
- for (var key in _this._contentListener) {
532
- _this._contentListener[key].dispose();
533
- }
534
- },
535
- });
536
- this._monacoInstance.editor.getModels().forEach(onModelAdd);
537
- }
538
- ColorizationAdapter.prototype.dispose = function () {
539
- this._disposables.forEach(function (d) { return d && d.dispose(); });
540
- this._disposables = [];
541
- };
542
- ColorizationAdapter.prototype._doColorization = function (model, languageId, intervals) {
543
- var _this = this;
544
- if (model.isDisposed()) {
545
- return;
546
- }
547
- var resource = model.uri;
548
- var versionNumberBeforeColorization = model.getVersionId();
549
- this._worker(resource)
550
- .then(function (worker) {
551
- if (model.isDisposed()) {
552
- return;
553
- }
554
- return worker.doColorization(resource.toString(), intervals);
555
- })
556
- .then(function (colorizationRanges) {
557
- if (model.isDisposed()) {
558
- return;
559
- }
560
- var newModel = _this._monacoInstance.editor.getModel(model.uri);
561
- var versionId = newModel.getVersionId();
562
- // don't colorize an older version of the document.
563
- if (versionId !== versionNumberBeforeColorization) {
564
- return;
565
- }
566
- var decorationRanges = colorizationRanges.map(function (colorizationRange) {
567
- var decorations = colorizationRange.classifications
568
- .map(function (classification) { return toDecoration(model, classification); })
569
- // The following line will prevent things that aren't going to be colorized anyway to get a CSS class.
570
- // This will prevent the case where the non-semantic colorizer already figured out that a keyword needs
571
- // to be colorized, but the outdated semantic colorizer still thinks it's a plain text and wants it colored
572
- // in black.
573
- .filter(function (d) {
574
- return d.options.inlineClassName !== 'PlainText' && d.options.inlineClassName != 'Identifier';
575
- });
576
- var firstImpactedLine = model.getPositionAt(colorizationRange.absoluteStart).lineNumber;
577
- var endPosition = model.getPositionAt(colorizationRange.absoluteEnd);
578
- // A token that ends in the first column of the next line is not considered to be part of that line.
579
- var lastImpactedLine = endPosition.column == 1 && endPosition.lineNumber > 1
580
- ? endPosition.lineNumber - 1
581
- : endPosition.lineNumber;
582
- return { decorations: decorations, firstImpactedLine: firstImpactedLine, lastImpactedLine: lastImpactedLine };
583
- });
584
- // Compute the previous decorations we want to replace with the new ones.
585
- var oldDecorations = decorationRanges
586
- .map(function (range) {
587
- return model
588
- .getLinesDecorations(range.firstImpactedLine, range.lastImpactedLine)
589
- .filter(function (d) { return classificationToColorLight[d.options.inlineClassName]; }) // Don't delete any other decorations
590
- .map(function (d) { return d.id; });
591
- })
592
- .reduce(function (prev, curr) { return prev.concat(curr); }, []);
593
- // Flatten decoration groups to an array of decorations
594
- var newDecorations = decorationRanges.reduce(function (prev, next) { return prev.concat(next.decorations); }, []);
595
- if (model && model.getLanguageId() === languageId) {
596
- _this.decorations = model.deltaDecorations(oldDecorations, newDecorations);
597
- }
598
- })
599
- .catch(function (err) {
600
- // Hack to avoid crashing calling code, while still logging the
601
- // error. Might be better to just let the error propagate
602
- // normally, but that would require more investigation.
603
- setTimeout(function () {
604
- throw err;
605
- }, 0);
606
- });
607
- };
608
- return ColorizationAdapter;
609
- }());
610
- export { ColorizationAdapter };
611
- /**
612
- * Generates a mapping between ClassificationKind and color.
613
- */
614
- function getClassificationColorTriplets() {
615
- var result = Object.keys(ClassificationKind).map(function (key) { return ({
616
- classification: key,
617
- colorLight: classificationToColorLight[key],
618
- colorDark: classificationToColorDark[key],
619
- }); });
620
- return result;
621
- }
622
- /**
623
- * Returns a string which is a css describing all tokens and their colors.
624
- * looks a little bit something like this:
625
- *
626
- * .vs .Literal {color: '#000000';} .vs-dark .Literal {color: '#FFFFFF';}
627
- * .vs .Comment {color: '#111111';} .vs-dark .Comment {color: '#EEEEEE';}
628
- */
629
- function getCssForClassification() {
630
- var classificationColorTriplets = getClassificationColorTriplets();
631
- var cssInnerHtml = classificationColorTriplets
632
- .map(function (pair) {
633
- return ".vs .".concat(pair.classification, " {color: #").concat(pair.colorLight, ";} .vs-dark .").concat(pair.classification, " {color: #").concat(pair.colorDark, ";}");
634
- })
635
- .join('\n');
636
- return cssInnerHtml;
637
- }
638
- /**
639
- * Inject a CSS sheet to the head of document, coloring kusto elements by classification.
640
- * TODO: make idempotent
641
- */
642
- function injectCss() {
643
- var container = document.getElementsByTagName('head')[0];
644
- var style = document.createElement('style');
645
- style.type = 'text/css';
646
- style.media = 'screen';
647
- container.appendChild(style);
648
- ClassificationKind;
649
- style.innerHTML = getCssForClassification();
650
- }
651
- function toDecoration(model, classification) {
652
- var start = model.getPositionAt(classification.start);
653
- var end = model.getPositionAt(classification.start + classification.length);
654
- var range = new monaco.Range(start.lineNumber, start.column, end.lineNumber, end.column);
655
- var inlineClassName = ClassificationKindNames[classification.kind];
656
- return {
657
- range: range,
658
- options: {
659
- inlineClassName: inlineClassName,
660
- stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
661
- },
662
- };
663
- }
664
365
  // --- completion ------
665
366
  function fromPosition(position) {
666
367
  if (!position) {
@@ -762,26 +463,28 @@ var CompletionAdapter = /** @class */ (function () {
762
463
  var wordInfo = model.getWordUntilPosition(position);
763
464
  var wordRange = new monaco.Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
764
465
  var resource = model.uri;
765
- var word = (_a = model === null || model === void 0 ? void 0 : model.getWordAtPosition(position)) === null || _a === void 0 ? void 0 : _a.word;
466
+ var userInput = (_a = model === null || model === void 0 ? void 0 : model.getWordAtPosition(position)) === null || _a === void 0 ? void 0 : _a.word;
766
467
  var onDidProvideCompletionItems = this.languageSettings.onDidProvideCompletionItems;
767
468
  return this.completionCacheManager
768
- .getCompletionItems(word, resource, fromPosition(position))
469
+ .getCompletionItems(userInput, resource, fromPosition(position))
769
470
  .then(function (info) { return (onDidProvideCompletionItems ? onDidProvideCompletionItems(info) : info); })
770
471
  .then(function (info) {
771
472
  if (!info)
772
473
  return;
773
- var items = info.items.map(function (entry) {
474
+ var selectedItem = getFocusedItem(info.items, userInput);
475
+ var items = info.items.map(function (entry, index) {
774
476
  var _a;
775
477
  var item = {
776
478
  label: entry.label,
777
479
  insertText: entry.insertText,
778
480
  sortText: entry.sortText,
779
- filterText: createCompletionFilteredText(word, entry),
481
+ filterText: createCompletionFilteredText(userInput, entry),
780
482
  // TODO: Is this cast safe?
781
483
  documentation: _this.formatDocLink((_a = entry.documentation) === null || _a === void 0 ? void 0 : _a.value),
782
484
  detail: entry.detail,
783
485
  range: wordRange,
784
486
  kind: toCompletionItemKind(entry.kind),
487
+ preselect: selectedItem.filterText === entry.filterText,
785
488
  };
786
489
  if (entry.textEdit) {
787
490
  // TODO: Where is the "range" property coming from?
@@ -1,2 +1,3 @@
1
1
  import * as ls from 'vscode-languageserver-types';
2
- export declare function createCompletionFilteredText(searchWord: string | undefined, completionItem: ls.CompletionItem): string;
2
+ export declare function createCompletionFilteredText(userInput: string | undefined, completionItem: ls.CompletionItem): string;
3
+ export declare function getFocusedItem(completionItems: ls.CompletionItem[], userInput: string): ls.CompletionItem;
@@ -1,7 +1,15 @@
1
- export function createCompletionFilteredText(searchWord, completionItem) {
2
- if (!searchWord)
1
+ export function createCompletionFilteredText(userInput, completionItem) {
2
+ if (!userInput)
3
3
  return completionItem.filterText;
4
- var containedInFilterText = completionItem.filterText.toLowerCase().includes(searchWord.toLowerCase());
5
- var shouldPrependSearchWord = completionItem.data.forcePrecedence && containedInFilterText;
6
- return shouldPrependSearchWord ? "".concat(searchWord).concat(completionItem.filterText) : completionItem.filterText;
4
+ var containedInFilterText = completionItem.filterText.toLowerCase().includes(userInput.toLowerCase());
5
+ if (!containedInFilterText)
6
+ return completionItem.filterText;
7
+ return "".concat(userInput).concat(completionItem.filterText);
8
+ }
9
+ export function getFocusedItem(completionItems, userInput) {
10
+ var firstCompletionItem = completionItems[0];
11
+ if (!userInput)
12
+ return firstCompletionItem;
13
+ var firstMatchingItem = completionItems.find(function (item) { var _a; return (_a = item.filterText) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith(userInput.toLowerCase()); });
14
+ return firstMatchingItem !== null && firstMatchingItem !== void 0 ? firstMatchingItem : firstCompletionItem;
7
15
  }
@@ -11,6 +11,7 @@ import k2 = Kusto.Language.Editor;
11
11
  import { Database } from './schema';
12
12
  import type { RenderInfo } from './renderInfo';
13
13
  import type { ClusterReference, DatabaseReference } from '../types';
14
+ import { ClassificationRange } from '../syntaxHighlighting/types';
14
15
  export declare enum TokenKind {
15
16
  TableToken = 2,
16
17
  TableColumnToken = 4,
@@ -72,10 +73,7 @@ export interface LanguageService {
72
73
  end: number;
73
74
  }[], includeWarnings?: boolean, includeSuggestions?: boolean): Promise<ls.Diagnostic[]>;
74
75
  getResultActions(document: TextDocument, start: number, end: number): Promise<ResultAction[]>;
75
- doColorization(document: TextDocument, intervals: {
76
- start: number;
77
- end: number;
78
- }[]): Promise<ColorizationRange[]>;
76
+ getClassifications(document: TextDocument): Promise<ClassificationRange[]>;
79
77
  doRename(document: TextDocument, position: ls.Position, newName: string): Promise<ls.WorkspaceEdit | undefined>;
80
78
  doHover(document: TextDocument, position: ls.Position): Promise<ls.Hover | undefined>;
81
79
  setParameters(scalarParameters: readonly s.ScalarParameter[], tabularParameters: readonly s.TabularParameter[]): Promise<void>;
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
12
48
  var __rest = (this && this.__rest) || function (s, e) {
13
49
  var t = {};
14
50
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -86,18 +122,6 @@ export var TokenKind;
86
122
  TokenKind[TokenKind["BracketRangeToken"] = 262144] = "BracketRangeToken";
87
123
  TokenKind[TokenKind["ClientDirectiveToken"] = 524288] = "ClientDirectiveToken";
88
124
  })(TokenKind || (TokenKind = {}));
89
- /**
90
- * convert the bridge.net object to a plain javascript object that only contains data.
91
- * @param k2Classifications @kusto/language-service-next bridge.net object
92
- */
93
- function toClassifiedRange(k2Classifications) {
94
- return k2Classifications.map(function (classification) { return ({
95
- start: classification.Start,
96
- end: classification.End,
97
- length: classification.Length,
98
- kind: classification.Kind,
99
- }); });
100
- }
101
125
  var symbolKindToName = (_a = {},
102
126
  _a[sym.SymbolKind.Cluster] = 'Cluster',
103
127
  _a[sym.SymbolKind.Column] = 'Column',
@@ -182,22 +206,6 @@ var KustoLanguageService = /** @class */ (function () {
182
206
  '3Dchart': k2.CompletionKind.RenderChart,
183
207
  list: k2.CompletionKind.RenderChart,
184
208
  };
185
- this.disabledCompletionItemsV1 = {
186
- capacity: k.OptionKind.Policy,
187
- callout: k.OptionKind.Policy,
188
- encoding: k.OptionKind.Policy,
189
- batching: k.OptionKind.Policy,
190
- querythrottling: k.OptionKind.Policy,
191
- merge: k.OptionKind.Policy,
192
- querylimit: k.OptionKind.Policy,
193
- rowstore: k.OptionKind.Policy,
194
- streamingingestion: k.OptionKind.Policy,
195
- restricted_view_access: k.OptionKind.Policy,
196
- sharding: k.OptionKind.Policy,
197
- 'restricted-viewers': k.OptionKind.Policy,
198
- attach: k.OptionKind.Command,
199
- purge: k.OptionKind.Command,
200
- };
201
209
  this._kustoKindtolsKind = (_b = {},
202
210
  _b[k.OptionKind.None] = ls.CompletionItemKind.Interface,
203
211
  _b[k.OptionKind.Operator] = ls.CompletionItemKind.Method,
@@ -421,7 +429,6 @@ var KustoLanguageService = /** @class */ (function () {
421
429
  lsItem.documentation = helpTopic
422
430
  ? { value: _this.formatHelpTopic(helpTopic), kind: ls.MarkupKind.Markdown }
423
431
  : undefined;
424
- lsItem.data = { forcePrecedence: kItem.Kind === k2.CompletionKind.Column };
425
432
  return lsItem;
426
433
  });
427
434
  return Promise.resolve(ls.CompletionList.create(items));
@@ -676,46 +683,27 @@ var KustoLanguageService = /** @class */ (function () {
676
683
  return ls.Diagnostic.create(range, diag.Message, severity, diag.Code);
677
684
  });
678
685
  };
679
- /**
680
- * Colorize one or more kusto blocks (a.k.a commands), or just the entire document.
681
- * Supports multi-cursor editing (colorizes blocks on multiple changes).
682
- * @param document The document to colorize
683
- * @param changeIntervals an array containing 0 or more changed intervals. if the array is empty - just colorize the entire row.
684
- * if the array contains a single change - just color the kusto blocks that wraps this change. If multiple changes are provided,
685
- * colorize all blocks that intersect these changes.
686
- * The code will try to only parse once if this is the same command.
687
- */
688
- KustoLanguageService.prototype.doColorization = function (document, changeIntervals) {
689
- var _this = this;
690
- if (!document || !this._languageSettings.useSemanticColorization) {
691
- return Promise.resolve([]);
692
- }
693
- // V2 intellisense
694
- var script = this.parseDocumentV2(document);
695
- if (changeIntervals.length > 0) {
696
- var blocks_1 = this.toArray(script.Blocks);
697
- var affectedBlocks = this.getAffectedBlocks(blocks_1, changeIntervals);
698
- var result = affectedBlocks.map(function (block) { return ({
699
- classifications: toClassifiedRange(_this.toArray(block.Service.GetClassifications(block.Start, block.End).Classifications)),
700
- absoluteStart: block.Start,
701
- absoluteEnd: block.End,
702
- }); });
703
- return Promise.resolve(result);
704
- }
705
- // Entire document requested
706
- var blocks = this.toArray(script.Blocks);
707
- var classifications = blocks
708
- .map(function (block) {
709
- return _this.toArray(block.Service.GetClassifications(block.Start, block.Length).Classifications);
710
- })
711
- .reduce(function (prev, curr) { return prev.concat(curr); }, []);
712
- return Promise.resolve([
713
- {
714
- classifications: toClassifiedRange(classifications),
715
- absoluteStart: 0,
716
- absoluteEnd: document.getText().length,
717
- },
718
- ]);
686
+ KustoLanguageService.prototype.getClassifications = function (document) {
687
+ return __awaiter(this, void 0, void 0, function () {
688
+ var codeScript, codeBlocks, classificationRanges;
689
+ var _this = this;
690
+ return __generator(this, function (_a) {
691
+ codeScript = this.parseDocumentV2(document);
692
+ codeBlocks = this.toArray(codeScript.Blocks);
693
+ classificationRanges = codeBlocks.map(function (block) {
694
+ var Classifications = block.Service.GetClassifications(block.Start, block.Length).Classifications;
695
+ return _this.toArray(Classifications);
696
+ });
697
+ return [2 /*return*/, classificationRanges.flatMap(function (ranges) {
698
+ return ranges.map(function (range) {
699
+ var _a = document.positionAt(range.Start), line = _a.line, character = _a.character;
700
+ var length = range.Length;
701
+ var kind = range.Kind;
702
+ return { line: line, character: character, length: length, kind: kind };
703
+ });
704
+ })];
705
+ });
706
+ });
719
707
  };
720
708
  KustoLanguageService.prototype.getAffectedBlocks = function (blocks, changeIntervals) {
721
709
  return blocks.filter(function (block) {
@@ -1613,8 +1601,7 @@ var KustoLanguageService = /** @class */ (function () {
1613
1601
  return command;
1614
1602
  };
1615
1603
  KustoLanguageService.prototype.getCurrentCommandV2 = function (script, offset) {
1616
- var block = script.GetBlockAtPosition(offset);
1617
- return block;
1604
+ return script.GetBlockAtPosition(offset);
1618
1605
  };
1619
1606
  KustoLanguageService.prototype.getTextToInsert = function (rule, option) {
1620
1607
  var beforeApplyInfo = rule.GetBeforeApplyInfo(option.Value);
@@ -1745,7 +1732,6 @@ var KustoLanguageService = /** @class */ (function () {
1745
1732
  }());
1746
1733
  var languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
1747
1734
  includeControlCommands: true,
1748
- useSemanticColorization: true,
1749
1735
  completionOptions: { includeExtendedSyntax: false },
1750
1736
  });
1751
1737
  /**
@@ -3,8 +3,6 @@ export interface LanguageSettings {
3
3
  includeControlCommands?: boolean;
4
4
  newlineAfterPipe?: boolean;
5
5
  openSuggestionDialogAfterPreviousSuggestionAccepted?: boolean;
6
- useSemanticColorization?: boolean;
7
- useTokenColorization?: boolean;
8
6
  disabledCompletionItems?: string[];
9
7
  onDidProvideCompletionItems?: OnDidProvideCompletionItems;
10
8
  enableHover?: boolean;
@@ -5,7 +5,7 @@ export * from './languageServiceManager/schema';
5
5
  export * from './languageServiceManager/renderInfo';
6
6
  export * from './languageServiceManager/settings';
7
7
  export * from './types';
8
- export { getCurrentCommandRange } from './extendedEditor';
8
+ export * from './extendedGlobalApi';
9
9
  declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
10
10
  private _onDidChange;
11
11
  private _languageSettings;
@@ -19,8 +19,3 @@ declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
19
19
  }
20
20
  export declare function getKustoWorker(): Promise<WorkerAccessor>;
21
21
  export declare const kustoDefaults: LanguageServiceDefaultsImpl;
22
- export declare const themeNames: {
23
- light: string;
24
- dark: string;
25
- dark2: string;
26
- };