@kusto/monaco-kusto 8.2.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -16
- package/release/dev/Kusto.Language.Bridge.min.js +1 -1
- package/release/dev/kusto.javascript.client.min.js +1 -1
- package/release/dev/kustoMode.js +21 -21
- package/release/dev/kustoWorker.js +123 -96
- package/release/dev/{main-f25d1ca7.js → main-adf33640.js} +168 -381
- package/release/dev/monaco.contribution.js +6 -9
- package/release/dev/{schema-8dc56616.js → schema-9a35b99a.js} +4 -4
- package/release/esm/commandFormatter.js +37 -0
- package/release/esm/commandHighlighter.js +52 -0
- package/release/esm/extendedEditor.js +41 -0
- package/release/esm/kusto.worker.js +48 -33
- package/release/esm/kustoMode.js +139 -1158
- package/release/esm/kustoWorker.js +252 -0
- package/release/esm/languageFeatures.js +1072 -0
- package/release/esm/languageService/kustoLanguageService.d.ts +2 -2
- package/release/esm/languageService/kustoLanguageService.js +1943 -0
- package/release/esm/languageService/kustoMonarchLanguageDefinition.js +211 -0
- package/release/esm/languageService/renderInfo.js +1 -0
- package/release/esm/languageService/schema.d.ts +7 -0
- package/release/esm/languageService/schema.js +64 -0
- package/release/esm/languageService/settings.js +1 -0
- package/release/esm/monaco.contribution.js +178 -426
- package/release/esm/{schema-1d41f705.js → schema-6a20da13.js} +1 -2
- package/release/esm/types.js +1 -0
- package/release/esm/workerManager.js +102 -0
- package/release/min/Kusto.Language.Bridge.min.js +1 -1
- package/release/min/kusto.javascript.client.min.js +1 -1
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/main-6b448f4d.js +7 -0
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-ef0ffe13.js → schema-7077f0b7.js} +2 -2
- package/release/min/main-c1317e01.js +0 -7
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
export var KustoLanguageDefinition = {
|
|
2
|
+
name: 'kusto',
|
|
3
|
+
mimeTypes: ['text/kusto'],
|
|
4
|
+
displayName: 'Kusto',
|
|
5
|
+
defaultToken: 'invalid',
|
|
6
|
+
brackets: [
|
|
7
|
+
['[', ']', 'delimiter.square'],
|
|
8
|
+
['(', ')', 'delimiter.parenthesis'],
|
|
9
|
+
],
|
|
10
|
+
wordDefinition: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
11
|
+
// .slice() call is for creating a shallow copy of the array since bridge.net shoves a $type property on the array which monaco doesn't like.
|
|
12
|
+
// Kusto.Data.IntelliSense.CslCommandParser.PromotedOperatorCommandTokens.slice(0),
|
|
13
|
+
promotedOperatorCommandTokens: [
|
|
14
|
+
'where',
|
|
15
|
+
'count',
|
|
16
|
+
'extend',
|
|
17
|
+
'join',
|
|
18
|
+
'limit',
|
|
19
|
+
'order',
|
|
20
|
+
'project',
|
|
21
|
+
'project-away',
|
|
22
|
+
'project-rename',
|
|
23
|
+
'project-reorder',
|
|
24
|
+
'project-keep',
|
|
25
|
+
'render',
|
|
26
|
+
'sort',
|
|
27
|
+
'summarize',
|
|
28
|
+
'distinct',
|
|
29
|
+
'take',
|
|
30
|
+
'top',
|
|
31
|
+
'top-nested',
|
|
32
|
+
'top-hitters',
|
|
33
|
+
'union',
|
|
34
|
+
'mv-expand',
|
|
35
|
+
'mv-apply',
|
|
36
|
+
'reduce',
|
|
37
|
+
'evaluate',
|
|
38
|
+
'parse',
|
|
39
|
+
'parse-where',
|
|
40
|
+
'parse-kv',
|
|
41
|
+
'sample',
|
|
42
|
+
'sample-distinct',
|
|
43
|
+
'make-series',
|
|
44
|
+
'getschema',
|
|
45
|
+
'serialize',
|
|
46
|
+
'invoke',
|
|
47
|
+
'as',
|
|
48
|
+
'scan',
|
|
49
|
+
],
|
|
50
|
+
// Kusto.Data.IntelliSense.CslCommandParser.OperatorCommandTokens.slice(0),
|
|
51
|
+
operatorCommandTokens: [
|
|
52
|
+
'filter',
|
|
53
|
+
'fork',
|
|
54
|
+
'facet',
|
|
55
|
+
'range',
|
|
56
|
+
'consume',
|
|
57
|
+
'find',
|
|
58
|
+
'search',
|
|
59
|
+
'print',
|
|
60
|
+
'partition',
|
|
61
|
+
'lookup',
|
|
62
|
+
'where',
|
|
63
|
+
'count',
|
|
64
|
+
'extend',
|
|
65
|
+
'join',
|
|
66
|
+
'limit',
|
|
67
|
+
'order',
|
|
68
|
+
'project',
|
|
69
|
+
'project-away',
|
|
70
|
+
'project-rename',
|
|
71
|
+
'project-reorder',
|
|
72
|
+
'project-keep',
|
|
73
|
+
'render',
|
|
74
|
+
'sort',
|
|
75
|
+
'summarize',
|
|
76
|
+
'distinct',
|
|
77
|
+
'take',
|
|
78
|
+
'top',
|
|
79
|
+
'top-nested',
|
|
80
|
+
'top-hitters',
|
|
81
|
+
'union',
|
|
82
|
+
'mv-expand',
|
|
83
|
+
'mv-apply',
|
|
84
|
+
'reduce',
|
|
85
|
+
'evaluate',
|
|
86
|
+
'parse',
|
|
87
|
+
'parse-where',
|
|
88
|
+
'parse-kv',
|
|
89
|
+
'sample',
|
|
90
|
+
'sample-distinct',
|
|
91
|
+
'make-series',
|
|
92
|
+
'getschema',
|
|
93
|
+
'serialize',
|
|
94
|
+
'invoke',
|
|
95
|
+
'as',
|
|
96
|
+
'scan',
|
|
97
|
+
],
|
|
98
|
+
keywords: [
|
|
99
|
+
'by',
|
|
100
|
+
'on',
|
|
101
|
+
'contains',
|
|
102
|
+
'notcontains',
|
|
103
|
+
'containscs',
|
|
104
|
+
'notcontainscs',
|
|
105
|
+
'startswith',
|
|
106
|
+
'has',
|
|
107
|
+
'matches',
|
|
108
|
+
'regex',
|
|
109
|
+
'true',
|
|
110
|
+
'false',
|
|
111
|
+
'and',
|
|
112
|
+
'or',
|
|
113
|
+
'typeof',
|
|
114
|
+
'int',
|
|
115
|
+
'string',
|
|
116
|
+
'date',
|
|
117
|
+
'datetime',
|
|
118
|
+
'time',
|
|
119
|
+
'long',
|
|
120
|
+
'real',
|
|
121
|
+
'boolean',
|
|
122
|
+
'bool',
|
|
123
|
+
],
|
|
124
|
+
operators: ['+', '-', '*', '/', '>', '<', '==', '<>', '<=', '>=', '~', '!~'],
|
|
125
|
+
builtinFunctions: [
|
|
126
|
+
'countof',
|
|
127
|
+
'bin',
|
|
128
|
+
'extentid',
|
|
129
|
+
'extract',
|
|
130
|
+
'extractjson',
|
|
131
|
+
'floor',
|
|
132
|
+
'iif',
|
|
133
|
+
'isnull',
|
|
134
|
+
'isnotnull',
|
|
135
|
+
'notnull',
|
|
136
|
+
'isempty',
|
|
137
|
+
'isnotempty',
|
|
138
|
+
'notempty',
|
|
139
|
+
'now',
|
|
140
|
+
're2',
|
|
141
|
+
'strcat',
|
|
142
|
+
'strlen',
|
|
143
|
+
'toupper',
|
|
144
|
+
'tostring',
|
|
145
|
+
'count',
|
|
146
|
+
'cnt',
|
|
147
|
+
'sum',
|
|
148
|
+
'min',
|
|
149
|
+
'max',
|
|
150
|
+
'avg',
|
|
151
|
+
],
|
|
152
|
+
tokenizer: {
|
|
153
|
+
root: [
|
|
154
|
+
{ include: '@whitespace' },
|
|
155
|
+
{ include: '@numbers' },
|
|
156
|
+
{ include: '@strings' },
|
|
157
|
+
{ include: '@dqstrings' },
|
|
158
|
+
{ include: '@literals' },
|
|
159
|
+
{ include: '@comments' },
|
|
160
|
+
[/[;,.]/, 'delimiter'],
|
|
161
|
+
[/[()\[\]]/, '@brackets'],
|
|
162
|
+
[/[<>=!%&+\-*/|~^]/, 'operator'],
|
|
163
|
+
[
|
|
164
|
+
/[\w@#\-$]+/,
|
|
165
|
+
{
|
|
166
|
+
cases: {
|
|
167
|
+
'@keywords': 'keyword',
|
|
168
|
+
'@promotedOperatorCommandTokens': 'operator.sql',
|
|
169
|
+
'@operatorCommandTokens': 'keyword',
|
|
170
|
+
'@operators': 'operator',
|
|
171
|
+
'@builtinFunctions': 'predefined',
|
|
172
|
+
'@default': 'identifier',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
],
|
|
177
|
+
whitespace: [[/\s+/, 'white']],
|
|
178
|
+
comments: [['\\/\\/+.*', 'comment']],
|
|
179
|
+
numbers: [
|
|
180
|
+
[/0[xX][0-9a-fA-F]*/, 'number'],
|
|
181
|
+
[/[$][+-]*\d*(\.\d*)?/, 'number'],
|
|
182
|
+
[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number'],
|
|
183
|
+
],
|
|
184
|
+
strings: [
|
|
185
|
+
[/H'/, { token: 'string.quote', bracket: '@open', next: '@string' }],
|
|
186
|
+
[/h'/, { token: 'string.quote', bracket: '@open', next: '@string' }],
|
|
187
|
+
[/'/, { token: 'string.quote', bracket: '@open', next: '@string' }],
|
|
188
|
+
],
|
|
189
|
+
string: [
|
|
190
|
+
[/[^']+/, 'string'],
|
|
191
|
+
[/''/, 'string'],
|
|
192
|
+
[/'/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
|
|
193
|
+
],
|
|
194
|
+
dqstrings: [
|
|
195
|
+
[/H"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }],
|
|
196
|
+
[/h"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }],
|
|
197
|
+
[/"/, { token: 'string.quote', bracket: '@open', next: '@dqstring' }],
|
|
198
|
+
],
|
|
199
|
+
dqstring: [
|
|
200
|
+
[/[^"]+/, 'string'],
|
|
201
|
+
[/""/, 'string'],
|
|
202
|
+
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
|
|
203
|
+
],
|
|
204
|
+
literals: [
|
|
205
|
+
[/datetime\(\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}(:\d{2}(\.\d{0,3})?)?)?\)/, 'number'],
|
|
206
|
+
[/time\((\d+(s(ec(onds?)?)?|m(in(utes?)?)?|h(ours?)?|d(ays?)?)|(\s*(('[^']+')|("[^"]+"))\s*))\)/, 'number'],
|
|
207
|
+
[/guid\([\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}\)/, 'number'],
|
|
208
|
+
[/typeof\((int|string|date|datetime|time|long|real|boolean|bool)\)/, 'number'],
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -41,10 +41,16 @@ export interface Function {
|
|
|
41
41
|
inputParameters: InputParameter[];
|
|
42
42
|
docstring?: string;
|
|
43
43
|
}
|
|
44
|
+
export interface EntityGroup {
|
|
45
|
+
name: string;
|
|
46
|
+
members: string[];
|
|
47
|
+
}
|
|
44
48
|
export interface Database {
|
|
45
49
|
name: string;
|
|
50
|
+
alternateName: string;
|
|
46
51
|
tables: Table[];
|
|
47
52
|
functions: Function[];
|
|
53
|
+
entityGroups: EntityGroup[];
|
|
48
54
|
majorVersion: number;
|
|
49
55
|
minorVersion: number;
|
|
50
56
|
}
|
|
@@ -134,6 +140,7 @@ export declare namespace showSchema {
|
|
|
134
140
|
Tables: Tables;
|
|
135
141
|
ExternalTables: Tables;
|
|
136
142
|
MaterializedViews: Table;
|
|
143
|
+
EntityGroups: Record<string, string[]>;
|
|
137
144
|
MajorVersion: number;
|
|
138
145
|
MinorVersion: number;
|
|
139
146
|
Functions: Functions;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
2
|
+
var dotnetTypeToKustoType = {
|
|
3
|
+
'System.SByte': 'bool',
|
|
4
|
+
'System.Byte': 'uint8',
|
|
5
|
+
'System.Int16': 'int16',
|
|
6
|
+
'System.UInt16': 'uint16',
|
|
7
|
+
'System.Int32': 'int',
|
|
8
|
+
'System.UInt32': 'uint',
|
|
9
|
+
'System.Int64': 'long',
|
|
10
|
+
'System.UInt64': 'ulong',
|
|
11
|
+
'System.String': 'string',
|
|
12
|
+
'System.Single': 'float',
|
|
13
|
+
'System.Double': 'real',
|
|
14
|
+
'System.DateTime': 'datetime',
|
|
15
|
+
'System.TimeSpan': 'timespan',
|
|
16
|
+
'System.Guid': 'guid',
|
|
17
|
+
'System.Boolean': 'bool',
|
|
18
|
+
'Newtonsoft.Json.Linq.JArray': 'dynamic',
|
|
19
|
+
'Newtonsoft.Json.Linq.JObject': 'dynamic',
|
|
20
|
+
'Newtonsoft.Json.Linq.JToken': 'dynamic',
|
|
21
|
+
'System.Object': 'dynamic',
|
|
22
|
+
'System.Data.SqlTypes.SqlDecimal': 'decimal',
|
|
23
|
+
};
|
|
24
|
+
export var getCslTypeNameFromClrType = function (clrType) { return dotnetTypeToKustoType[clrType] || clrType; };
|
|
25
|
+
var kustoTypeToEntityDataType = {
|
|
26
|
+
object: 'Object',
|
|
27
|
+
bool: 'Boolean',
|
|
28
|
+
uint8: 'Byte',
|
|
29
|
+
int16: 'Int16',
|
|
30
|
+
uint16: 'UInt16',
|
|
31
|
+
int: 'Int32',
|
|
32
|
+
uint: 'UInt32',
|
|
33
|
+
long: 'Int64',
|
|
34
|
+
ulong: 'UInt64',
|
|
35
|
+
float: 'Single',
|
|
36
|
+
real: 'Double',
|
|
37
|
+
decimal: 'Decimal',
|
|
38
|
+
datetime: 'DateTime',
|
|
39
|
+
string: 'String',
|
|
40
|
+
dynamic: 'Dynamic',
|
|
41
|
+
timespan: 'TimeSpan',
|
|
42
|
+
};
|
|
43
|
+
export var getEntityDataTypeFromCslType = function (cslType) { return kustoTypeToEntityDataType[cslType] || cslType; };
|
|
44
|
+
export var getCallName = function (fn) {
|
|
45
|
+
return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) { return "{".concat(p.name, "}"); }).join(','), ")");
|
|
46
|
+
};
|
|
47
|
+
export var getExpression = function (fn) {
|
|
48
|
+
return "let ".concat(fn.name, " = ").concat(getInputParametersAsCslString(fn.inputParameters), " ").concat(fn.body);
|
|
49
|
+
};
|
|
50
|
+
export var getInputParametersAsCslString = function (inputParameters) {
|
|
51
|
+
return "(".concat(inputParameters.map(function (inputParameter) { return getInputParameterAsCslString(inputParameter); }).join(','), ")");
|
|
52
|
+
};
|
|
53
|
+
var getInputParameterAsCslString = function (inputParameter) {
|
|
54
|
+
// If this is a tabular parameter
|
|
55
|
+
if (inputParameter.columns && inputParameter.columns.length > 0) {
|
|
56
|
+
var attributesAsString = inputParameter.columns
|
|
57
|
+
.map(function (col) { return "".concat(col.name, ":").concat(col.cslType || getCslTypeNameFromClrType(col.type)); })
|
|
58
|
+
.join(',');
|
|
59
|
+
return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|