@kusto/monaco-kusto 5.3.9 → 5.3.11
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 +7 -12
- package/release/dev/kustoMode.js +88 -34
- package/release/dev/kustoWorker.js +86 -58
- package/release/dev/monaco.contribution.js +9 -8
- package/release/esm/extendedEditor.js +3 -3
- package/release/esm/kustoMode.js +6 -3
- package/release/esm/kustoWorker.js +11 -11
- package/release/esm/languageFeatures.js +10 -10
- package/release/esm/languageService/kustoLanguageService.js +53 -33
- package/release/esm/languageService/kustoMonarchLanguageDefinition.js +72 -21
- package/release/esm/languageService/schema.js +8 -8
- package/release/esm/monaco.contribution.d.ts +1 -0
- package/release/esm/monaco.contribution.js +5 -4
- package/release/esm/monaco.d.ts +29 -14
- package/release/min/kustoMode.js +2 -11
- package/release/min/kustoWorker.js +2 -55
- package/release/min/monaco.contribution.d.ts +1 -0
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/monaco.d.ts +29 -14
- package/scripts/bundle.js +55 -48
- package/scripts/release.js +13 -20
- package/tsconfig.esm.json +18 -0
- package/tsconfig.json +20 -0
- package/tsconfig.watch.json +8 -0
|
@@ -23,9 +23,10 @@ define('vs/language/kusto/languageService/schema',["require", "exports"], functi
|
|
|
23
23
|
'Newtonsoft.Json.Linq.JObject': 'dynamic',
|
|
24
24
|
'Newtonsoft.Json.Linq.JToken': 'dynamic',
|
|
25
25
|
'System.Object': 'dynamic',
|
|
26
|
-
'System.Data.SqlTypes.SqlDecimal': 'decimal'
|
|
26
|
+
'System.Data.SqlTypes.SqlDecimal': 'decimal',
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
var getCslTypeNameFromClrType = function (clrType) { return dotnetTypeToKustoType[clrType] || clrType; };
|
|
29
|
+
exports.getCslTypeNameFromClrType = getCslTypeNameFromClrType;
|
|
29
30
|
var kustoTypeToEntityDataType = {
|
|
30
31
|
object: 'Object',
|
|
31
32
|
bool: 'Boolean',
|
|
@@ -42,28 +43,32 @@ define('vs/language/kusto/languageService/schema',["require", "exports"], functi
|
|
|
42
43
|
datetime: 'DateTime',
|
|
43
44
|
string: 'String',
|
|
44
45
|
dynamic: 'Dynamic',
|
|
45
|
-
timespan: 'TimeSpan'
|
|
46
|
+
timespan: 'TimeSpan',
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
-
exports.
|
|
49
|
-
|
|
48
|
+
var getEntityDataTypeFromCslType = function (cslType) { return kustoTypeToEntityDataType[cslType] || cslType; };
|
|
49
|
+
exports.getEntityDataTypeFromCslType = getEntityDataTypeFromCslType;
|
|
50
|
+
var getCallName = function (fn) {
|
|
51
|
+
return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) { return "{".concat(p.name, "}"); }).join(','), ")");
|
|
50
52
|
};
|
|
51
|
-
exports.
|
|
52
|
-
|
|
53
|
+
exports.getCallName = getCallName;
|
|
54
|
+
var getExpression = function (fn) {
|
|
55
|
+
return "let ".concat(fn.name, " = ").concat((0, exports.getInputParametersAsCslString)(fn.inputParameters), " ").concat(fn.body);
|
|
53
56
|
};
|
|
54
|
-
exports.
|
|
55
|
-
|
|
57
|
+
exports.getExpression = getExpression;
|
|
58
|
+
var getInputParametersAsCslString = function (inputParameters) {
|
|
59
|
+
return "(".concat(inputParameters.map(function (inputParameter) { return getInputParameterAsCslString(inputParameter); }).join(','), ")");
|
|
56
60
|
};
|
|
61
|
+
exports.getInputParametersAsCslString = getInputParametersAsCslString;
|
|
57
62
|
var getInputParameterAsCslString = function (inputParameter) {
|
|
58
63
|
// If this is a tabular parameter
|
|
59
64
|
if (inputParameter.columns && inputParameter.columns.length > 0) {
|
|
60
65
|
var attributesAsString = inputParameter.columns
|
|
61
|
-
.map(function (col) { return col.name
|
|
66
|
+
.map(function (col) { return "".concat(col.name, ":").concat(col.cslType || (0, exports.getCslTypeNameFromClrType)(col.type)); })
|
|
62
67
|
.join(',');
|
|
63
|
-
return inputParameter.name
|
|
68
|
+
return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
|
|
64
69
|
}
|
|
65
70
|
else {
|
|
66
|
-
return inputParameter.name
|
|
71
|
+
return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || (0, exports.getCslTypeNameFromClrType)(inputParameter.type));
|
|
67
72
|
}
|
|
68
73
|
};
|
|
69
74
|
});
|
|
@@ -6656,6 +6661,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
6656
6661
|
};
|
|
6657
6662
|
return __assign.apply(this, arguments);
|
|
6658
6663
|
};
|
|
6664
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
6665
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
6666
|
+
if (ar || !(i in from)) {
|
|
6667
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6668
|
+
ar[i] = from[i];
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
6672
|
+
};
|
|
6659
6673
|
define('vs/language/kusto/languageService/kustoLanguageService',["require", "exports", "./schema", "vscode-languageserver-types", "xregexp", "./schema"], function (require, exports, s, ls, XRegExp, schema_1) {
|
|
6660
6674
|
"use strict";
|
|
6661
6675
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6761,7 +6775,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
6761
6775
|
/**
|
|
6762
6776
|
* Taken from:
|
|
6763
6777
|
* https://msazure.visualstudio.com/One/_git/Azure-Kusto-Service?path=/Src/Tools/Kusto.Explorer.Control/QueryEditors/KustoScriptEditor/KustoScriptEditorControl2.xaml.cs&version=GBdev&line=2075&lineEnd=2075&lineStartColumn=9&lineEndColumn=77&lineStyle=plain&_a=contents
|
|
6764
|
-
|
|
6778
|
+
*/
|
|
6765
6779
|
this._toOptionKind = (_a = {},
|
|
6766
6780
|
_a[k2.CompletionKind.AggregateFunction] = k.OptionKind.FunctionAggregation,
|
|
6767
6781
|
_a[k2.CompletionKind.BuiltInFunction] = k.OptionKind.FunctionScalar,
|
|
@@ -6908,7 +6922,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
6908
6922
|
this._newlineAppendPipePolicy.Text = '\n| ';
|
|
6909
6923
|
}
|
|
6910
6924
|
KustoLanguageService.prototype.createDatabaseUniqueName = function (clusterName, databaseName) {
|
|
6911
|
-
return clusterName
|
|
6925
|
+
return "".concat(clusterName, "_").concat(databaseName);
|
|
6912
6926
|
};
|
|
6913
6927
|
Object.defineProperty(KustoLanguageService.prototype, "_kustoJsSchemaV2", {
|
|
6914
6928
|
/**
|
|
@@ -6955,20 +6969,20 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
6955
6969
|
*/
|
|
6956
6970
|
KustoLanguageService.prototype.debugGlobalState = function (globals) {
|
|
6957
6971
|
// iterate over clusters
|
|
6958
|
-
console.log("globals.Clusters.Count: "
|
|
6972
|
+
console.log("globals.Clusters.Count: ".concat(globals.Clusters.Count));
|
|
6959
6973
|
for (var i = 0; i < globals.Clusters.Count; i++) {
|
|
6960
6974
|
var cluster = globals.Clusters.getItem(i);
|
|
6961
|
-
console.log("cluster: "
|
|
6975
|
+
console.log("cluster: ".concat(cluster.Name));
|
|
6962
6976
|
// iterate over databases
|
|
6963
|
-
console.log("cluster.Databases.Count: "
|
|
6977
|
+
console.log("cluster.Databases.Count: ".concat(cluster.Databases.Count));
|
|
6964
6978
|
for (var i2 = 0; i2 < cluster.Databases.Count; i2++) {
|
|
6965
6979
|
var database = cluster.Databases.getItem(i2);
|
|
6966
|
-
console.log("cluster.database: ["
|
|
6980
|
+
console.log("cluster.database: [".concat(cluster.Name, "].[").concat(database.Name, "]"));
|
|
6967
6981
|
// iterate over tables
|
|
6968
|
-
console.log("cluster.Databases.Tables.Count: "
|
|
6982
|
+
console.log("cluster.Databases.Tables.Count: ".concat(database.Tables.Count));
|
|
6969
6983
|
for (var i3 = 0; i3 < database.Tables.Count; i3++) {
|
|
6970
6984
|
var table = database.Tables.getItem(i3);
|
|
6971
|
-
console.log("cluster.database.table: ["
|
|
6985
|
+
console.log("cluster.database.table: [".concat(cluster.Name, "].[").concat(database.Name, "].[").concat(table.Name, "]"));
|
|
6972
6986
|
}
|
|
6973
6987
|
}
|
|
6974
6988
|
}
|
|
@@ -6977,7 +6991,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
6977
6991
|
* Prepending the doc of the actual topic at the top
|
|
6978
6992
|
*/
|
|
6979
6993
|
KustoLanguageService.prototype.formatHelpTopic = function (helpTopic) {
|
|
6980
|
-
return "**"
|
|
6994
|
+
return "**".concat(helpTopic.Name, " [(view online)](").concat(helpTopic.Url, ")**\n\n").concat(helpTopic.LongDescription);
|
|
6981
6995
|
};
|
|
6982
6996
|
KustoLanguageService.prototype.doCompleteV2 = function (document, position) {
|
|
6983
6997
|
var _this = this;
|
|
@@ -7019,7 +7033,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
7019
7033
|
? {
|
|
7020
7034
|
// Need to escape dollar sign since it is used as a placeholder in snippet.
|
|
7021
7035
|
// Usually dollar sign is not a valid character in a function name, but grafana uses macros that start with dollars.
|
|
7022
|
-
textToInsert: kItem.EditText.replace('$', '\\$')
|
|
7036
|
+
textToInsert: "".concat(kItem.EditText.replace('$', '\\$'), "$0").concat(kItem.AfterText),
|
|
7023
7037
|
format: ls.InsertTextFormat.Snippet,
|
|
7024
7038
|
}
|
|
7025
7039
|
: {
|
|
@@ -7429,7 +7443,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
7429
7443
|
this._script = undefined;
|
|
7430
7444
|
this._parsePropertiesV2 = undefined;
|
|
7431
7445
|
}
|
|
7432
|
-
// since V2 doesn't support control commands, we're initializing V1 intellisense for both cases and we'll going to use V1 intellisense for
|
|
7446
|
+
// since V2 doesn't support control commands, we're initializing V1 intellisense for both cases and we'll going to use V1 intellisense for control commands.
|
|
7433
7447
|
return new Promise(function (resolve, reject) {
|
|
7434
7448
|
var kustoJsSchema = schema ? KustoLanguageService.convertToKustoJsSchema(schema) : undefined;
|
|
7435
7449
|
_this._kustoJsSchema = kustoJsSchema;
|
|
@@ -7437,13 +7451,17 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
7437
7451
|
resolve(undefined);
|
|
7438
7452
|
});
|
|
7439
7453
|
};
|
|
7440
|
-
KustoLanguageService.prototype.setParameters = function (
|
|
7454
|
+
KustoLanguageService.prototype.setParameters = function (scalarParameters, tabularParameters) {
|
|
7441
7455
|
if (!this._languageSettings.useIntellisenseV2 || this._schema.clusterType !== 'Engine') {
|
|
7442
7456
|
throw new Error('setParameters requires intellisense V2 and Engine cluster');
|
|
7443
7457
|
}
|
|
7444
|
-
this._schema.
|
|
7445
|
-
|
|
7446
|
-
|
|
7458
|
+
this._schema.globalScalarParameters = scalarParameters;
|
|
7459
|
+
this._schema.globalTabularParameters = tabularParameters;
|
|
7460
|
+
var scalarSymbols = scalarParameters.map(function (param) { return KustoLanguageService.createParameterSymbol(param); });
|
|
7461
|
+
var tabularSymbols = tabularParameters.map(function (param) {
|
|
7462
|
+
return KustoLanguageService.createTabularParameterSymbol(param);
|
|
7463
|
+
});
|
|
7464
|
+
this._kustoJsSchemaV2 = this._kustoJsSchemaV2.WithParameters(KustoLanguageService.toBridgeList(__spreadArray(__spreadArray([], scalarSymbols, true), tabularSymbols, true)));
|
|
7447
7465
|
return Promise.resolve(undefined);
|
|
7448
7466
|
};
|
|
7449
7467
|
/**
|
|
@@ -7452,10 +7470,10 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
7452
7470
|
* @param clusterConnectionString cluster connection string
|
|
7453
7471
|
* @param databaseInContextName name of database in context
|
|
7454
7472
|
*/
|
|
7455
|
-
KustoLanguageService.prototype.setSchemaFromShowSchema = function (schema, clusterConnectionString, databaseInContextName,
|
|
7473
|
+
KustoLanguageService.prototype.setSchemaFromShowSchema = function (schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters) {
|
|
7456
7474
|
var _this = this;
|
|
7457
7475
|
return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName).then(function (normalized) {
|
|
7458
|
-
return _this.setSchema(__assign(__assign({}, normalized), {
|
|
7476
|
+
return _this.setSchema(__assign(__assign({}, normalized), { globalScalarParameters: globalScalarParameters, globalTabularParameters: globalTabularParameters }));
|
|
7459
7477
|
});
|
|
7460
7478
|
};
|
|
7461
7479
|
/**
|
|
@@ -8037,7 +8055,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8037
8055
|
table.columns.forEach(function (column) {
|
|
8038
8056
|
var kColumn = new k.KustoIntelliSenseColumnEntity();
|
|
8039
8057
|
kColumn.Name = column.name;
|
|
8040
|
-
kColumn.TypeCode = k.EntityDataType[schema_1.getEntityDataTypeFromCslType(column.type)];
|
|
8058
|
+
kColumn.TypeCode = k.EntityDataType[(0, schema_1.getEntityDataTypeFromCslType)(column.type)];
|
|
8041
8059
|
cols.push(kColumn);
|
|
8042
8060
|
});
|
|
8043
8061
|
kTable.Columns = new Bridge.ArrayEnumerable(cols);
|
|
@@ -8090,8 +8108,8 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8090
8108
|
* @param params scalar parameters
|
|
8091
8109
|
*/
|
|
8092
8110
|
KustoLanguageService.scalarParametersToSignature = function (params) {
|
|
8093
|
-
var signatureWithoutParens = params.map(function (param) { return param.name
|
|
8094
|
-
return "("
|
|
8111
|
+
var signatureWithoutParens = params.map(function (param) { return "".concat(param.name, ": ").concat(param.cslType); }).join(', ');
|
|
8112
|
+
return "(".concat(signatureWithoutParens, ")");
|
|
8095
8113
|
};
|
|
8096
8114
|
/**
|
|
8097
8115
|
* Returns something like '(x: string, T: (y: int))'
|
|
@@ -8103,14 +8121,14 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8103
8121
|
.map(function (param) {
|
|
8104
8122
|
if (param.columns) {
|
|
8105
8123
|
var tableSignature = _this.scalarParametersToSignature(param.columns);
|
|
8106
|
-
return param.name
|
|
8124
|
+
return "".concat(param.name, ": ").concat(tableSignature);
|
|
8107
8125
|
}
|
|
8108
8126
|
else {
|
|
8109
|
-
return param.name
|
|
8127
|
+
return "".concat(param.name, ": ").concat(param.cslType);
|
|
8110
8128
|
}
|
|
8111
8129
|
})
|
|
8112
8130
|
.join(', ');
|
|
8113
|
-
return "("
|
|
8131
|
+
return "(".concat(signatureWithoutParens, ")");
|
|
8114
8132
|
};
|
|
8115
8133
|
/**
|
|
8116
8134
|
* converts a function definition to a let statement.
|
|
@@ -8118,18 +8136,23 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8118
8136
|
*/
|
|
8119
8137
|
KustoLanguageService.toLetStatement = function (fn) {
|
|
8120
8138
|
var signature = this.inputParameterToSignature(fn.inputParameters);
|
|
8121
|
-
return "let "
|
|
8139
|
+
return "let ".concat(fn.name, " = ").concat(signature, " ").concat(fn.body);
|
|
8122
8140
|
};
|
|
8123
8141
|
KustoLanguageService.createColumnSymbol = function (col) {
|
|
8124
|
-
return new sym.ColumnSymbol(col.name, sym.ScalarTypes.GetSymbol(schema_1.getCslTypeNameFromClrType(col.type)), col.docstring, null, null, col.examples ? KustoLanguageService.toBridgeList(col.examples) : null);
|
|
8142
|
+
return new sym.ColumnSymbol(col.name, sym.ScalarTypes.GetSymbol((0, schema_1.getCslTypeNameFromClrType)(col.type)), col.docstring, null, null, col.examples ? KustoLanguageService.toBridgeList(col.examples) : null);
|
|
8125
8143
|
};
|
|
8126
8144
|
KustoLanguageService.createParameterSymbol = function (param) {
|
|
8127
|
-
var paramSymbol = Kusto.Language.Symbols.ScalarTypes.GetSymbol(schema_1.getCslTypeNameFromClrType(param.type));
|
|
8145
|
+
var paramSymbol = Kusto.Language.Symbols.ScalarTypes.GetSymbol((0, schema_1.getCslTypeNameFromClrType)(param.type));
|
|
8128
8146
|
return new sym.ParameterSymbol(param.name, paramSymbol, null);
|
|
8129
8147
|
};
|
|
8148
|
+
KustoLanguageService.createTabularParameterSymbol = function (param) {
|
|
8149
|
+
var columnSymbols = param.columns.map(function (col) { return KustoLanguageService.createColumnSymbol(col); });
|
|
8150
|
+
var para = new Kusto.Language.Symbols.TableSymbol.$ctor4(param.name, columnSymbols);
|
|
8151
|
+
return new sym.ParameterSymbol(param.name, para, param.docstring);
|
|
8152
|
+
};
|
|
8130
8153
|
KustoLanguageService.createParameter = function (param) {
|
|
8131
8154
|
if (!param.columns) {
|
|
8132
|
-
var paramSymbol = Kusto.Language.Symbols.ScalarTypes.GetSymbol(schema_1.getCslTypeNameFromClrType(param.type));
|
|
8155
|
+
var paramSymbol = Kusto.Language.Symbols.ScalarTypes.GetSymbol((0, schema_1.getCslTypeNameFromClrType)(param.type));
|
|
8133
8156
|
var expression = param.cslDefaultValue && typeof param.cslDefaultValue === 'string'
|
|
8134
8157
|
? parsing.QueryParser.ParseLiteral$1(param.cslDefaultValue)
|
|
8135
8158
|
: undefined;
|
|
@@ -8176,6 +8199,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8176
8199
|
return databaseSymbol;
|
|
8177
8200
|
};
|
|
8178
8201
|
KustoLanguageService.prototype.convertToKustoJsSchemaV2 = function (schema) {
|
|
8202
|
+
var _a, _b;
|
|
8179
8203
|
var cached = this._schemaCache[schema.cluster.connectionString];
|
|
8180
8204
|
// create a cache entry for the cluster if non yet exists.
|
|
8181
8205
|
if (!cached) {
|
|
@@ -8219,12 +8243,16 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8219
8243
|
if (databaseInContext) {
|
|
8220
8244
|
globalState = globalState.WithDatabase(databaseInContext);
|
|
8221
8245
|
}
|
|
8222
|
-
// Inject global parameters to global scope.
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8246
|
+
// Inject global scalar parameters to global scope.
|
|
8247
|
+
var scalarParameters = ((_a = schema.globalScalarParameters) !== null && _a !== void 0 ? _a : []).map(function (param) {
|
|
8248
|
+
return KustoLanguageService.createParameterSymbol(param);
|
|
8249
|
+
});
|
|
8250
|
+
// Inject global tabular parameters to global scope.
|
|
8251
|
+
var tabularParameters = ((_b = schema.globalTabularParameters) !== null && _b !== void 0 ? _b : []).map(function (param) {
|
|
8252
|
+
return KustoLanguageService.createTabularParameterSymbol(param);
|
|
8253
|
+
});
|
|
8254
|
+
if (tabularParameters.length || scalarParameters.length) {
|
|
8255
|
+
globalState = globalState.WithParameters(KustoLanguageService.toBridgeList(__spreadArray(__spreadArray([], scalarParameters, true), tabularParameters, true)));
|
|
8228
8256
|
}
|
|
8229
8257
|
return globalState;
|
|
8230
8258
|
};
|
|
@@ -8261,7 +8289,7 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8261
8289
|
*/
|
|
8262
8290
|
KustoLanguageService.prototype.getSortText = function (order) {
|
|
8263
8291
|
if (order <= 0) {
|
|
8264
|
-
throw new RangeError("order should be a number >= 1. instead got "
|
|
8292
|
+
throw new RangeError("order should be a number >= 1. instead got ".concat(order));
|
|
8265
8293
|
}
|
|
8266
8294
|
var sortText = '';
|
|
8267
8295
|
var numCharacters = 26; // "z" - "a" + 1;
|
|
@@ -8466,7 +8494,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8466
8494
|
KustoWorker.prototype.addClusterToSchema = function (uri, clusterName, databasesNames) {
|
|
8467
8495
|
var document = this._getTextDocument(uri);
|
|
8468
8496
|
if (!document) {
|
|
8469
|
-
console.error("addClusterToSchema: document is "
|
|
8497
|
+
console.error("addClusterToSchema: document is ".concat(document, ". uri is ").concat(uri));
|
|
8470
8498
|
return Promise.resolve();
|
|
8471
8499
|
}
|
|
8472
8500
|
return this._languageService.addClusterToSchema(document, clusterName, databasesNames);
|
|
@@ -8474,7 +8502,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8474
8502
|
KustoWorker.prototype.addDatabaseToSchema = function (uri, clusterName, databaseSchema) {
|
|
8475
8503
|
var document = this._getTextDocument(uri);
|
|
8476
8504
|
if (!document) {
|
|
8477
|
-
console.error("addDatabaseToSchema: document is "
|
|
8505
|
+
console.error("addDatabaseToSchema: document is ".concat(document, ". uri is ").concat(uri));
|
|
8478
8506
|
return Promise.resolve();
|
|
8479
8507
|
}
|
|
8480
8508
|
return this._languageService.addDatabaseToSchema(document, clusterName, databaseSchema);
|
|
@@ -8491,7 +8519,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8491
8519
|
KustoWorker.prototype.getCommandInContext = function (uri, cursorOffset) {
|
|
8492
8520
|
var document = this._getTextDocument(uri);
|
|
8493
8521
|
if (!document) {
|
|
8494
|
-
console.error("getCommandInContext: document is "
|
|
8522
|
+
console.error("getCommandInContext: document is ".concat(document, ". uri is ").concat(uri));
|
|
8495
8523
|
return null;
|
|
8496
8524
|
}
|
|
8497
8525
|
var commandInContext = this._languageService.getCommandInContext(document, cursorOffset);
|
|
@@ -8503,7 +8531,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8503
8531
|
KustoWorker.prototype.getQueryParams = function (uri, cursorOffset) {
|
|
8504
8532
|
var document = this._getTextDocument(uri);
|
|
8505
8533
|
if (!document) {
|
|
8506
|
-
console.error("getQueryParams: document is "
|
|
8534
|
+
console.error("getQueryParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
8507
8535
|
return null;
|
|
8508
8536
|
}
|
|
8509
8537
|
var queryParams = this._languageService.getQueryParams(document, cursorOffset);
|
|
@@ -8515,7 +8543,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8515
8543
|
KustoWorker.prototype.getGlobalParams = function (uri) {
|
|
8516
8544
|
var document = this._getTextDocument(uri);
|
|
8517
8545
|
if (!document) {
|
|
8518
|
-
console.error("getGLobalParams: document is "
|
|
8546
|
+
console.error("getGLobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
8519
8547
|
return null;
|
|
8520
8548
|
}
|
|
8521
8549
|
var globalParams = this._languageService.getGlobalParams(document);
|
|
@@ -8527,7 +8555,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8527
8555
|
KustoWorker.prototype.getReferencedGlobalParams = function (uri, cursorOffest) {
|
|
8528
8556
|
var document = this._getTextDocument(uri);
|
|
8529
8557
|
if (!document) {
|
|
8530
|
-
console.error("getReferencedGlobalParams: document is "
|
|
8558
|
+
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
8531
8559
|
return null;
|
|
8532
8560
|
}
|
|
8533
8561
|
var referencedParams = this._languageService.getReferencedGlobalParams(document, cursorOffest);
|
|
@@ -8539,7 +8567,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8539
8567
|
KustoWorker.prototype.getRenderInfo = function (uri, cursorOffset) {
|
|
8540
8568
|
var document = this._getTextDocument(uri);
|
|
8541
8569
|
if (!document) {
|
|
8542
|
-
console.error("getRenderInfo: document is "
|
|
8570
|
+
console.error("getRenderInfo: document is ".concat(document, ". uri is ").concat(uri));
|
|
8543
8571
|
}
|
|
8544
8572
|
return this._languageService.getRenderInfo(document, cursorOffset).then(function (result) {
|
|
8545
8573
|
if (!result) {
|
|
@@ -8557,7 +8585,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8557
8585
|
KustoWorker.prototype.getCommandAndLocationInContext = function (uri, cursorOffset) {
|
|
8558
8586
|
var document = this._getTextDocument(uri);
|
|
8559
8587
|
if (!document) {
|
|
8560
|
-
console.error("getCommandAndLocationInContext: document is "
|
|
8588
|
+
console.error("getCommandAndLocationInContext: document is ".concat(document, ". uri is ").concat(uri));
|
|
8561
8589
|
return Promise.resolve(null);
|
|
8562
8590
|
}
|
|
8563
8591
|
return this._languageService.getCommandAndLocationInContext(document, cursorOffset).then(function (result) {
|
|
@@ -8576,7 +8604,7 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8576
8604
|
KustoWorker.prototype.getCommandsInDocument = function (uri) {
|
|
8577
8605
|
var document = this._getTextDocument(uri);
|
|
8578
8606
|
if (!document) {
|
|
8579
|
-
console.error("getCommandInDocument: document is "
|
|
8607
|
+
console.error("getCommandInDocument: document is ".concat(document, ". uri is ").concat(uri));
|
|
8580
8608
|
return null;
|
|
8581
8609
|
}
|
|
8582
8610
|
return this._languageService.getCommandsInDocument(document);
|
|
@@ -8646,8 +8674,8 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8646
8674
|
var hover = this._languageService.doHover(document, position);
|
|
8647
8675
|
return hover;
|
|
8648
8676
|
};
|
|
8649
|
-
KustoWorker.prototype.setParameters = function (
|
|
8650
|
-
return this._languageService.setParameters(
|
|
8677
|
+
KustoWorker.prototype.setParameters = function (scalarParameters, tabularParameters) {
|
|
8678
|
+
return this._languageService.setParameters(scalarParameters, tabularParameters);
|
|
8651
8679
|
};
|
|
8652
8680
|
KustoWorker.prototype.getClusterReferences = function (uri, cursorOffset) {
|
|
8653
8681
|
var document = this._getTextDocument(uri);
|
|
@@ -95,13 +95,12 @@ define('vs/language/kusto/commandFormatter',["require", "exports"], function (re
|
|
|
95
95
|
exports.default = KustoCommandFormatter;
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
|
|
99
98
|
define('vs/language/kusto/extendedEditor',["require", "exports"], function (require, exports) {
|
|
100
99
|
"use strict";
|
|
101
100
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
102
101
|
exports.extend = void 0;
|
|
103
102
|
/**
|
|
104
|
-
* Extending ICode editor to contain additional kusto-
|
|
103
|
+
* Extending ICode editor to contain additional kusto-specific methods.
|
|
105
104
|
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
106
105
|
*/
|
|
107
106
|
function extend(editor) {
|
|
@@ -122,7 +121,8 @@ define('vs/language/kusto/extendedEditor',["require", "exports"], function (requ
|
|
|
122
121
|
linesWithCommandOrdinal.push({ commandOrdinal: commandOrdinal, lineNumber: lineNumber });
|
|
123
122
|
}
|
|
124
123
|
// No need to keep scanning if we're past our line and we've seen an empty line.
|
|
125
|
-
if (lineNumber > zeroBasedCursorLineNumber &&
|
|
124
|
+
if (lineNumber > zeroBasedCursorLineNumber &&
|
|
125
|
+
commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -204,7 +204,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
|
|
|
204
204
|
},
|
|
205
205
|
enableQueryWarnings: false,
|
|
206
206
|
enableQuerySuggestions: false,
|
|
207
|
-
|
|
207
|
+
disabledDiagnosticCodes: [],
|
|
208
208
|
};
|
|
209
209
|
function getKustoWorker() {
|
|
210
210
|
return new Promise(function (resolve, reject) {
|
|
@@ -232,7 +232,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
|
|
|
232
232
|
id: 'kusto',
|
|
233
233
|
extensions: ['.csl', '.kql'],
|
|
234
234
|
});
|
|
235
|
-
// TODO: asked if there's a cleaner way to register an editor contribution. looks like monaco has an internal contribution
|
|
235
|
+
// TODO: asked if there's a cleaner way to register an editor contribution. looks like monaco has an internal contribution registrar but it's no exposed in the API.
|
|
236
236
|
// https://stackoverflow.com/questions/46700245/how-to-add-an-ieditorcontribution-to-monaco-editor
|
|
237
237
|
var commandHighlighter;
|
|
238
238
|
var commandFormatter;
|
|
@@ -298,7 +298,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
|
|
|
298
298
|
// Most other language features are initialized in kustoMode.ts
|
|
299
299
|
monacoInstance.editor.onDidCreateEditor(function (editor) {
|
|
300
300
|
// hook up extension methods to editor.
|
|
301
|
-
extendedEditor_1.extend(editor);
|
|
301
|
+
(0, extendedEditor_1.extend)(editor);
|
|
302
302
|
commandHighlighter = new commandHighlighter_1.default(editor);
|
|
303
303
|
if (isStandaloneCodeEditor(editor)) {
|
|
304
304
|
commandFormatter = new commandFormatter_1.default(editor);
|
|
@@ -307,14 +307,15 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
|
|
|
307
307
|
});
|
|
308
308
|
function triggerSuggestDialogWhenCompletionItemSelected(editor) {
|
|
309
309
|
editor.onDidChangeCursorSelection(function (event) {
|
|
310
|
-
// checking the condition inside the event makes sure we will stay up to date
|
|
310
|
+
// checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
|
|
311
311
|
if (kustoDefaults &&
|
|
312
312
|
kustoDefaults.languageSettings &&
|
|
313
313
|
kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
|
|
314
314
|
var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
|
|
315
315
|
// If the word at the current position is not null - meaning we did not add a space after completion.
|
|
316
316
|
// In this case we don't want to activate the eager mode, since it will display the current selected word..
|
|
317
|
-
if (!didAcceptSuggestion ||
|
|
317
|
+
if (!didAcceptSuggestion ||
|
|
318
|
+
editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
|
|
318
319
|
return;
|
|
319
320
|
}
|
|
320
321
|
event.selection;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
|
|
2
1
|
/**
|
|
3
|
-
* Extending ICode editor to contain additional kusto-
|
|
2
|
+
* Extending ICode editor to contain additional kusto-specific methods.
|
|
4
3
|
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
5
4
|
*/
|
|
6
5
|
export function extend(editor) {
|
|
@@ -21,7 +20,8 @@ export function extend(editor) {
|
|
|
21
20
|
linesWithCommandOrdinal.push({ commandOrdinal: commandOrdinal, lineNumber: lineNumber });
|
|
22
21
|
}
|
|
23
22
|
// No need to keep scanning if we're past our line and we've seen an empty line.
|
|
24
|
-
if (lineNumber > zeroBasedCursorLineNumber &&
|
|
23
|
+
if (lineNumber > zeroBasedCursorLineNumber &&
|
|
24
|
+
commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
}
|
package/release/esm/kustoMode.js
CHANGED
|
@@ -35,7 +35,7 @@ export function setupMode(defaults, monacoInstance) {
|
|
|
35
35
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
36
36
|
more[_i - 1] = arguments[_i];
|
|
37
37
|
}
|
|
38
|
-
var augmentedSetSchema = function (schema, worker,
|
|
38
|
+
var augmentedSetSchema = function (schema, worker, globalScalarParameters, globalTabularParameters) {
|
|
39
39
|
var workerPromise = worker.setSchema(schema);
|
|
40
40
|
workerPromise.then(function () {
|
|
41
41
|
onSchemaChange.fire(schema);
|
|
@@ -43,10 +43,13 @@ export function setupMode(defaults, monacoInstance) {
|
|
|
43
43
|
};
|
|
44
44
|
var worker = client.getLanguageServiceWorker.apply(client, [first].concat(more));
|
|
45
45
|
return worker.then(function (worker) {
|
|
46
|
-
return (__assign(__assign({}, worker), { setSchema: function (schema) { return augmentedSetSchema(schema, worker); }, setSchemaFromShowSchema: function (schema, connection, database,
|
|
46
|
+
return (__assign(__assign({}, worker), { setSchema: function (schema) { return augmentedSetSchema(schema, worker); }, setSchemaFromShowSchema: function (schema, connection, database, globalScalarParameters, globalTabularParameters) {
|
|
47
47
|
worker
|
|
48
48
|
.normalizeSchema(schema, connection, database)
|
|
49
|
-
.then(function (schema) {
|
|
49
|
+
.then(function (schema) {
|
|
50
|
+
return globalScalarParameters
|
|
51
|
+
? __assign(__assign({}, schema), { globalScalarParameters: globalScalarParameters, globalTabularParameters: globalTabularParameters }) : schema;
|
|
52
|
+
})
|
|
50
53
|
.then(function (normalized) { return augmentedSetSchema(normalized, worker); });
|
|
51
54
|
} }));
|
|
52
55
|
});
|
|
@@ -14,7 +14,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
14
14
|
KustoWorker.prototype.addClusterToSchema = function (uri, clusterName, databasesNames) {
|
|
15
15
|
var document = this._getTextDocument(uri);
|
|
16
16
|
if (!document) {
|
|
17
|
-
console.error("addClusterToSchema: document is "
|
|
17
|
+
console.error("addClusterToSchema: document is ".concat(document, ". uri is ").concat(uri));
|
|
18
18
|
return Promise.resolve();
|
|
19
19
|
}
|
|
20
20
|
return this._languageService.addClusterToSchema(document, clusterName, databasesNames);
|
|
@@ -22,7 +22,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
22
22
|
KustoWorker.prototype.addDatabaseToSchema = function (uri, clusterName, databaseSchema) {
|
|
23
23
|
var document = this._getTextDocument(uri);
|
|
24
24
|
if (!document) {
|
|
25
|
-
console.error("addDatabaseToSchema: document is "
|
|
25
|
+
console.error("addDatabaseToSchema: document is ".concat(document, ". uri is ").concat(uri));
|
|
26
26
|
return Promise.resolve();
|
|
27
27
|
}
|
|
28
28
|
return this._languageService.addDatabaseToSchema(document, clusterName, databaseSchema);
|
|
@@ -39,7 +39,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
39
39
|
KustoWorker.prototype.getCommandInContext = function (uri, cursorOffset) {
|
|
40
40
|
var document = this._getTextDocument(uri);
|
|
41
41
|
if (!document) {
|
|
42
|
-
console.error("getCommandInContext: document is "
|
|
42
|
+
console.error("getCommandInContext: document is ".concat(document, ". uri is ").concat(uri));
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
var commandInContext = this._languageService.getCommandInContext(document, cursorOffset);
|
|
@@ -51,7 +51,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
51
51
|
KustoWorker.prototype.getQueryParams = function (uri, cursorOffset) {
|
|
52
52
|
var document = this._getTextDocument(uri);
|
|
53
53
|
if (!document) {
|
|
54
|
-
console.error("getQueryParams: document is "
|
|
54
|
+
console.error("getQueryParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
57
|
var queryParams = this._languageService.getQueryParams(document, cursorOffset);
|
|
@@ -63,7 +63,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
63
63
|
KustoWorker.prototype.getGlobalParams = function (uri) {
|
|
64
64
|
var document = this._getTextDocument(uri);
|
|
65
65
|
if (!document) {
|
|
66
|
-
console.error("getGLobalParams: document is "
|
|
66
|
+
console.error("getGLobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
var globalParams = this._languageService.getGlobalParams(document);
|
|
@@ -75,7 +75,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
75
75
|
KustoWorker.prototype.getReferencedGlobalParams = function (uri, cursorOffest) {
|
|
76
76
|
var document = this._getTextDocument(uri);
|
|
77
77
|
if (!document) {
|
|
78
|
-
console.error("getReferencedGlobalParams: document is "
|
|
78
|
+
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
var referencedParams = this._languageService.getReferencedGlobalParams(document, cursorOffest);
|
|
@@ -87,7 +87,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
87
87
|
KustoWorker.prototype.getRenderInfo = function (uri, cursorOffset) {
|
|
88
88
|
var document = this._getTextDocument(uri);
|
|
89
89
|
if (!document) {
|
|
90
|
-
console.error("getRenderInfo: document is "
|
|
90
|
+
console.error("getRenderInfo: document is ".concat(document, ". uri is ").concat(uri));
|
|
91
91
|
}
|
|
92
92
|
return this._languageService.getRenderInfo(document, cursorOffset).then(function (result) {
|
|
93
93
|
if (!result) {
|
|
@@ -105,7 +105,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
105
105
|
KustoWorker.prototype.getCommandAndLocationInContext = function (uri, cursorOffset) {
|
|
106
106
|
var document = this._getTextDocument(uri);
|
|
107
107
|
if (!document) {
|
|
108
|
-
console.error("getCommandAndLocationInContext: document is "
|
|
108
|
+
console.error("getCommandAndLocationInContext: document is ".concat(document, ". uri is ").concat(uri));
|
|
109
109
|
return Promise.resolve(null);
|
|
110
110
|
}
|
|
111
111
|
return this._languageService.getCommandAndLocationInContext(document, cursorOffset).then(function (result) {
|
|
@@ -124,7 +124,7 @@ var KustoWorker = /** @class */ (function () {
|
|
|
124
124
|
KustoWorker.prototype.getCommandsInDocument = function (uri) {
|
|
125
125
|
var document = this._getTextDocument(uri);
|
|
126
126
|
if (!document) {
|
|
127
|
-
console.error("getCommandInDocument: document is "
|
|
127
|
+
console.error("getCommandInDocument: document is ".concat(document, ". uri is ").concat(uri));
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
130
|
return this._languageService.getCommandsInDocument(document);
|
|
@@ -194,8 +194,8 @@ var KustoWorker = /** @class */ (function () {
|
|
|
194
194
|
var hover = this._languageService.doHover(document, position);
|
|
195
195
|
return hover;
|
|
196
196
|
};
|
|
197
|
-
KustoWorker.prototype.setParameters = function (
|
|
198
|
-
return this._languageService.setParameters(
|
|
197
|
+
KustoWorker.prototype.setParameters = function (scalarParameters, tabularParameters) {
|
|
198
|
+
return this._languageService.setParameters(scalarParameters, tabularParameters);
|
|
199
199
|
};
|
|
200
200
|
KustoWorker.prototype.getClusterReferences = function (uri, cursorOffset) {
|
|
201
201
|
var document = this._getTextDocument(uri);
|