@kusto/monaco-kusto 5.4.0 → 5.5.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 +1 -1
- package/release/dev/kustoMode.js +17 -8
- package/release/dev/kustoWorker.js +75 -18
- package/release/esm/kustoWorker.js +14 -2
- package/release/esm/languageFeatures.js +17 -8
- package/release/esm/languageService/kustoLanguageService.js +61 -16
- package/release/esm/monaco.d.ts +5 -1
- package/release/min/kustoMode.js +1 -1
- package/release/min/kustoWorker.js +1 -1
- package/release/min/monaco.contribution.js +1 -1
- package/release/min/monaco.d.ts +5 -1
package/package.json
CHANGED
package/release/dev/kustoMode.js
CHANGED
|
@@ -2445,11 +2445,11 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
|
|
|
2445
2445
|
actions = _a.sent();
|
|
2446
2446
|
return [2 /*return*/, {
|
|
2447
2447
|
actions: actions,
|
|
2448
|
-
dispose: function () { }
|
|
2448
|
+
dispose: function () { },
|
|
2449
2449
|
}];
|
|
2450
2450
|
}
|
|
2451
2451
|
});
|
|
2452
|
-
}); }
|
|
2452
|
+
}); },
|
|
2453
2453
|
}));
|
|
2454
2454
|
this._disposables.push(this._monacoInstance.editor.onDidCreateEditor(onEditorAdd));
|
|
2455
2455
|
this._disposables.push(this._monacoInstance.editor.onDidCreateModel(onModelAdd));
|
|
@@ -2494,7 +2494,11 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
|
|
|
2494
2494
|
if (codeAction.title.includes('Extract Function')) {
|
|
2495
2495
|
return "continue";
|
|
2496
2496
|
}
|
|
2497
|
-
var codeActionKind = ((_a = this_1.defaults.languageSettings.quickFixCodeActions) === null || _a === void 0 ? void 0 : _a.find(function (actionTitle) {
|
|
2497
|
+
var codeActionKind = ((_a = this_1.defaults.languageSettings.quickFixCodeActions) === null || _a === void 0 ? void 0 : _a.find(function (actionTitle) {
|
|
2498
|
+
return codeAction.title.includes(actionTitle);
|
|
2499
|
+
}))
|
|
2500
|
+
? 'quickfix'
|
|
2501
|
+
: 'custom';
|
|
2498
2502
|
if (codeActionKind === 'quickfix' && !enableQuickFix) {
|
|
2499
2503
|
return { value: void 0 };
|
|
2500
2504
|
}
|
|
@@ -2506,9 +2510,14 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
|
|
|
2506
2510
|
return {
|
|
2507
2511
|
resource: model.uri,
|
|
2508
2512
|
textEdit: {
|
|
2509
|
-
range: {
|
|
2510
|
-
|
|
2511
|
-
|
|
2513
|
+
range: {
|
|
2514
|
+
startLineNumber: startPosition.lineNumber,
|
|
2515
|
+
startColumn: startPosition.column,
|
|
2516
|
+
endLineNumber: endPosition.lineNumber,
|
|
2517
|
+
endColumn: endPosition.column,
|
|
2518
|
+
},
|
|
2519
|
+
text: (_a = change.insertText) !== null && _a !== void 0 ? _a : '',
|
|
2520
|
+
},
|
|
2512
2521
|
};
|
|
2513
2522
|
});
|
|
2514
2523
|
actions.push({
|
|
@@ -2516,9 +2525,9 @@ define('vs/language/kusto/languageFeatures',["require", "exports", "vscode-langu
|
|
|
2516
2525
|
diagnostics: [],
|
|
2517
2526
|
kind: codeActionKind,
|
|
2518
2527
|
edit: {
|
|
2519
|
-
edits: __spreadArray([], edits, true)
|
|
2528
|
+
edits: __spreadArray([], edits, true),
|
|
2520
2529
|
},
|
|
2521
|
-
isPreferred: true
|
|
2530
|
+
isPreferred: true,
|
|
2522
2531
|
});
|
|
2523
2532
|
};
|
|
2524
2533
|
this_1 = this;
|
|
@@ -6672,6 +6672,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
6672
6672
|
};
|
|
6673
6673
|
define('vs/language/kusto/languageService/kustoLanguageService',["require", "exports", "./schema", "vscode-languageserver-types", "xregexp", "./schema"], function (require, exports, s, ls, XRegExp, schema_1) {
|
|
6674
6674
|
"use strict";
|
|
6675
|
+
var _a;
|
|
6675
6676
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6676
6677
|
exports.getKustoLanguageService = exports.TokenKind = void 0;
|
|
6677
6678
|
// polyfill string endsWith
|
|
@@ -6754,6 +6755,30 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
6754
6755
|
kind: classification.Kind,
|
|
6755
6756
|
}); });
|
|
6756
6757
|
}
|
|
6758
|
+
var symbolKindToName = (_a = {},
|
|
6759
|
+
_a[sym.SymbolKind.Cluster] = 'Cluster',
|
|
6760
|
+
_a[sym.SymbolKind.Column] = 'Column',
|
|
6761
|
+
_a[sym.SymbolKind.Command] = 'Command',
|
|
6762
|
+
_a[sym.SymbolKind.Database] = 'Database',
|
|
6763
|
+
_a[sym.SymbolKind.EntityGroup] = 'EntityGroup',
|
|
6764
|
+
_a[sym.SymbolKind.EntityGroupElement] = 'EntityGroupElement',
|
|
6765
|
+
_a[sym.SymbolKind.Error] = 'Error',
|
|
6766
|
+
_a[sym.SymbolKind.Function] = 'Function',
|
|
6767
|
+
_a[sym.SymbolKind.Graph] = 'Graph',
|
|
6768
|
+
_a[sym.SymbolKind.Group] = 'Group',
|
|
6769
|
+
_a[sym.SymbolKind.MaterializedView] = 'MaterializedView',
|
|
6770
|
+
_a[sym.SymbolKind.None] = 'None',
|
|
6771
|
+
_a[sym.SymbolKind.Operator] = 'Operator',
|
|
6772
|
+
_a[sym.SymbolKind.Option] = 'Option',
|
|
6773
|
+
_a[sym.SymbolKind.Parameter] = 'Parameter',
|
|
6774
|
+
_a[sym.SymbolKind.Pattern] = 'Pattern',
|
|
6775
|
+
_a[sym.SymbolKind.QueryOperatorParameter] = 'QueryOperatorParameter',
|
|
6776
|
+
_a[sym.SymbolKind.Scalar] = 'Scalar',
|
|
6777
|
+
_a[sym.SymbolKind.Table] = 'Table',
|
|
6778
|
+
_a[sym.SymbolKind.Tuple] = 'Tuple',
|
|
6779
|
+
_a[sym.SymbolKind.Variable] = 'Variable',
|
|
6780
|
+
_a[sym.SymbolKind.Void] = 'Void',
|
|
6781
|
+
_a);
|
|
6757
6782
|
/**
|
|
6758
6783
|
* Kusto Language service translates the kusto object model (transpiled from C# by Bridge.Net)
|
|
6759
6784
|
* to the vscode language server types, which are used by vscode language extensions.
|
|
@@ -7287,13 +7312,17 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
7287
7312
|
var script = this.parseDocumentV2(document);
|
|
7288
7313
|
var block = this.getAffectedBlocks(this.toArray(script.Blocks), [{ start: start, end: end }])[0];
|
|
7289
7314
|
var applyCodeActions = this.getApplyCodeActions(document, start, end);
|
|
7290
|
-
var resultActionsMap = applyCodeActions
|
|
7315
|
+
var resultActionsMap = applyCodeActions
|
|
7316
|
+
.map(function (applyCodeAction) {
|
|
7291
7317
|
var changes = [];
|
|
7292
7318
|
var codeActionResults = _this.toArray(block.Service.ApplyCodeAction(applyCodeAction, start).Actions);
|
|
7293
7319
|
var changeTextAction = codeActionResults.find(function (c) { return c instanceof Kusto.Language.Editor.ChangeTextAction; });
|
|
7294
7320
|
if (changeTextAction) {
|
|
7295
|
-
changes = _this.toArray(changeTextAction.Changes)
|
|
7296
|
-
|
|
7321
|
+
changes = _this.toArray(changeTextAction.Changes).map(function (change) { return ({
|
|
7322
|
+
start: change.Start + block.Start,
|
|
7323
|
+
deleteLength: change.DeleteLength,
|
|
7324
|
+
insertText: change.InsertText,
|
|
7325
|
+
}); });
|
|
7297
7326
|
}
|
|
7298
7327
|
return { title: applyCodeAction.Title, changes: changes };
|
|
7299
7328
|
})
|
|
@@ -7906,17 +7935,30 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
7906
7935
|
};
|
|
7907
7936
|
return Promise.resolve(renderInfo);
|
|
7908
7937
|
};
|
|
7909
|
-
KustoLanguageService.prototype.
|
|
7910
|
-
|
|
7911
|
-
|
|
7938
|
+
KustoLanguageService.prototype.getReferencedSymbols = function (document, offset) {
|
|
7939
|
+
var parsedAndAnalyzed = this.parseAndAnalyze(document, offset);
|
|
7940
|
+
if (!parsedAndAnalyzed) {
|
|
7941
|
+
Promise.resolve([]);
|
|
7912
7942
|
}
|
|
7913
|
-
|
|
7914
|
-
var
|
|
7915
|
-
|
|
7916
|
-
return
|
|
7943
|
+
// We take all referenced symbols in the query
|
|
7944
|
+
var referencedSymbols = this.toArray(parsedAndAnalyzed.Syntax.GetDescendants(Kusto.Language.Syntax.Expression))
|
|
7945
|
+
.filter(function (expression) { return expression.ReferencedSymbol !== null; })
|
|
7946
|
+
.map(function (x) { return x.ReferencedSymbol; });
|
|
7947
|
+
var result = referencedSymbols.map(function (sym) {
|
|
7948
|
+
var _a;
|
|
7949
|
+
return ({
|
|
7950
|
+
name: sym.Name,
|
|
7951
|
+
kind: (_a = symbolKindToName[sym.Kind]) !== null && _a !== void 0 ? _a : "".concat(sym.Kind),
|
|
7952
|
+
display: sym.Display,
|
|
7953
|
+
});
|
|
7954
|
+
});
|
|
7955
|
+
return Promise.resolve(result);
|
|
7956
|
+
};
|
|
7957
|
+
KustoLanguageService.prototype.getReferencedGlobalParams = function (document, cursorOffset) {
|
|
7958
|
+
var parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
|
|
7959
|
+
if (!parsedAndAnalyzed) {
|
|
7960
|
+
Promise.resolve([]);
|
|
7917
7961
|
}
|
|
7918
|
-
var text = currentBlock.Text;
|
|
7919
|
-
var parsedAndAnalyzed = Kusto.Language.KustoCode.ParseAndAnalyze(text, this._kustoJsSchemaV2);
|
|
7920
7962
|
// We take the ambient parameters
|
|
7921
7963
|
var ambientParameters = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
7922
7964
|
// We take all referenced symbols in the query
|
|
@@ -8496,11 +8538,14 @@ define('vs/language/kusto/languageService/kustoLanguageService',["require", "exp
|
|
|
8496
8538
|
return undefined;
|
|
8497
8539
|
}
|
|
8498
8540
|
var script = this.parseDocumentV2(document);
|
|
8499
|
-
var
|
|
8500
|
-
if (
|
|
8501
|
-
|
|
8541
|
+
var text = script.Text;
|
|
8542
|
+
if (cursorOffset !== undefined) {
|
|
8543
|
+
var currentBlock = this.getCurrentCommandV2(script, cursorOffset);
|
|
8544
|
+
if (!currentBlock) {
|
|
8545
|
+
return undefined;
|
|
8546
|
+
}
|
|
8547
|
+
text = currentBlock.Text;
|
|
8502
8548
|
}
|
|
8503
|
-
var text = currentBlock.Text;
|
|
8504
8549
|
var parsedAndAnalyzed = Kusto.Language.KustoCode.ParseAndAnalyze(text, this._kustoJsSchemaV2);
|
|
8505
8550
|
return parsedAndAnalyzed;
|
|
8506
8551
|
};
|
|
@@ -8596,13 +8641,25 @@ define('vs/language/kusto/kustoWorker',["require", "exports", "./languageService
|
|
|
8596
8641
|
}
|
|
8597
8642
|
return globalParams;
|
|
8598
8643
|
};
|
|
8599
|
-
KustoWorker.prototype.
|
|
8644
|
+
KustoWorker.prototype.getReferencedSymbols = function (uri, cursorOffset) {
|
|
8645
|
+
var document = this._getTextDocument(uri);
|
|
8646
|
+
if (!document) {
|
|
8647
|
+
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
8648
|
+
return null;
|
|
8649
|
+
}
|
|
8650
|
+
var referencedParams = this._languageService.getReferencedSymbols(document, cursorOffset);
|
|
8651
|
+
if (referencedParams === undefined) {
|
|
8652
|
+
return null;
|
|
8653
|
+
}
|
|
8654
|
+
return referencedParams;
|
|
8655
|
+
};
|
|
8656
|
+
KustoWorker.prototype.getReferencedGlobalParams = function (uri, cursorOffset) {
|
|
8600
8657
|
var document = this._getTextDocument(uri);
|
|
8601
8658
|
if (!document) {
|
|
8602
8659
|
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
8603
8660
|
return null;
|
|
8604
8661
|
}
|
|
8605
|
-
var referencedParams = this._languageService.getReferencedGlobalParams(document,
|
|
8662
|
+
var referencedParams = this._languageService.getReferencedGlobalParams(document, cursorOffset);
|
|
8606
8663
|
if (referencedParams === undefined) {
|
|
8607
8664
|
return null;
|
|
8608
8665
|
}
|
|
@@ -72,13 +72,25 @@ var KustoWorker = /** @class */ (function () {
|
|
|
72
72
|
}
|
|
73
73
|
return globalParams;
|
|
74
74
|
};
|
|
75
|
-
KustoWorker.prototype.
|
|
75
|
+
KustoWorker.prototype.getReferencedSymbols = function (uri, cursorOffset) {
|
|
76
76
|
var document = this._getTextDocument(uri);
|
|
77
77
|
if (!document) {
|
|
78
78
|
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
|
-
var referencedParams = this._languageService.
|
|
81
|
+
var referencedParams = this._languageService.getReferencedSymbols(document, cursorOffset);
|
|
82
|
+
if (referencedParams === undefined) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return referencedParams;
|
|
86
|
+
};
|
|
87
|
+
KustoWorker.prototype.getReferencedGlobalParams = function (uri, cursorOffset) {
|
|
88
|
+
var document = this._getTextDocument(uri);
|
|
89
|
+
if (!document) {
|
|
90
|
+
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
var referencedParams = this._languageService.getReferencedGlobalParams(document, cursorOffset);
|
|
82
94
|
if (referencedParams === undefined) {
|
|
83
95
|
return null;
|
|
84
96
|
}
|
|
@@ -137,11 +137,11 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
137
137
|
actions = _a.sent();
|
|
138
138
|
return [2 /*return*/, {
|
|
139
139
|
actions: actions,
|
|
140
|
-
dispose: function () { }
|
|
140
|
+
dispose: function () { },
|
|
141
141
|
}];
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
-
}); }
|
|
144
|
+
}); },
|
|
145
145
|
}));
|
|
146
146
|
this._disposables.push(this._monacoInstance.editor.onDidCreateEditor(onEditorAdd));
|
|
147
147
|
this._disposables.push(this._monacoInstance.editor.onDidCreateModel(onModelAdd));
|
|
@@ -186,7 +186,11 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
186
186
|
if (codeAction.title.includes('Extract Function')) {
|
|
187
187
|
return "continue";
|
|
188
188
|
}
|
|
189
|
-
var codeActionKind = ((_a = this_1.defaults.languageSettings.quickFixCodeActions) === null || _a === void 0 ? void 0 : _a.find(function (actionTitle) {
|
|
189
|
+
var codeActionKind = ((_a = this_1.defaults.languageSettings.quickFixCodeActions) === null || _a === void 0 ? void 0 : _a.find(function (actionTitle) {
|
|
190
|
+
return codeAction.title.includes(actionTitle);
|
|
191
|
+
}))
|
|
192
|
+
? 'quickfix'
|
|
193
|
+
: 'custom';
|
|
190
194
|
if (codeActionKind === 'quickfix' && !enableQuickFix) {
|
|
191
195
|
return { value: void 0 };
|
|
192
196
|
}
|
|
@@ -198,9 +202,14 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
198
202
|
return {
|
|
199
203
|
resource: model.uri,
|
|
200
204
|
textEdit: {
|
|
201
|
-
range: {
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
range: {
|
|
206
|
+
startLineNumber: startPosition.lineNumber,
|
|
207
|
+
startColumn: startPosition.column,
|
|
208
|
+
endLineNumber: endPosition.lineNumber,
|
|
209
|
+
endColumn: endPosition.column,
|
|
210
|
+
},
|
|
211
|
+
text: (_a = change.insertText) !== null && _a !== void 0 ? _a : '',
|
|
212
|
+
},
|
|
204
213
|
};
|
|
205
214
|
});
|
|
206
215
|
actions.push({
|
|
@@ -208,9 +217,9 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
208
217
|
diagnostics: [],
|
|
209
218
|
kind: codeActionKind,
|
|
210
219
|
edit: {
|
|
211
|
-
edits: __spreadArray([], edits, true)
|
|
220
|
+
edits: __spreadArray([], edits, true),
|
|
212
221
|
},
|
|
213
|
-
isPreferred: true
|
|
222
|
+
isPreferred: true,
|
|
214
223
|
});
|
|
215
224
|
};
|
|
216
225
|
this_1 = this;
|
|
@@ -18,6 +18,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
18
18
|
}
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
|
+
var _a;
|
|
21
22
|
import * as s from './schema';
|
|
22
23
|
// polyfill string endsWith
|
|
23
24
|
if (!String.prototype.endsWith) {
|
|
@@ -102,6 +103,30 @@ function toClassifiedRange(k2Classifications) {
|
|
|
102
103
|
kind: classification.Kind,
|
|
103
104
|
}); });
|
|
104
105
|
}
|
|
106
|
+
var symbolKindToName = (_a = {},
|
|
107
|
+
_a[sym.SymbolKind.Cluster] = 'Cluster',
|
|
108
|
+
_a[sym.SymbolKind.Column] = 'Column',
|
|
109
|
+
_a[sym.SymbolKind.Command] = 'Command',
|
|
110
|
+
_a[sym.SymbolKind.Database] = 'Database',
|
|
111
|
+
_a[sym.SymbolKind.EntityGroup] = 'EntityGroup',
|
|
112
|
+
_a[sym.SymbolKind.EntityGroupElement] = 'EntityGroupElement',
|
|
113
|
+
_a[sym.SymbolKind.Error] = 'Error',
|
|
114
|
+
_a[sym.SymbolKind.Function] = 'Function',
|
|
115
|
+
_a[sym.SymbolKind.Graph] = 'Graph',
|
|
116
|
+
_a[sym.SymbolKind.Group] = 'Group',
|
|
117
|
+
_a[sym.SymbolKind.MaterializedView] = 'MaterializedView',
|
|
118
|
+
_a[sym.SymbolKind.None] = 'None',
|
|
119
|
+
_a[sym.SymbolKind.Operator] = 'Operator',
|
|
120
|
+
_a[sym.SymbolKind.Option] = 'Option',
|
|
121
|
+
_a[sym.SymbolKind.Parameter] = 'Parameter',
|
|
122
|
+
_a[sym.SymbolKind.Pattern] = 'Pattern',
|
|
123
|
+
_a[sym.SymbolKind.QueryOperatorParameter] = 'QueryOperatorParameter',
|
|
124
|
+
_a[sym.SymbolKind.Scalar] = 'Scalar',
|
|
125
|
+
_a[sym.SymbolKind.Table] = 'Table',
|
|
126
|
+
_a[sym.SymbolKind.Tuple] = 'Tuple',
|
|
127
|
+
_a[sym.SymbolKind.Variable] = 'Variable',
|
|
128
|
+
_a[sym.SymbolKind.Void] = 'Void',
|
|
129
|
+
_a);
|
|
105
130
|
/**
|
|
106
131
|
* Kusto Language service translates the kusto object model (transpiled from C# by Bridge.Net)
|
|
107
132
|
* to the vscode language server types, which are used by vscode language extensions.
|
|
@@ -635,13 +660,17 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
635
660
|
var script = this.parseDocumentV2(document);
|
|
636
661
|
var block = this.getAffectedBlocks(this.toArray(script.Blocks), [{ start: start, end: end }])[0];
|
|
637
662
|
var applyCodeActions = this.getApplyCodeActions(document, start, end);
|
|
638
|
-
var resultActionsMap = applyCodeActions
|
|
663
|
+
var resultActionsMap = applyCodeActions
|
|
664
|
+
.map(function (applyCodeAction) {
|
|
639
665
|
var changes = [];
|
|
640
666
|
var codeActionResults = _this.toArray(block.Service.ApplyCodeAction(applyCodeAction, start).Actions);
|
|
641
667
|
var changeTextAction = codeActionResults.find(function (c) { return c instanceof Kusto.Language.Editor.ChangeTextAction; });
|
|
642
668
|
if (changeTextAction) {
|
|
643
|
-
changes = _this.toArray(changeTextAction.Changes)
|
|
644
|
-
|
|
669
|
+
changes = _this.toArray(changeTextAction.Changes).map(function (change) { return ({
|
|
670
|
+
start: change.Start + block.Start,
|
|
671
|
+
deleteLength: change.DeleteLength,
|
|
672
|
+
insertText: change.InsertText,
|
|
673
|
+
}); });
|
|
645
674
|
}
|
|
646
675
|
return { title: applyCodeAction.Title, changes: changes };
|
|
647
676
|
})
|
|
@@ -1254,17 +1283,30 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1254
1283
|
};
|
|
1255
1284
|
return Promise.resolve(renderInfo);
|
|
1256
1285
|
};
|
|
1257
|
-
KustoLanguageService.prototype.
|
|
1258
|
-
|
|
1259
|
-
|
|
1286
|
+
KustoLanguageService.prototype.getReferencedSymbols = function (document, offset) {
|
|
1287
|
+
var parsedAndAnalyzed = this.parseAndAnalyze(document, offset);
|
|
1288
|
+
if (!parsedAndAnalyzed) {
|
|
1289
|
+
Promise.resolve([]);
|
|
1260
1290
|
}
|
|
1261
|
-
|
|
1262
|
-
var
|
|
1263
|
-
|
|
1264
|
-
return
|
|
1291
|
+
// We take all referenced symbols in the query
|
|
1292
|
+
var referencedSymbols = this.toArray(parsedAndAnalyzed.Syntax.GetDescendants(Kusto.Language.Syntax.Expression))
|
|
1293
|
+
.filter(function (expression) { return expression.ReferencedSymbol !== null; })
|
|
1294
|
+
.map(function (x) { return x.ReferencedSymbol; });
|
|
1295
|
+
var result = referencedSymbols.map(function (sym) {
|
|
1296
|
+
var _a;
|
|
1297
|
+
return ({
|
|
1298
|
+
name: sym.Name,
|
|
1299
|
+
kind: (_a = symbolKindToName[sym.Kind]) !== null && _a !== void 0 ? _a : "".concat(sym.Kind),
|
|
1300
|
+
display: sym.Display,
|
|
1301
|
+
});
|
|
1302
|
+
});
|
|
1303
|
+
return Promise.resolve(result);
|
|
1304
|
+
};
|
|
1305
|
+
KustoLanguageService.prototype.getReferencedGlobalParams = function (document, cursorOffset) {
|
|
1306
|
+
var parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
|
|
1307
|
+
if (!parsedAndAnalyzed) {
|
|
1308
|
+
Promise.resolve([]);
|
|
1265
1309
|
}
|
|
1266
|
-
var text = currentBlock.Text;
|
|
1267
|
-
var parsedAndAnalyzed = Kusto.Language.KustoCode.ParseAndAnalyze(text, this._kustoJsSchemaV2);
|
|
1268
1310
|
// We take the ambient parameters
|
|
1269
1311
|
var ambientParameters = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
1270
1312
|
// We take all referenced symbols in the query
|
|
@@ -1844,11 +1886,14 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1844
1886
|
return undefined;
|
|
1845
1887
|
}
|
|
1846
1888
|
var script = this.parseDocumentV2(document);
|
|
1847
|
-
var
|
|
1848
|
-
if (
|
|
1849
|
-
|
|
1889
|
+
var text = script.Text;
|
|
1890
|
+
if (cursorOffset !== undefined) {
|
|
1891
|
+
var currentBlock = this.getCurrentCommandV2(script, cursorOffset);
|
|
1892
|
+
if (!currentBlock) {
|
|
1893
|
+
return undefined;
|
|
1894
|
+
}
|
|
1895
|
+
text = currentBlock.Text;
|
|
1850
1896
|
}
|
|
1851
|
-
var text = currentBlock.Text;
|
|
1852
1897
|
var parsedAndAnalyzed = Kusto.Language.KustoCode.ParseAndAnalyze(text, this._kustoJsSchemaV2);
|
|
1853
1898
|
return parsedAndAnalyzed;
|
|
1854
1899
|
};
|
package/release/esm/monaco.d.ts
CHANGED
|
@@ -115,8 +115,12 @@ declare module monaco.languages.kusto {
|
|
|
115
115
|
* statement.
|
|
116
116
|
* It is also different from getGlobalParams that will return all global parameters whether used or not.
|
|
117
117
|
*/
|
|
118
|
-
getReferencedGlobalParams(uri: string, cursorOffset
|
|
118
|
+
getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<{ name: string; type: string }[]>;
|
|
119
119
|
|
|
120
|
+
getReferencedSymbols(
|
|
121
|
+
document: TextDocument,
|
|
122
|
+
cursorOffset?: number
|
|
123
|
+
): Promise<{ name: string; kind: string; display: string }[]>;
|
|
120
124
|
/**
|
|
121
125
|
* Get visualization options in render command if present (null otherwise).
|
|
122
126
|
*/
|
package/release/min/kustoMode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 5.
|
|
3
|
+
* monaco-kusto version: 5.5.0(undefined)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 5.
|
|
3
|
+
* monaco-kusto version: 5.5.0(undefined)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 5.
|
|
3
|
+
* monaco-kusto version: 5.5.0(undefined)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
package/release/min/monaco.d.ts
CHANGED
|
@@ -115,8 +115,12 @@ declare module monaco.languages.kusto {
|
|
|
115
115
|
* statement.
|
|
116
116
|
* It is also different from getGlobalParams that will return all global parameters whether used or not.
|
|
117
117
|
*/
|
|
118
|
-
getReferencedGlobalParams(uri: string, cursorOffset
|
|
118
|
+
getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<{ name: string; type: string }[]>;
|
|
119
119
|
|
|
120
|
+
getReferencedSymbols(
|
|
121
|
+
document: TextDocument,
|
|
122
|
+
cursorOffset?: number
|
|
123
|
+
): Promise<{ name: string; kind: string; display: string }[]>;
|
|
120
124
|
/**
|
|
121
125
|
* Get visualization options in render command if present (null otherwise).
|
|
122
126
|
*/
|