@kusto/monaco-kusto 6.2.0 → 7.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.
- package/README.md +35 -10
- package/globalApi.d.ts +13 -0
- package/package.json +6 -5
- package/release/dev/kustoMode.js +57 -25
- package/release/dev/kustoWorker.js +34 -105
- package/release/dev/{main-81df16b2.js → main-a33ab1e1.js} +2 -2
- package/release/dev/monaco.contribution.js +77 -56
- package/release/dev/schema-0bb01ba6.js +109 -0
- package/release/esm/commandFormatter.d.ts +1 -1
- package/release/esm/commandHighlighter.d.ts +1 -2
- package/release/esm/extendedEditor.d.ts +2 -2
- package/release/esm/kusto.worker.js +11 -69
- package/release/esm/kustoMode.d.ts +10 -6
- package/release/esm/kustoMode.js +16 -9
- package/release/esm/kustoWorker.d.ts +22 -8
- package/release/esm/languageFeatures.d.ts +12 -17
- package/release/esm/languageService/kustoLanguageService.d.ts +2 -8
- package/release/esm/languageService/kustoMonarchLanguageDefinition.d.ts +1 -1
- package/release/esm/languageService/schema.d.ts +7 -2
- package/release/esm/languageService/settings.d.ts +4 -4
- package/release/esm/monaco.contribution.d.ts +13 -8
- package/release/esm/monaco.contribution.js +73 -60
- package/release/esm/schema-cdbe085f.js +85 -0
- package/release/esm/types.d.ts +149 -0
- package/release/esm/workerManager.d.ts +5 -7
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-bf0e83c5.js → main-8cd8c26d.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/schema-d831c44f.js +7 -0
- package/release/monaco.d.ts +1 -312
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
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-a33ab1e1', ['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: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
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'], (function (require, exports, monaco
|
|
8
|
+
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-0bb01ba6'], (function (require, exports, monaco, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -24,7 +24,57 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco
|
|
27
|
+
var monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
28
|
+
|
|
29
|
+
function getCurrentCommandRange(editor, cursorPosition) {
|
|
30
|
+
var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
|
|
31
|
+
var lines = editor.getModel().getLinesContent();
|
|
32
|
+
var commandOrdinal = 0;
|
|
33
|
+
var linesWithCommandOrdinal = [];
|
|
34
|
+
for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
|
|
35
|
+
var isEmptyLine = lines[lineNumber].trim() === '';
|
|
36
|
+
if (isEmptyLine) {
|
|
37
|
+
// increase commandCounter - we'll be starting a new command.
|
|
38
|
+
linesWithCommandOrdinal.push({
|
|
39
|
+
commandOrdinal: commandOrdinal++,
|
|
40
|
+
lineNumber: lineNumber
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
linesWithCommandOrdinal.push({
|
|
44
|
+
commandOrdinal: commandOrdinal,
|
|
45
|
+
lineNumber: lineNumber
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// No need to keep scanning if we're past our line and we've seen an empty line.
|
|
50
|
+
if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
|
|
55
|
+
var currentCommandLines = linesWithCommandOrdinal.filter(function (line) {
|
|
56
|
+
return line.commandOrdinal === currentCommandOrdinal;
|
|
57
|
+
});
|
|
58
|
+
var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
|
|
59
|
+
var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
|
|
60
|
+
|
|
61
|
+
// End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
|
|
62
|
+
// Start-column of 1 and End column of 2 means 1st character is selected.
|
|
63
|
+
// Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
|
|
64
|
+
var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
|
|
65
|
+
return new monaco__namespace.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Extending ICode editor to contain additional kusto-specific methods.
|
|
70
|
+
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
71
|
+
*/
|
|
72
|
+
function extend(editor) {
|
|
73
|
+
var proto = Object.getPrototypeOf(editor);
|
|
74
|
+
proto.getCurrentCommandRange = function (cursorPosition) {
|
|
75
|
+
getCurrentCommandRange(this, cursorPosition);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
28
78
|
|
|
29
79
|
function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); }
|
|
30
80
|
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -33,6 +83,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
33
83
|
function _defineProperty$2(obj, key, value) { key = _toPropertyKey$2(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
84
|
function _toPropertyKey$2(arg) { var key = _toPrimitive$2(arg, "string"); return _typeof$2(key) === "symbol" ? key : String(key); }
|
|
35
85
|
function _toPrimitive$2(input, hint) { if (_typeof$2(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof$2(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
86
|
+
|
|
36
87
|
/**
|
|
37
88
|
* Highlights the command that surround cursor location
|
|
38
89
|
*/
|
|
@@ -77,7 +128,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
77
128
|
this.decorations = this.editor.deltaDecorations(this.decorations, []);
|
|
78
129
|
return;
|
|
79
130
|
}
|
|
80
|
-
var commandRange = this.editor
|
|
131
|
+
var commandRange = getCurrentCommandRange(this.editor, changeEvent.selection.getStartPosition());
|
|
81
132
|
var decorations = [{
|
|
82
133
|
range: commandRange,
|
|
83
134
|
options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT
|
|
@@ -87,7 +138,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
87
138
|
}]);
|
|
88
139
|
return KustoCommandHighlighter;
|
|
89
140
|
}();
|
|
90
|
-
_defineProperty$2(KustoCommandHighlighter, "ID", 'editor.contrib.
|
|
141
|
+
_defineProperty$2(KustoCommandHighlighter, "ID", 'editor.contrib.kustoCommandHighlighter');
|
|
91
142
|
_defineProperty$2(KustoCommandHighlighter, "CURRENT_COMMAND_HIGHLIGHT", {
|
|
92
143
|
className: 'selectionHighlight'
|
|
93
144
|
});
|
|
@@ -120,7 +171,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
120
171
|
editor.addAction({
|
|
121
172
|
id: 'editor.action.kusto.formatCurrentCommand',
|
|
122
173
|
label: 'Format Command Under Cursor',
|
|
123
|
-
keybindings: [
|
|
174
|
+
keybindings: [monaco__namespace.KeyMod.chord(monaco__namespace.KeyMod.CtrlCmd | monaco__namespace.KeyCode.KeyK, monaco__namespace.KeyMod.CtrlCmd | monaco__namespace.KeyCode.KeyF)],
|
|
124
175
|
run: function run(ed) {
|
|
125
176
|
editor.trigger('KustoCommandFormatter', 'editor.action.formatSelection', null);
|
|
126
177
|
},
|
|
@@ -131,52 +182,6 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
131
182
|
});
|
|
132
183
|
});
|
|
133
184
|
|
|
134
|
-
/**
|
|
135
|
-
* Extending ICode editor to contain additional kusto-specific methods.
|
|
136
|
-
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
137
|
-
*/
|
|
138
|
-
function extend(editor) {
|
|
139
|
-
var proto = Object.getPrototypeOf(editor);
|
|
140
|
-
proto.getCurrentCommandRange = function (cursorPosition) {
|
|
141
|
-
var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
|
|
142
|
-
var lines = this.getModel().getLinesContent();
|
|
143
|
-
var commandOrdinal = 0;
|
|
144
|
-
var linesWithCommandOrdinal = [];
|
|
145
|
-
for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
|
|
146
|
-
var isEmptyLine = lines[lineNumber].trim() === '';
|
|
147
|
-
if (isEmptyLine) {
|
|
148
|
-
// increase commandCounter - we'll be starting a new command.
|
|
149
|
-
linesWithCommandOrdinal.push({
|
|
150
|
-
commandOrdinal: commandOrdinal++,
|
|
151
|
-
lineNumber: lineNumber
|
|
152
|
-
});
|
|
153
|
-
} else {
|
|
154
|
-
linesWithCommandOrdinal.push({
|
|
155
|
-
commandOrdinal: commandOrdinal,
|
|
156
|
-
lineNumber: lineNumber
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// No need to keep scanning if we're past our line and we've seen an empty line.
|
|
161
|
-
if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
|
|
166
|
-
var currentCommandLines = linesWithCommandOrdinal.filter(function (line) {
|
|
167
|
-
return line.commandOrdinal === currentCommandOrdinal;
|
|
168
|
-
});
|
|
169
|
-
var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
|
|
170
|
-
var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
|
|
171
|
-
|
|
172
|
-
// End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
|
|
173
|
-
// Start-column of 1 and End column of 2 means 1st character is selected.
|
|
174
|
-
// Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
|
|
175
|
-
var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
|
|
176
|
-
return new monaco.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
185
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
181
186
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
182
187
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -184,8 +189,8 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
184
189
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
185
190
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
186
191
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
187
|
-
// --- Kusto configuration and defaults ---------
|
|
188
192
|
|
|
193
|
+
// --- Kusto configuration and defaults ---------
|
|
189
194
|
var LanguageServiceDefaultsImpl = /*#__PURE__*/function () {
|
|
190
195
|
// in milliseconds. For example - this is 2 minutes 2 * 60 * 1000
|
|
191
196
|
|
|
@@ -492,12 +497,28 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
492
497
|
function isStandaloneCodeEditor(editor) {
|
|
493
498
|
return editor.addAction !== undefined;
|
|
494
499
|
}
|
|
495
|
-
|
|
500
|
+
var globalApi = {
|
|
501
|
+
getCslTypeNameFromClrType: schema.getCslTypeNameFromClrType,
|
|
502
|
+
getCallName: schema.getCallName,
|
|
503
|
+
getExpression: schema.getExpression,
|
|
504
|
+
getInputParametersAsCslString: schema.getInputParametersAsCslString,
|
|
505
|
+
getEntityDataTypeFromCslType: schema.getEntityDataTypeFromCslType,
|
|
496
506
|
kustoDefaults: kustoDefaults,
|
|
497
|
-
getKustoWorker: getKustoWorker
|
|
507
|
+
getKustoWorker: getKustoWorker,
|
|
508
|
+
getCurrentCommandRange: getCurrentCommandRange
|
|
498
509
|
};
|
|
510
|
+
monaco__namespace.languages.kusto = globalApi;
|
|
499
511
|
|
|
500
|
-
exports.
|
|
512
|
+
exports.getCallName = schema.getCallName;
|
|
513
|
+
exports.getCslTypeNameFromClrType = schema.getCslTypeNameFromClrType;
|
|
514
|
+
exports.getEntityDataTypeFromCslType = schema.getEntityDataTypeFromCslType;
|
|
515
|
+
exports.getExpression = schema.getExpression;
|
|
516
|
+
exports.getInputParametersAsCslString = schema.getInputParametersAsCslString;
|
|
517
|
+
Object.defineProperty(exports, 'showSchema', {
|
|
518
|
+
enumerable: true,
|
|
519
|
+
get: function () { return schema.showSchema; }
|
|
520
|
+
});
|
|
521
|
+
exports.getCurrentCommandRange = getCurrentCommandRange;
|
|
501
522
|
exports.getKustoWorker = getKustoWorker;
|
|
502
523
|
exports.kustoDefaults = kustoDefaults;
|
|
503
524
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*!-----------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
4
|
+
* Released under the MIT license
|
|
5
|
+
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
|
+
*-----------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
define('vs/language/kusto/schema-0bb01ba6', ['exports'], (function (exports) { 'use strict';
|
|
9
|
+
|
|
10
|
+
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An input parameter either be a scalar in which case it has a name, type and
|
|
14
|
+
* cslType, or it can be columnar, in which case it will have a name, and a list
|
|
15
|
+
* of scalar types which are the column types.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Schema types:
|
|
20
|
+
* Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
|
|
21
|
+
* Cluster Manager – Internal only. A schema for clusters that manages other clusters.
|
|
22
|
+
* Data Management – Internal only. A schema for ingestion point operations.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var dotnetTypeToKustoType = {
|
|
26
|
+
'System.SByte': 'bool',
|
|
27
|
+
'System.Byte': 'uint8',
|
|
28
|
+
'System.Int16': 'int16',
|
|
29
|
+
'System.UInt16': 'uint16',
|
|
30
|
+
'System.Int32': 'int',
|
|
31
|
+
'System.UInt32': 'uint',
|
|
32
|
+
'System.Int64': 'long',
|
|
33
|
+
'System.UInt64': 'ulong',
|
|
34
|
+
'System.String': 'string',
|
|
35
|
+
'System.Single': 'float',
|
|
36
|
+
'System.Double': 'real',
|
|
37
|
+
'System.DateTime': 'datetime',
|
|
38
|
+
'System.TimeSpan': 'timespan',
|
|
39
|
+
'System.Guid': 'guid',
|
|
40
|
+
'System.Boolean': 'bool',
|
|
41
|
+
'Newtonsoft.Json.Linq.JArray': 'dynamic',
|
|
42
|
+
'Newtonsoft.Json.Linq.JObject': 'dynamic',
|
|
43
|
+
'Newtonsoft.Json.Linq.JToken': 'dynamic',
|
|
44
|
+
'System.Object': 'dynamic',
|
|
45
|
+
'System.Data.SqlTypes.SqlDecimal': 'decimal'
|
|
46
|
+
};
|
|
47
|
+
var getCslTypeNameFromClrType = function getCslTypeNameFromClrType(clrType) {
|
|
48
|
+
return dotnetTypeToKustoType[clrType] || clrType;
|
|
49
|
+
};
|
|
50
|
+
var kustoTypeToEntityDataType = {
|
|
51
|
+
object: 'Object',
|
|
52
|
+
bool: 'Boolean',
|
|
53
|
+
uint8: 'Byte',
|
|
54
|
+
int16: 'Int16',
|
|
55
|
+
uint16: 'UInt16',
|
|
56
|
+
int: 'Int32',
|
|
57
|
+
uint: 'UInt32',
|
|
58
|
+
long: 'Int64',
|
|
59
|
+
ulong: 'UInt64',
|
|
60
|
+
float: 'Single',
|
|
61
|
+
real: 'Double',
|
|
62
|
+
decimal: 'Decimal',
|
|
63
|
+
datetime: 'DateTime',
|
|
64
|
+
string: 'String',
|
|
65
|
+
dynamic: 'Dynamic',
|
|
66
|
+
timespan: 'TimeSpan'
|
|
67
|
+
};
|
|
68
|
+
var getEntityDataTypeFromCslType = function getEntityDataTypeFromCslType(cslType) {
|
|
69
|
+
return kustoTypeToEntityDataType[cslType] || cslType;
|
|
70
|
+
};
|
|
71
|
+
var getCallName = function getCallName(fn) {
|
|
72
|
+
return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) {
|
|
73
|
+
return "{".concat(p.name, "}");
|
|
74
|
+
}).join(','), ")");
|
|
75
|
+
};
|
|
76
|
+
var getExpression = function getExpression(fn) {
|
|
77
|
+
return "let ".concat(fn.name, " = ").concat(getInputParametersAsCslString(fn.inputParameters), " ").concat(fn.body);
|
|
78
|
+
};
|
|
79
|
+
var getInputParametersAsCslString = function getInputParametersAsCslString(inputParameters) {
|
|
80
|
+
return "(".concat(inputParameters.map(function (inputParameter) {
|
|
81
|
+
return getInputParameterAsCslString(inputParameter);
|
|
82
|
+
}).join(','), ")");
|
|
83
|
+
};
|
|
84
|
+
var getInputParameterAsCslString = function getInputParameterAsCslString(inputParameter) {
|
|
85
|
+
// If this is a tabular parameter
|
|
86
|
+
if (inputParameter.columns && inputParameter.columns.length > 0) {
|
|
87
|
+
var attributesAsString = inputParameter.columns.map(function (col) {
|
|
88
|
+
return "".concat(col.name, ":").concat(col.cslType || getCslTypeNameFromClrType(col.type));
|
|
89
|
+
}).join(',');
|
|
90
|
+
return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
|
|
91
|
+
} else {
|
|
92
|
+
return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* This is the schema of the output of kusto command
|
|
98
|
+
* .show schema as json
|
|
99
|
+
*/
|
|
100
|
+
exports.showSchema = void 0;
|
|
101
|
+
(function (_showSchema) {})(exports.showSchema || (exports.showSchema = {}));
|
|
102
|
+
|
|
103
|
+
exports.getCallName = getCallName;
|
|
104
|
+
exports.getCslTypeNameFromClrType = getCslTypeNameFromClrType;
|
|
105
|
+
exports.getEntityDataTypeFromCslType = getEntityDataTypeFromCslType;
|
|
106
|
+
exports.getExpression = getExpression;
|
|
107
|
+
exports.getInputParametersAsCslString = getInputParametersAsCslString;
|
|
108
|
+
|
|
109
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
export declare function getCurrentCommandRange(editor: monaco.editor.ICodeEditor, cursorPosition: monaco.Position): monaco.Range;
|
|
3
3
|
/**
|
|
4
4
|
* Extending ICode editor to contain additional kusto-specific methods.
|
|
5
5
|
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -8,76 +8,12 @@
|
|
|
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-cdbe085f.js';
|
|
11
12
|
import '@kusto/language-service/bridge.min';
|
|
12
13
|
import '@kusto/language-service/Kusto.JavaScript.Client.min';
|
|
13
14
|
import '@kusto/language-service/newtonsoft.json.min';
|
|
14
15
|
import '@kusto/language-service-next/Kusto.Language.Bridge.min';
|
|
15
16
|
|
|
16
|
-
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
17
|
-
|
|
18
|
-
// an input parameter either be a scalar in which case it has a name, type and cslType, or it can be columnar, in which case
|
|
19
|
-
// it will have a name, and a list of scalar types which are the column types.
|
|
20
|
-
/**
|
|
21
|
-
* Schema types:
|
|
22
|
-
* Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
|
|
23
|
-
* Cluster Manager – Internal only. A schema for clusters that manages other clusters.
|
|
24
|
-
* Data Management – Internal only. A schema for ingestion point operations.
|
|
25
|
-
*/
|
|
26
|
-
const dotnetTypeToKustoType = {
|
|
27
|
-
'System.SByte': 'bool',
|
|
28
|
-
'System.Byte': 'uint8',
|
|
29
|
-
'System.Int16': 'int16',
|
|
30
|
-
'System.UInt16': 'uint16',
|
|
31
|
-
'System.Int32': 'int',
|
|
32
|
-
'System.UInt32': 'uint',
|
|
33
|
-
'System.Int64': 'long',
|
|
34
|
-
'System.UInt64': 'ulong',
|
|
35
|
-
'System.String': 'string',
|
|
36
|
-
'System.Single': 'float',
|
|
37
|
-
'System.Double': 'real',
|
|
38
|
-
'System.DateTime': 'datetime',
|
|
39
|
-
'System.TimeSpan': 'timespan',
|
|
40
|
-
'System.Guid': 'guid',
|
|
41
|
-
'System.Boolean': 'bool',
|
|
42
|
-
'Newtonsoft.Json.Linq.JArray': 'dynamic',
|
|
43
|
-
'Newtonsoft.Json.Linq.JObject': 'dynamic',
|
|
44
|
-
'Newtonsoft.Json.Linq.JToken': 'dynamic',
|
|
45
|
-
'System.Object': 'dynamic',
|
|
46
|
-
'System.Data.SqlTypes.SqlDecimal': 'decimal'
|
|
47
|
-
};
|
|
48
|
-
const getCslTypeNameFromClrType = clrType => dotnetTypeToKustoType[clrType] || clrType;
|
|
49
|
-
const kustoTypeToEntityDataType = {
|
|
50
|
-
object: 'Object',
|
|
51
|
-
bool: 'Boolean',
|
|
52
|
-
uint8: 'Byte',
|
|
53
|
-
int16: 'Int16',
|
|
54
|
-
uint16: 'UInt16',
|
|
55
|
-
int: 'Int32',
|
|
56
|
-
uint: 'UInt32',
|
|
57
|
-
long: 'Int64',
|
|
58
|
-
ulong: 'UInt64',
|
|
59
|
-
float: 'Single',
|
|
60
|
-
real: 'Double',
|
|
61
|
-
decimal: 'Decimal',
|
|
62
|
-
datetime: 'DateTime',
|
|
63
|
-
string: 'String',
|
|
64
|
-
dynamic: 'Dynamic',
|
|
65
|
-
timespan: 'TimeSpan'
|
|
66
|
-
};
|
|
67
|
-
const getEntityDataTypeFromCslType = cslType => kustoTypeToEntityDataType[cslType] || cslType;
|
|
68
|
-
const getCallName = fn => `${fn.name}(${fn.inputParameters.map(p => `{${p.name}}`).join(',')})`;
|
|
69
|
-
const getExpression = fn => `let ${fn.name} = ${getInputParametersAsCslString(fn.inputParameters)} ${fn.body}`;
|
|
70
|
-
const getInputParametersAsCslString = inputParameters => `(${inputParameters.map(inputParameter => getInputParameterAsCslString(inputParameter)).join(',')})`;
|
|
71
|
-
const getInputParameterAsCslString = inputParameter => {
|
|
72
|
-
// If this is a tabular parameter
|
|
73
|
-
if (inputParameter.columns && inputParameter.columns.length > 0) {
|
|
74
|
-
const attributesAsString = inputParameter.columns.map(col => `${col.name}:${col.cslType || getCslTypeNameFromClrType(col.type)}`).join(',');
|
|
75
|
-
return `${inputParameter.name}:${attributesAsString === '' ? '*' : attributesAsString}`;
|
|
76
|
-
} else {
|
|
77
|
-
return `${inputParameter.name}:${inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type)}`;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
17
|
var k = Kusto.Data.IntelliSense;
|
|
82
18
|
var parsing = Kusto.Language.Parsing;
|
|
83
19
|
var k2 = Kusto.Language.Editor;
|
|
@@ -604,7 +540,7 @@ class KustoLanguageService {
|
|
|
604
540
|
const warningAndSuggestionDiagnostics = block.Service.GetAnalyzerDiagnostics(true);
|
|
605
541
|
const filterredDiagnostics = this.toArray(warningAndSuggestionDiagnostics).filter(d => {
|
|
606
542
|
const allowSeverity = enableWarnings && d.Severity === 'Warning' || enableSuggestions && d.Severity === 'Suggestion';
|
|
607
|
-
const allowCode = !this._languageSettings.
|
|
543
|
+
const allowCode = !this._languageSettings.disabledDiagnosticCodes?.includes(d.Code);
|
|
608
544
|
return allowSeverity && allowCode;
|
|
609
545
|
});
|
|
610
546
|
diagnostics = diagnostics.concat(filterredDiagnostics);
|
|
@@ -1975,7 +1911,13 @@ function getKustoLanguageService() {
|
|
|
1975
1911
|
return languageService;
|
|
1976
1912
|
}
|
|
1977
1913
|
|
|
1978
|
-
|
|
1914
|
+
/**
|
|
1915
|
+
* We're using this interface to send messages to a worker, so using
|
|
1916
|
+
* `InterfaceFor` to make it not nominal is more accurate. {@link KustoWorker}
|
|
1917
|
+
* is the public, more limited version of this interface.
|
|
1918
|
+
*/
|
|
1919
|
+
|
|
1920
|
+
class KustoWorkerImpl {
|
|
1979
1921
|
// --- model sync -----------------------
|
|
1980
1922
|
|
|
1981
1923
|
constructor(ctx, createData) {
|
|
@@ -2235,6 +2177,6 @@ class KustoWorker {
|
|
|
2235
2177
|
self.onmessage = () => {
|
|
2236
2178
|
// ignore the first message
|
|
2237
2179
|
worker.initialize((ctx, createData) => {
|
|
2238
|
-
return new
|
|
2180
|
+
return new KustoWorkerImpl(ctx, createData);
|
|
2239
2181
|
});
|
|
2240
2182
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
|
|
1
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
import type { KustoWorker, LanguageServiceDefaults } from './monaco.contribution';
|
|
3
|
+
import type { IKustoWorkerImpl } from './kustoWorker';
|
|
4
|
+
export interface AugmentedWorker extends KustoWorker, Omit<IKustoWorkerImpl, 'setSchemaFromShowSchema'> {
|
|
5
|
+
}
|
|
6
|
+
export interface AugmentedWorkerAccessor {
|
|
7
|
+
(first: monaco.Uri, ...more: monaco.Uri[]): Promise<AugmentedWorker>;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Called when Kusto language is first needed (a model has the language set)
|
|
7
11
|
* @param defaults
|
|
8
12
|
*/
|
|
9
|
-
export declare function setupMode(defaults:
|
|
10
|
-
export declare function getKustoWorker(): Promise<
|
|
13
|
+
export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): AugmentedWorkerAccessor;
|
|
14
|
+
export declare function getKustoWorker(): Promise<AugmentedWorkerAccessor>;
|
package/release/esm/kustoMode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -862,12 +862,14 @@ class CompletionAdapter {
|
|
|
862
862
|
insertText: entry.insertText,
|
|
863
863
|
sortText: entry.sortText,
|
|
864
864
|
filterText: entry.filterText,
|
|
865
|
+
// TODO: Is this cast safe?
|
|
865
866
|
documentation: formatDocLink(entry.documentation?.value),
|
|
866
867
|
detail: entry.detail,
|
|
867
868
|
range: wordRange,
|
|
868
869
|
kind: toCompletionItemKind(entry.kind)
|
|
869
870
|
};
|
|
870
871
|
if (entry.textEdit) {
|
|
872
|
+
// TODO: Where is the "range" property coming from?
|
|
871
873
|
item.range = toRange(entry.textEdit.range);
|
|
872
874
|
item.insertText = entry.textEdit.newText;
|
|
873
875
|
}
|
|
@@ -1083,9 +1085,9 @@ function setupMode(defaults, monacoInstance) {
|
|
|
1083
1085
|
const client = new WorkerManager(monacoInstance, defaults);
|
|
1084
1086
|
disposables.push(client);
|
|
1085
1087
|
const workerAccessor = (first, ...more) => {
|
|
1086
|
-
const augmentedSetSchema = (schema, worker
|
|
1088
|
+
const augmentedSetSchema = async (schema, worker) => {
|
|
1087
1089
|
const workerPromise = worker.setSchema(schema);
|
|
1088
|
-
workerPromise.then(() => {
|
|
1090
|
+
await workerPromise.then(() => {
|
|
1089
1091
|
onSchemaChange.fire(schema);
|
|
1090
1092
|
});
|
|
1091
1093
|
};
|
|
@@ -1093,12 +1095,17 @@ function setupMode(defaults, monacoInstance) {
|
|
|
1093
1095
|
return worker.then(worker => ({
|
|
1094
1096
|
...worker,
|
|
1095
1097
|
setSchema: schema => augmentedSetSchema(schema, worker),
|
|
1096
|
-
setSchemaFromShowSchema
|
|
1097
|
-
worker.normalizeSchema(schema, connection, database).then(schema =>
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1098
|
+
async setSchemaFromShowSchema(schema, connection, database, globalScalarParameters, globalTabularParameters) {
|
|
1099
|
+
await worker.normalizeSchema(schema, connection, database).then(schema => {
|
|
1100
|
+
if (globalScalarParameters || globalTabularParameters) {
|
|
1101
|
+
schema = {
|
|
1102
|
+
...schema,
|
|
1103
|
+
globalScalarParameters,
|
|
1104
|
+
globalTabularParameters
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
augmentedSetSchema(schema, worker);
|
|
1108
|
+
});
|
|
1102
1109
|
}
|
|
1103
1110
|
}));
|
|
1104
1111
|
};
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
/// <reference types="monaco-editor/monaco" />
|
|
2
1
|
import * as ls from 'vscode-languageserver-types';
|
|
2
|
+
import type { worker } from 'monaco-editor/esm/vs/editor/editor.worker';
|
|
3
|
+
import type { IRange } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
3
4
|
import * as kustoService from './languageService/kustoLanguageService';
|
|
4
5
|
import type { LanguageSettings } from './languageService/settings';
|
|
5
6
|
import { Schema, showSchema, ScalarParameter, Database, TabularParameter } from './languageService/schema';
|
|
6
7
|
import type { ColorizationRange } from './languageService/kustoLanguageService';
|
|
7
8
|
import type { RenderInfo } from './languageService/renderInfo';
|
|
8
|
-
|
|
9
|
+
import type { ClusterReference, DatabaseReference } from './types';
|
|
10
|
+
export type InterfaceFor<C> = {
|
|
11
|
+
[Member in keyof C]: C[Member];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* We're using this interface to send messages to a worker, so using
|
|
15
|
+
* `InterfaceFor` to make it not nominal is more accurate. {@link KustoWorker}
|
|
16
|
+
* is the public, more limited version of this interface.
|
|
17
|
+
*/
|
|
18
|
+
export type IKustoWorkerImpl = InterfaceFor<KustoWorkerImpl>;
|
|
19
|
+
export declare class KustoWorkerImpl {
|
|
9
20
|
private _ctx;
|
|
10
21
|
private _languageService;
|
|
11
22
|
private _languageId;
|
|
12
23
|
private _languageSettings;
|
|
13
|
-
constructor(ctx:
|
|
24
|
+
constructor(ctx: worker.IWorkerContext, createData: ICreateData);
|
|
14
25
|
setSchema(schema: Schema): Promise<void>;
|
|
15
|
-
addClusterToSchema(uri: string, clusterName: string, databasesNames: string[]): Promise<void>;
|
|
26
|
+
addClusterToSchema(uri: string, clusterName: string, databasesNames: readonly string[]): Promise<void>;
|
|
16
27
|
addDatabaseToSchema(uri: string, clusterName: string, databaseSchema: Database): Promise<void>;
|
|
17
28
|
setSchemaFromShowSchema(schema: any, clusterConnectionString: string, databaseInContextName: string): Promise<void>;
|
|
18
29
|
normalizeSchema(schema: showSchema.Result, clusterConnectionString: string, databaseInContextName: string): Promise<import("./languageService/schema").EngineSchema>;
|
|
@@ -44,7 +55,7 @@ export declare class KustoWorker {
|
|
|
44
55
|
*/
|
|
45
56
|
getCommandAndLocationInContext(uri: string, cursorOffset: number): Promise<{
|
|
46
57
|
text: string;
|
|
47
|
-
range:
|
|
58
|
+
range: IRange;
|
|
48
59
|
} | null>;
|
|
49
60
|
getCommandsInDocument(uri: string): Promise<{
|
|
50
61
|
absoluteStart: number;
|
|
@@ -78,12 +89,15 @@ export declare class KustoWorker {
|
|
|
78
89
|
doRename(uri: string, position: ls.Position, newName: string): Promise<ls.WorkspaceEdit>;
|
|
79
90
|
doHover(uri: string, position: ls.Position): Promise<ls.Hover>;
|
|
80
91
|
setParameters(scalarParameters: readonly ScalarParameter[], tabularParameters: readonly TabularParameter[]): Promise<void>;
|
|
81
|
-
getClusterReferences(uri: string, cursorOffset: number): Promise<
|
|
82
|
-
getDatabaseReferences(uri: string, cursorOffset: number): Promise<
|
|
92
|
+
getClusterReferences(uri: string, cursorOffset: number): Promise<ClusterReference[]>;
|
|
93
|
+
getDatabaseReferences(uri: string, cursorOffset: number): Promise<DatabaseReference[]>;
|
|
83
94
|
private _getTextDocument;
|
|
84
95
|
}
|
|
85
96
|
export interface ICreateData {
|
|
86
97
|
languageId: string;
|
|
87
98
|
languageSettings: LanguageSettings;
|
|
88
99
|
}
|
|
89
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Used when monaco-editor is resolved via amd modules
|
|
102
|
+
*/
|
|
103
|
+
export declare function create(ctx: worker.IWorkerContext, createData: ICreateData): IKustoWorkerImpl;
|