@kusto/monaco-kusto 10.0.22 → 11.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.
- package/README.md +5 -0
- package/package.json +9 -6
- package/release/dev/Kusto.Language.Bridge.min.js +190 -193
- package/release/dev/kustoMode.js +2 -2
- package/release/dev/kustoWorker.js +123 -287
- package/release/dev/{main-2c182d5b.js → main-89eef687.js} +2 -2
- package/release/dev/monaco.contribution.js +2 -3
- package/release/dev/{schema-c6f82d74.js → schema-d4b2563b.js} +2 -2
- package/release/esm/kusto.worker.js +21 -164
- package/release/esm/languageServiceManager/competionItemSort.d.ts +1 -0
- package/release/esm/languageServiceManager/competionItemSort.js +3 -0
- package/release/esm/languageServiceManager/kustoLanguageService.js +16 -167
- package/release/esm/languageServiceManager/settings.d.ts +0 -1
- package/release/esm/monaco.contribution.js +0 -1
- package/release/esm/{schema-f88560be.js → schema-390a6d13.js} +1 -1
- package/release/min/Kusto.Language.Bridge.min.js +190 -193
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-0657dac0.js → main-42d8da0e.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-acce8a2f.js → schema-c597d265.js} +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 11.0.0(2cd16f8743253b5a0133f2ba4f53203e02c1673c)
|
|
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-
|
|
8
|
+
define('vs/language/kusto/main-89eef687', ['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:
|
|
3
|
+
* monaco-kusto version: 11.0.0(2cd16f8743253b5a0133f2ba4f53203e02c1673c)
|
|
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-
|
|
8
|
+
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-d4b2563b'], (function (require, exports, monaco, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -241,7 +241,6 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
241
241
|
includeControlCommands: true,
|
|
242
242
|
newlineAfterPipe: true,
|
|
243
243
|
openSuggestionDialogAfterPreviousSuggestionAccepted: true,
|
|
244
|
-
useIntellisenseV2: true,
|
|
245
244
|
useSemanticColorization: true,
|
|
246
245
|
useTokenColorization: false,
|
|
247
246
|
enableHover: true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 11.0.0(2cd16f8743253b5a0133f2ba4f53203e02c1673c)
|
|
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-
|
|
8
|
+
define('vs/language/kusto/schema-d4b2563b', ['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,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 11.0.0(2cd16f8743253b5a0133f2ba4f53203e02c1673c)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -8,12 +8,16 @@
|
|
|
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-
|
|
11
|
+
import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-390a6d13.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';
|
|
15
15
|
import '@kusto/language-service-next/Kusto.Language.Bridge.min';
|
|
16
16
|
|
|
17
|
+
const createSortingText = priority => {
|
|
18
|
+
return priority.toString().padStart(10, '0');
|
|
19
|
+
};
|
|
20
|
+
|
|
17
21
|
var k = Kusto.Data.IntelliSense;
|
|
18
22
|
var parsing = Kusto.Language.Parsing;
|
|
19
23
|
var k2 = Kusto.Language.Editor;
|
|
@@ -213,7 +217,7 @@ class KustoLanguageService {
|
|
|
213
217
|
this.createRulesProvider(this._kustoJsSchema, this._schema.clusterType);
|
|
214
218
|
}
|
|
215
219
|
doComplete(document, position) {
|
|
216
|
-
return this.
|
|
220
|
+
return this.doCompleteV2(document, position);
|
|
217
221
|
}
|
|
218
222
|
disabledCompletionItemsV2 = {
|
|
219
223
|
// render charts
|
|
@@ -280,7 +284,7 @@ class KustoLanguageService {
|
|
|
280
284
|
});
|
|
281
285
|
}
|
|
282
286
|
const itemsAsArray = this.toArray(completionItems.Items);
|
|
283
|
-
let items = itemsAsArray.filter(item => !(item && item.MatchText && disabledItems[item.MatchText] !== undefined && (disabledItems[item.MatchText] === k2.CompletionKind.Unknown || disabledItems[item.MatchText] === item.Kind))).map((kItem,
|
|
287
|
+
let items = itemsAsArray.filter(item => !(item && item.MatchText && disabledItems[item.MatchText] !== undefined && (disabledItems[item.MatchText] === k2.CompletionKind.Unknown || disabledItems[item.MatchText] === item.Kind))).map((kItem, index) => {
|
|
284
288
|
const v1CompletionOption = new k.CompletionOption(this._toOptionKind[kItem.Kind] || k.OptionKind.None, kItem.DisplayText);
|
|
285
289
|
const helpTopic = this.getTopic(v1CompletionOption);
|
|
286
290
|
// If we have AfterText it means that the cursor should not be placed at end of suggested text.
|
|
@@ -299,20 +303,13 @@ class KustoLanguageService {
|
|
|
299
303
|
format: ls.InsertTextFormat.PlainText
|
|
300
304
|
};
|
|
301
305
|
const lsItem = ls.CompletionItem.create(kItem.DisplayText);
|
|
302
|
-
|
|
303
|
-
// Adding to columns a prefix to their sortText so they will appear first in the list
|
|
304
|
-
let sortTextPrefix = lsItem.kind === ls.CompletionItemKind.Field ? 0 : itemsAsArray.length;
|
|
305
|
-
const countOfWords = lsItem.label.split('_').filter(item => !!item).length;
|
|
306
|
-
// We always want results with multiple words to show after shorter options.
|
|
307
|
-
// For example: to show "count_distinct" after "count"
|
|
308
|
-
sortTextPrefix = sortTextPrefix * countOfWords;
|
|
309
306
|
const startPosition = document.positionAt(completionItems.EditStart);
|
|
310
307
|
const endPosition = document.positionAt(completionItems.EditStart + completionItems.EditLength);
|
|
311
308
|
lsItem.textEdit = ls.TextEdit.replace(ls.Range.create(startPosition, endPosition), textToInsert);
|
|
312
|
-
lsItem.sortText = this.getSortText(sortTextPrefix + i + 1);
|
|
313
309
|
// Changing the first letter to be lower case, to ignore case-sensitive matching
|
|
314
310
|
lsItem.filterText = kItem.MatchText.charAt(0).toLowerCase() + kItem.MatchText.slice(1);
|
|
315
311
|
lsItem.kind = this.kustoKindToLsKindV2(kItem.Kind);
|
|
312
|
+
lsItem.sortText = createSortingText(index);
|
|
316
313
|
lsItem.insertTextFormat = format;
|
|
317
314
|
lsItem.detail = helpTopic ? helpTopic.ShortDescription : undefined;
|
|
318
315
|
lsItem.documentation = helpTopic ? {
|
|
@@ -323,7 +320,6 @@ class KustoLanguageService {
|
|
|
323
320
|
});
|
|
324
321
|
return Promise.resolve(ls.CompletionList.create(items));
|
|
325
322
|
}
|
|
326
|
-
isIntellisenseV2 = () => this._languageSettings.useIntellisenseV2 && this._schema && this._schema.clusterType === 'Engine';
|
|
327
323
|
|
|
328
324
|
/**
|
|
329
325
|
* when trying to get a topic we need the function name (abs, toLower, ETC).
|
|
@@ -358,58 +354,6 @@ class KustoLanguageService {
|
|
|
358
354
|
attach: k.OptionKind.Command,
|
|
359
355
|
purge: k.OptionKind.Command
|
|
360
356
|
};
|
|
361
|
-
doCompleteV1(document, position) {
|
|
362
|
-
// TODO: fix typing in CslCommandParser to allow rulesProvider to be query only.
|
|
363
|
-
let caretAbsolutePosition = document.offsetAt(position);
|
|
364
|
-
|
|
365
|
-
// find out what's the current command to only parse this one.
|
|
366
|
-
this.parseDocumentV1(document, k.ParseMode.CommandTokensOnly);
|
|
367
|
-
let currentCommand = this.getCurrentCommand(document, caretAbsolutePosition);
|
|
368
|
-
let commandTextUntilCursor = '';
|
|
369
|
-
if (currentCommand) {
|
|
370
|
-
currentCommand.AbsoluteStart;
|
|
371
|
-
this.parseTextV1(currentCommand.Text, k.ParseMode.TokenizeAllText);
|
|
372
|
-
const caretRelativePosition = caretAbsolutePosition - currentCommand.AbsoluteStart;
|
|
373
|
-
commandTextUntilCursor = currentCommand.Text.substring(currentCommand.CslExpressionStartPosition, caretRelativePosition);
|
|
374
|
-
}
|
|
375
|
-
let commandTextWithoutLastWord = this.getCommandWithoutLastWord(commandTextUntilCursor);
|
|
376
|
-
let context = this._rulesProvider.AnalyzeCommand$1(commandTextUntilCursor, currentCommand).Context;
|
|
377
|
-
let result = {
|
|
378
|
-
v: null
|
|
379
|
-
};
|
|
380
|
-
this._rulesProvider.TryMatchAnyRule(commandTextWithoutLastWord, result);
|
|
381
|
-
let rule = result.v;
|
|
382
|
-
if (rule) {
|
|
383
|
-
const completionOptions = this.toArray(rule.GetCompletionOptions(context));
|
|
384
|
-
|
|
385
|
-
// TODO once AppendPipePolicy becomes a public static member of ApplyPolicy in our c# code, and bridge.Net transplies this,
|
|
386
|
-
// remove the 'as any' part..
|
|
387
|
-
// Also = DefaultApplyPolicy is internal in c# code, so not exposed in d.ts, so we cast it to any.
|
|
388
|
-
if (this._languageSettings.newlineAfterPipe && rule.DefaultAfterApplyPolicy === Kusto.Data.IntelliSense.ApplyPolicy.AppendPipePolicy) {
|
|
389
|
-
rule.DefaultAfterApplyPolicy = this._newlineAppendPipePolicy;
|
|
390
|
-
}
|
|
391
|
-
let options = completionOptions.filter(option => !(option && option.Value && this.disabledCompletionItemsV1[option.Value] === option.Kind)).map((option, ordinal) => {
|
|
392
|
-
const {
|
|
393
|
-
insertText,
|
|
394
|
-
insertTextFormat
|
|
395
|
-
} = this.getTextToInsert(rule, option);
|
|
396
|
-
const helpTopic = k.CslDocumentation.Instance.GetTopic(option);
|
|
397
|
-
const item = ls.CompletionItem.create(option.Value);
|
|
398
|
-
item.kind = this.kustoKindToLsKind(option.Kind);
|
|
399
|
-
item.insertText = insertText;
|
|
400
|
-
item.insertTextFormat = insertTextFormat;
|
|
401
|
-
item.sortText = this.getSortText(ordinal + 1);
|
|
402
|
-
item.detail = helpTopic ? helpTopic.ShortDescription : undefined;
|
|
403
|
-
item.documentation = helpTopic ? {
|
|
404
|
-
value: helpTopic.LongDescription,
|
|
405
|
-
kind: ls.MarkupKind.Markdown
|
|
406
|
-
} : undefined;
|
|
407
|
-
return item;
|
|
408
|
-
});
|
|
409
|
-
return Promise.resolve(ls.CompletionList.create(options));
|
|
410
|
-
}
|
|
411
|
-
return Promise.resolve(ls.CompletionList.create([]));
|
|
412
|
-
}
|
|
413
357
|
doRangeFormat(document, range) {
|
|
414
358
|
if (!document) {
|
|
415
359
|
return Promise.resolve([]);
|
|
@@ -525,7 +469,7 @@ class KustoLanguageService {
|
|
|
525
469
|
}
|
|
526
470
|
doValidation(document, changeIntervals, includeWarnings, includeSuggestions) {
|
|
527
471
|
// didn't implement validation for v1.
|
|
528
|
-
if (!document
|
|
472
|
+
if (!document) {
|
|
529
473
|
return Promise.resolve([]);
|
|
530
474
|
}
|
|
531
475
|
const script = this.parseDocumentV2(document);
|
|
@@ -661,56 +605,6 @@ class KustoLanguageService {
|
|
|
661
605
|
return Promise.resolve([]);
|
|
662
606
|
}
|
|
663
607
|
|
|
664
|
-
// V1 intellisense
|
|
665
|
-
if (!this.isIntellisenseV2()) {
|
|
666
|
-
// Handle specific ranges changes (and not the whole doc)
|
|
667
|
-
if (changeIntervals.length > 0) {
|
|
668
|
-
this.parseDocumentV1(document, k.ParseMode.CommandTokensOnly);
|
|
669
|
-
const affectedCommands = this.toArray(this._parser.Results).filter(command =>
|
|
670
|
-
// a command is affected if it intersects at least on of changed ranges.
|
|
671
|
-
command // command can be null. we're filtering all nulls in the array.
|
|
672
|
-
? changeIntervals.some(({
|
|
673
|
-
start: changeStart,
|
|
674
|
-
end: changeEnd
|
|
675
|
-
}) =>
|
|
676
|
-
// both intervals intersect if either the start or the end of interval A is inside interval B.
|
|
677
|
-
// If we deleted something at the end of a command, the interval will not intersect the current command.
|
|
678
|
-
// so we also want consider affected commands commands the end where the interval begins.
|
|
679
|
-
// hence the + 1.
|
|
680
|
-
command.AbsoluteStart >= changeStart && command.AbsoluteStart <= changeEnd || changeStart >= command.AbsoluteStart && changeStart <= command.AbsoluteEnd + 1) : false);
|
|
681
|
-
|
|
682
|
-
// We're not on any command so don't return any classifications.
|
|
683
|
-
// this can happen if we're at the and of the file and deleting empty rows (for example).
|
|
684
|
-
if (!affectedCommands || affectedCommands.length === 0) {
|
|
685
|
-
return Promise.resolve([{
|
|
686
|
-
classifications: [],
|
|
687
|
-
absoluteStart: changeIntervals[0].start,
|
|
688
|
-
absoluteEnd: changeIntervals[0].end
|
|
689
|
-
}]);
|
|
690
|
-
}
|
|
691
|
-
const results = affectedCommands.map(command => {
|
|
692
|
-
this.parseTextV1(command.Text, k.ParseMode.TokenizeAllText);
|
|
693
|
-
const k2Classifications = this.getClassificationsFromParseResult(command.AbsoluteStart);
|
|
694
|
-
const classifications = toClassifiedRange(k2Classifications);
|
|
695
|
-
return {
|
|
696
|
-
classifications: classifications,
|
|
697
|
-
absoluteStart: command.AbsoluteStart,
|
|
698
|
-
absoluteEnd: command.AbsoluteEnd
|
|
699
|
-
};
|
|
700
|
-
});
|
|
701
|
-
return Promise.resolve(results);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
// Entire document requested
|
|
705
|
-
this.parseDocumentV1(document, k.ParseMode.TokenizeAllText);
|
|
706
|
-
const classifications = this.getClassificationsFromParseResult();
|
|
707
|
-
return Promise.resolve([{
|
|
708
|
-
classifications: toClassifiedRange(classifications),
|
|
709
|
-
absoluteStart: 0,
|
|
710
|
-
absoluteEnd: document.getText().length
|
|
711
|
-
}]);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
608
|
// V2 intellisense
|
|
715
609
|
const script = this.parseDocumentV2(document);
|
|
716
610
|
if (changeIntervals.length > 0) {
|
|
@@ -790,7 +684,7 @@ class KustoLanguageService {
|
|
|
790
684
|
setSchema(schema) {
|
|
791
685
|
this._schema = schema;
|
|
792
686
|
// We support intellisenseV2 only if the clusterType is "Engine", even if the setting is enabled
|
|
793
|
-
if (
|
|
687
|
+
if (schema && schema.clusterType === 'Engine') {
|
|
794
688
|
let kustoJsSchemaV2 = this.convertToKustoJsSchemaV2(schema);
|
|
795
689
|
this._kustoJsSchemaV2 = kustoJsSchemaV2;
|
|
796
690
|
this._script = undefined;
|
|
@@ -805,7 +699,7 @@ class KustoLanguageService {
|
|
|
805
699
|
return Promise.resolve();
|
|
806
700
|
}
|
|
807
701
|
setParameters(scalarParameters, tabularParameters) {
|
|
808
|
-
if (
|
|
702
|
+
if (this._schema.clusterType !== 'Engine') {
|
|
809
703
|
throw new Error('setParameters requires intellisense V2 and Engine cluster');
|
|
810
704
|
}
|
|
811
705
|
this._schema.globalScalarParameters = scalarParameters;
|
|
@@ -934,11 +828,11 @@ class KustoLanguageService {
|
|
|
934
828
|
return Promise.resolve(this._schema);
|
|
935
829
|
}
|
|
936
830
|
getCommandInContext(document, cursorOffset) {
|
|
937
|
-
return this.
|
|
831
|
+
return this.getCommandInContextV2(document, cursorOffset);
|
|
938
832
|
}
|
|
939
833
|
getCommandAndLocationInContext(document, cursorOffset) {
|
|
940
834
|
// We are going to remove v1 intellisense. no use to keep parity.
|
|
941
|
-
if (!document
|
|
835
|
+
if (!document) {
|
|
942
836
|
return Promise.resolve(null);
|
|
943
837
|
}
|
|
944
838
|
const script = this.parseDocumentV2(document);
|
|
@@ -955,14 +849,6 @@ class KustoLanguageService {
|
|
|
955
849
|
location
|
|
956
850
|
});
|
|
957
851
|
}
|
|
958
|
-
getCommandInContextV1(document, cursorOffset) {
|
|
959
|
-
this.parseDocumentV1(document, k.ParseMode.CommandTokensOnly);
|
|
960
|
-
const command = this.getCurrentCommand(document, cursorOffset);
|
|
961
|
-
if (!command) {
|
|
962
|
-
return Promise.resolve(null);
|
|
963
|
-
}
|
|
964
|
-
return Promise.resolve(command.Text);
|
|
965
|
-
}
|
|
966
852
|
getCommandInContextV2(document, cursorOffset) {
|
|
967
853
|
if (!document) {
|
|
968
854
|
return Promise.resolve(null);
|
|
@@ -984,7 +870,7 @@ class KustoLanguageService {
|
|
|
984
870
|
if (!document) {
|
|
985
871
|
return Promise.resolve([]);
|
|
986
872
|
}
|
|
987
|
-
return this.
|
|
873
|
+
return this.getCommandsInDocumentV2(document);
|
|
988
874
|
}
|
|
989
875
|
getCommandsInDocumentV1(document) {
|
|
990
876
|
this.parseDocumentV1(document, k.ParseMode.CommandTokensOnly);
|
|
@@ -1088,7 +974,7 @@ class KustoLanguageService {
|
|
|
1088
974
|
});
|
|
1089
975
|
}
|
|
1090
976
|
findDefinition(document, position) {
|
|
1091
|
-
if (!document
|
|
977
|
+
if (!document) {
|
|
1092
978
|
return Promise.resolve([]);
|
|
1093
979
|
}
|
|
1094
980
|
const script = this.parseDocumentV2(document);
|
|
@@ -1110,7 +996,7 @@ class KustoLanguageService {
|
|
|
1110
996
|
return Promise.resolve([location]);
|
|
1111
997
|
}
|
|
1112
998
|
findReferences(document, position) {
|
|
1113
|
-
if (!document
|
|
999
|
+
if (!document) {
|
|
1114
1000
|
return Promise.resolve([]);
|
|
1115
1001
|
}
|
|
1116
1002
|
const script = this.parseDocumentV2(document);
|
|
@@ -1134,10 +1020,9 @@ class KustoLanguageService {
|
|
|
1134
1020
|
return Promise.resolve(references);
|
|
1135
1021
|
}
|
|
1136
1022
|
getQueryParams(document, cursorOffset) {
|
|
1137
|
-
if (!document
|
|
1023
|
+
if (!document) {
|
|
1138
1024
|
return Promise.resolve([]);
|
|
1139
1025
|
}
|
|
1140
|
-
this.parseDocumentV2(document);
|
|
1141
1026
|
const parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
|
|
1142
1027
|
const queryParamStatements = this.toArray(parsedAndAnalyzed.Syntax.GetDescendants(Kusto.Language.Syntax.QueryParametersStatement));
|
|
1143
1028
|
if (!queryParamStatements || queryParamStatements.length == 0) {
|
|
@@ -1285,9 +1170,6 @@ class KustoLanguageService {
|
|
|
1285
1170
|
return Promise.resolve(result);
|
|
1286
1171
|
}
|
|
1287
1172
|
getGlobalParams(document) {
|
|
1288
|
-
if (!this.isIntellisenseV2()) {
|
|
1289
|
-
return Promise.resolve([]);
|
|
1290
|
-
}
|
|
1291
1173
|
const params = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
1292
1174
|
const result = params.map(param => ({
|
|
1293
1175
|
name: param.Name,
|
|
@@ -1296,7 +1178,7 @@ class KustoLanguageService {
|
|
|
1296
1178
|
return Promise.resolve(result);
|
|
1297
1179
|
}
|
|
1298
1180
|
doRename(document, position, newName) {
|
|
1299
|
-
if (!document
|
|
1181
|
+
if (!document) {
|
|
1300
1182
|
return Promise.resolve(undefined);
|
|
1301
1183
|
}
|
|
1302
1184
|
const script = this.parseDocumentV2(document);
|
|
@@ -1329,7 +1211,7 @@ class KustoLanguageService {
|
|
|
1329
1211
|
return Promise.resolve(workspaceEdit);
|
|
1330
1212
|
}
|
|
1331
1213
|
doHover(document, position) {
|
|
1332
|
-
if (!document
|
|
1214
|
+
if (!document) {
|
|
1333
1215
|
return Promise.resolve(undefined);
|
|
1334
1216
|
}
|
|
1335
1217
|
const script = this.parseDocumentV2(document);
|
|
@@ -1597,30 +1479,6 @@ class KustoLanguageService {
|
|
|
1597
1479
|
return newRange;
|
|
1598
1480
|
}
|
|
1599
1481
|
|
|
1600
|
-
/**
|
|
1601
|
-
* Maps numbers to strings, such that if a>b numerically, f(a)>f(b) lexicographically.
|
|
1602
|
-
* 1 -> "a", 26 -> "z", 27 -> "za", 28 -> "zb", 52 -> "zz", 53 ->"zza"
|
|
1603
|
-
* @param order - The number to be converted to a sorting-string. order should start at 1.
|
|
1604
|
-
* @returns A string repenting the order.
|
|
1605
|
-
*/
|
|
1606
|
-
getSortText(order) {
|
|
1607
|
-
if (order <= 0) {
|
|
1608
|
-
throw new RangeError(`order should be a number >= 1. instead got ${order}`);
|
|
1609
|
-
}
|
|
1610
|
-
let sortText = '';
|
|
1611
|
-
let numCharacters = 26; // "z" - "a" + 1;
|
|
1612
|
-
|
|
1613
|
-
let div = Math.floor(order / numCharacters);
|
|
1614
|
-
for (let i = 0; i < div; ++i) {
|
|
1615
|
-
sortText += 'z';
|
|
1616
|
-
}
|
|
1617
|
-
let reminder = order % numCharacters;
|
|
1618
|
-
if (reminder > 0) {
|
|
1619
|
-
sortText += String.fromCharCode(96 + reminder);
|
|
1620
|
-
}
|
|
1621
|
-
return sortText;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
1482
|
/**
|
|
1625
1483
|
* ParseTextV1 parses the given text with the given parse mode.
|
|
1626
1484
|
* Additionally - it will make sure not to provide rules provider for non-engine clusters
|
|
@@ -1855,7 +1713,7 @@ class KustoLanguageService {
|
|
|
1855
1713
|
return conversion || k2.ClassificationKind.PlainText;
|
|
1856
1714
|
}
|
|
1857
1715
|
parseAndAnalyze(document, cursorOffset) {
|
|
1858
|
-
if (!document
|
|
1716
|
+
if (!document) {
|
|
1859
1717
|
return undefined;
|
|
1860
1718
|
}
|
|
1861
1719
|
const script = this.parseDocumentV2(document);
|
|
@@ -1900,7 +1758,6 @@ class KustoLanguageService {
|
|
|
1900
1758
|
}
|
|
1901
1759
|
let languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
|
|
1902
1760
|
includeControlCommands: true,
|
|
1903
|
-
useIntellisenseV2: true,
|
|
1904
1761
|
useSemanticColorization: true,
|
|
1905
1762
|
completionOptions: {
|
|
1906
1763
|
includeExtendedSyntax: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createSortingText: (priority: number) => string;
|