@kusto/monaco-kusto 4.1.8 → 5.1.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/package.json +6 -6
- package/release/dev/kustoMode.js +1953 -1570
- package/release/dev/kustoWorker.js +1974 -1561
- package/release/dev/monaco.contribution.js +19 -16
- package/release/esm/_deps/vscode-languageserver-types/main.js +1908 -1527
- package/release/esm/commandFormatter.js +5 -3
- package/release/esm/commandHighlighter.js +9 -5
- package/release/esm/languageFeatures.js +32 -31
- package/release/esm/languageService/kustoLanguageService.js +53 -22
- package/release/esm/monaco.contribution.js +5 -8
- package/release/esm/monaco.d.ts +3 -0
- package/release/min/kustoMode.js +3 -3
- package/release/min/kustoWorker.js +6 -6
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/monaco.d.ts +3 -0
|
@@ -6,7 +6,7 @@ var KustoCommandFormatter = /** @class */ (function () {
|
|
|
6
6
|
// selection also represents no selection - for example the event gets triggered when moving cursor from point
|
|
7
7
|
// a to point b. in the case start position will equal end position.
|
|
8
8
|
editor.onDidChangeCursorSelection(function (changeEvent) {
|
|
9
|
-
if (_this.editor.getModel().
|
|
9
|
+
if (_this.editor.getModel().getLanguageId() !== 'kusto') {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
// Theoretically you would expect this code to run only once in onDidCreateEditor.
|
|
@@ -19,11 +19,13 @@ var KustoCommandFormatter = /** @class */ (function () {
|
|
|
19
19
|
editor.addAction({
|
|
20
20
|
id: 'editor.action.kusto.formatCurrentCommand',
|
|
21
21
|
label: 'Format Command Under Cursor',
|
|
22
|
-
keybindings: [
|
|
22
|
+
keybindings: [
|
|
23
|
+
monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyF),
|
|
24
|
+
],
|
|
23
25
|
run: function (ed) {
|
|
24
26
|
editor.trigger('KustoCommandFormatter', 'editor.action.formatSelection', null);
|
|
25
27
|
},
|
|
26
|
-
contextMenuGroupId: '1_modification'
|
|
28
|
+
contextMenuGroupId: '1_modification',
|
|
27
29
|
});
|
|
28
30
|
_this.actionAdded = true;
|
|
29
31
|
}
|
|
@@ -14,7 +14,7 @@ var KustoCommandHighlighter = /** @class */ (function () {
|
|
|
14
14
|
// Note that selection update is triggered not only for selection changes, but also just when no text selection is occuring and cursor just moves around.
|
|
15
15
|
// This case is counted as a 0-length selection starting and ending on the cursor position.
|
|
16
16
|
this.editor.onDidChangeCursorSelection(function (changeEvent) {
|
|
17
|
-
if (_this.editor.getModel().
|
|
17
|
+
if (_this.editor.getModel().getLanguageId() !== 'kusto') {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
_this.highlightCommandUnderCursor(changeEvent);
|
|
@@ -34,14 +34,18 @@ var KustoCommandHighlighter = /** @class */ (function () {
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
var commandRange = this.editor.getCurrentCommandRange(changeEvent.selection.getStartPosition());
|
|
37
|
-
var decorations = [
|
|
37
|
+
var decorations = [
|
|
38
|
+
{
|
|
38
39
|
range: commandRange,
|
|
39
|
-
options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT
|
|
40
|
-
}
|
|
40
|
+
options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
41
43
|
this.decorations = this.editor.deltaDecorations(this.decorations, decorations);
|
|
42
44
|
};
|
|
43
45
|
KustoCommandHighlighter.ID = 'editor.contrib.kustoCommandHighliter';
|
|
44
|
-
KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT = {
|
|
46
|
+
KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT = {
|
|
47
|
+
className: 'selectionHighlight',
|
|
48
|
+
};
|
|
45
49
|
return KustoCommandHighlighter;
|
|
46
50
|
}());
|
|
47
51
|
export default KustoCommandHighlighter;
|
|
@@ -16,20 +16,20 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
16
16
|
this._configurationListener = Object.create(null);
|
|
17
17
|
this._schemaListener = Object.create(null);
|
|
18
18
|
var onModelAdd = function (model) {
|
|
19
|
-
var
|
|
20
|
-
if (
|
|
19
|
+
var languageId = model.getLanguageId();
|
|
20
|
+
if (languageId !== _this._languageId) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
var debouncedValidation = _.debounce(function (intervals) { return _this._doValidate(model,
|
|
23
|
+
var debouncedValidation = _.debounce(function (intervals) { return _this._doValidate(model, languageId, intervals); }, 500);
|
|
24
24
|
_this._contentListener[model.uri.toString()] = model.onDidChangeContent(function (e) {
|
|
25
25
|
var intervalsToValidate = changeEventToIntervals(e);
|
|
26
26
|
debouncedValidation(intervalsToValidate);
|
|
27
27
|
});
|
|
28
28
|
_this._configurationListener[model.uri.toString()] = _this.defaults.onDidChange(function () {
|
|
29
|
-
self.setTimeout(function () { return _this._doValidate(model,
|
|
29
|
+
self.setTimeout(function () { return _this._doValidate(model, languageId, []); }, 0);
|
|
30
30
|
});
|
|
31
31
|
_this._schemaListener[model.uri.toString()] = onSchemaChange(function () {
|
|
32
|
-
self.setTimeout(function () { return _this._doValidate(model,
|
|
32
|
+
self.setTimeout(function () { return _this._doValidate(model, languageId, []); }, 0);
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
var onModelRemoved = function (model) {
|
|
@@ -89,20 +89,21 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
89
89
|
}
|
|
90
90
|
var markers = diagnostics.map(function (d) { return toDiagnostics(resource, d); });
|
|
91
91
|
var model = _this._monacoInstance.editor.getModel(resource);
|
|
92
|
-
var oldDecorations = model
|
|
93
|
-
.
|
|
92
|
+
var oldDecorations = model
|
|
93
|
+
.getAllDecorations()
|
|
94
|
+
.filter(function (decoration) { return decoration.options.className == 'squiggly-error'; })
|
|
94
95
|
.map(function (decoration) { return decoration.id; });
|
|
95
|
-
if (model && model.
|
|
96
|
+
if (model && model.getLanguageId() === languageId) {
|
|
96
97
|
var syntaxErrorAsMarkDown = _this.defaults.languageSettings.syntaxErrorAsMarkDown;
|
|
97
98
|
if (!syntaxErrorAsMarkDown || !syntaxErrorAsMarkDown.enableSyntaxErrorAsMarkDown) {
|
|
98
|
-
// Remove previous syntax error decorations and set the new markers (for example, when disabling syntaxErrorAsMarkDown after it was enabled)
|
|
99
|
+
// Remove previous syntax error decorations and set the new markers (for example, when disabling syntaxErrorAsMarkDown after it was enabled)
|
|
99
100
|
model.deltaDecorations(oldDecorations, []);
|
|
100
101
|
_this._monacoInstance.editor.setModelMarkers(model, languageId, markers);
|
|
101
102
|
}
|
|
102
103
|
else {
|
|
103
104
|
// Add custom popup for syntax error: icon, header and message as markdown
|
|
104
|
-
var header = syntaxErrorAsMarkDown.header ? "**" + syntaxErrorAsMarkDown.header + "** \n\n" :
|
|
105
|
-
var icon = syntaxErrorAsMarkDown.icon ? "" :
|
|
105
|
+
var header = syntaxErrorAsMarkDown.header ? "**" + syntaxErrorAsMarkDown.header + "** \n\n" : '';
|
|
106
|
+
var icon = syntaxErrorAsMarkDown.icon ? "" : '';
|
|
106
107
|
var popupErrorHoverHeaderMessage_1 = icon + " " + header;
|
|
107
108
|
var newDecorations = markers.map(function (marker) {
|
|
108
109
|
return {
|
|
@@ -110,30 +111,31 @@ var DiagnosticsAdapter = /** @class */ (function () {
|
|
|
110
111
|
startLineNumber: marker.startLineNumber,
|
|
111
112
|
startColumn: marker.startColumn,
|
|
112
113
|
endLineNumber: marker.endLineNumber,
|
|
113
|
-
endColumn: marker.endColumn
|
|
114
|
+
endColumn: marker.endColumn,
|
|
114
115
|
},
|
|
115
116
|
options: {
|
|
116
117
|
hoverMessage: {
|
|
117
|
-
value: popupErrorHoverHeaderMessage_1 + marker.message
|
|
118
|
+
value: popupErrorHoverHeaderMessage_1 + marker.message,
|
|
118
119
|
},
|
|
119
|
-
className:
|
|
120
|
+
className: 'squiggly-error',
|
|
120
121
|
zIndex: 100,
|
|
121
122
|
overviewRuler: {
|
|
122
123
|
// The color indication on the right ruler
|
|
123
|
-
color:
|
|
124
|
-
position: monaco.editor.OverviewRulerLane.Right
|
|
124
|
+
color: 'rgb(255, 18, 18, 0.7)',
|
|
125
|
+
position: monaco.editor.OverviewRulerLane.Right,
|
|
125
126
|
},
|
|
126
127
|
minimap: {
|
|
127
|
-
color:
|
|
128
|
-
position: monaco.editor.MinimapPosition.Inline
|
|
129
|
-
}
|
|
130
|
-
}
|
|
128
|
+
color: 'rgb(255, 18, 18, 0.7)',
|
|
129
|
+
position: monaco.editor.MinimapPosition.Inline,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
131
132
|
};
|
|
132
133
|
});
|
|
133
|
-
var oldMarkers = monaco.editor
|
|
134
|
+
var oldMarkers = monaco.editor
|
|
135
|
+
.getModelMarkers({
|
|
134
136
|
owner: languageId,
|
|
135
|
-
resource: resource
|
|
136
|
-
})
|
|
137
|
+
resource: resource,
|
|
138
|
+
});
|
|
137
139
|
if (oldMarkers && oldMarkers.length > 0) {
|
|
138
140
|
// In case there were previous markers, remove their decorations (for example, when enabling syntaxErrorAsMarkDown after it was disabled)
|
|
139
141
|
oldDecorations = [];
|
|
@@ -280,11 +282,11 @@ var ColorizationAdapter = /** @class */ (function () {
|
|
|
280
282
|
this.decorations = [];
|
|
281
283
|
injectCss();
|
|
282
284
|
var onModelAdd = function (model) {
|
|
283
|
-
var
|
|
284
|
-
if (
|
|
285
|
+
var languageId = model.getLanguageId();
|
|
286
|
+
if (languageId !== _this._languageId) {
|
|
285
287
|
return;
|
|
286
288
|
}
|
|
287
|
-
var debouncedColorization = _.debounce(function (intervals) { return _this._doColorization(model,
|
|
289
|
+
var debouncedColorization = _.debounce(function (intervals) { return _this._doColorization(model, languageId, intervals); }, 500);
|
|
288
290
|
var handle;
|
|
289
291
|
_this._contentListener[model.uri.toString()] = model.onDidChangeContent(function (e) {
|
|
290
292
|
// Changes are represented as a range in doc before change, plus the text that it was replaced with.
|
|
@@ -294,10 +296,10 @@ var ColorizationAdapter = /** @class */ (function () {
|
|
|
294
296
|
debouncedColorization(intervalsToColorize);
|
|
295
297
|
});
|
|
296
298
|
_this._configurationListener[model.uri.toString()] = defaults.onDidChange(function () {
|
|
297
|
-
self.setTimeout(function () { return _this._doColorization(model,
|
|
299
|
+
self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
|
|
298
300
|
});
|
|
299
301
|
_this._schemaListener[model.uri.toString()] = onSchemaChange(function () {
|
|
300
|
-
self.setTimeout(function () { return _this._doColorization(model,
|
|
302
|
+
self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
|
|
301
303
|
});
|
|
302
304
|
};
|
|
303
305
|
var onModelRemoved = function (model) {
|
|
@@ -395,7 +397,7 @@ var ColorizationAdapter = /** @class */ (function () {
|
|
|
395
397
|
.reduce(function (prev, curr) { return prev.concat(curr); }, []);
|
|
396
398
|
// Flatten decoration groups to an array of decorations
|
|
397
399
|
var newDecorations = decorationRanges.reduce(function (prev, next) { return prev.concat(next.decorations); }, []);
|
|
398
|
-
if (model && model.
|
|
400
|
+
if (model && model.getLanguageId() === languageId) {
|
|
399
401
|
_this.decorations = model.deltaDecorations(oldDecorations, newDecorations);
|
|
400
402
|
}
|
|
401
403
|
})
|
|
@@ -553,8 +555,7 @@ var CompletionAdapter = /** @class */ (function () {
|
|
|
553
555
|
var wordInfo = model.getWordUntilPosition(position);
|
|
554
556
|
var wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
|
|
555
557
|
var resource = model.uri;
|
|
556
|
-
var onDidProvideCompletionItems = this.languageSettings
|
|
557
|
-
.onDidProvideCompletionItems;
|
|
558
|
+
var onDidProvideCompletionItems = this.languageSettings.onDidProvideCompletionItems;
|
|
558
559
|
return this._worker(resource)
|
|
559
560
|
.then(function (worker) {
|
|
560
561
|
return worker.doComplete(resource.toString(), fromPosition(position));
|
|
@@ -96,7 +96,6 @@ function toClassifiedRange(k2Classifications) {
|
|
|
96
96
|
kind: classification.Kind,
|
|
97
97
|
}); });
|
|
98
98
|
}
|
|
99
|
-
;
|
|
100
99
|
/**
|
|
101
100
|
* Kusto Language service translates the kusto object model (transpiled from C# by Bridge.Net)
|
|
102
101
|
* to the vscode language server types, which are used by vscode language extensions.
|
|
@@ -253,7 +252,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
253
252
|
this.__kustoJsSchemaV2 = this.convertToKustoJsSchemaV2(schema);
|
|
254
253
|
this._schema = schema;
|
|
255
254
|
this._clustersSetInGlobalState = new Set();
|
|
256
|
-
this._nonEmptyDatabaseSetInGlobalState = new Set(); // used to remove clusters that are already in the global state
|
|
255
|
+
this._nonEmptyDatabaseSetInGlobalState = new Set(); // used to remove clusters that are already in the global state
|
|
257
256
|
this.configure(languageSettings);
|
|
258
257
|
this._newlineAppendPipePolicy = new Kusto.Data.IntelliSense.ApplyPolicy();
|
|
259
258
|
this._newlineAppendPipePolicy.Text = '\n| ';
|
|
@@ -275,13 +274,14 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
275
274
|
this.__kustoJsSchemaV2 = globalState;
|
|
276
275
|
this._clustersSetInGlobalState.clear();
|
|
277
276
|
this._nonEmptyDatabaseSetInGlobalState.clear();
|
|
278
|
-
// create 2 Sets with cluster names and database names based on the updated Global State.
|
|
277
|
+
// create 2 Sets with cluster names and database names based on the updated Global State.
|
|
279
278
|
for (var i = 0; i < globalState.Clusters.Count; i++) {
|
|
280
279
|
var clusterSymbol = this._kustoJsSchemaV2.Clusters.getItem(i);
|
|
281
280
|
this._clustersSetInGlobalState.add(clusterSymbol.Name);
|
|
282
281
|
for (var i2 = 0; i2 < clusterSymbol.Databases.Count; i2++) {
|
|
283
282
|
var databaseSymbol = clusterSymbol.Databases.getItem(i2);
|
|
284
|
-
if (databaseSymbol.Tables.Count > 0) {
|
|
283
|
+
if (databaseSymbol.Tables.Count > 0) {
|
|
284
|
+
// only include database with tables
|
|
285
285
|
this._nonEmptyDatabaseSetInGlobalState.add(this.createDatabaseUniqueName(clusterSymbol.Name, databaseSymbol.Name));
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -360,7 +360,9 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
360
360
|
// as '\$0'
|
|
361
361
|
var _a = kItem.AfterText && kItem.AfterText.length > 0
|
|
362
362
|
? {
|
|
363
|
-
|
|
363
|
+
// Need to escape dollar sign since it is used as a placeholder in snippet.
|
|
364
|
+
// Usually dollar sign is not a valid character in a function name, but grafana uses macros that start with dollars.
|
|
365
|
+
textToInsert: kItem.EditText.replace('$', '\\$') + "$0" + kItem.AfterText,
|
|
364
366
|
format: ls.InsertTextFormat.Snippet,
|
|
365
367
|
}
|
|
366
368
|
: {
|
|
@@ -372,6 +374,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
372
374
|
var endPosition = document.positionAt(completionItems.EditStart + completionItems.EditLength);
|
|
373
375
|
lsItem.textEdit = ls.TextEdit.replace(ls.Range.create(startPosition, endPosition), textToInsert);
|
|
374
376
|
lsItem.sortText = _this.getSortText(i + 1);
|
|
377
|
+
// lsItem.filterText = lsItem.sortText;
|
|
375
378
|
lsItem.kind = _this.kustoKindToLsKindV2(kItem.Kind);
|
|
376
379
|
lsItem.insertTextFormat = format;
|
|
377
380
|
lsItem.detail = helpTopic ? helpTopic.ShortDescription : undefined;
|
|
@@ -511,7 +514,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
511
514
|
return Promise.resolve([]);
|
|
512
515
|
}
|
|
513
516
|
var newClustersReferences = [];
|
|
514
|
-
var newClustersReferencesSet = new Set(); // used to remove duplicates
|
|
517
|
+
var newClustersReferencesSet = new Set(); // used to remove duplicates
|
|
515
518
|
// Keep only unique clusters that aren't already exist in the Global State
|
|
516
519
|
for (var i = 0; i < clusterReferences.Count; i++) {
|
|
517
520
|
var clusterReference = clusterReferences.getItem(i);
|
|
@@ -521,7 +524,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
521
524
|
continue;
|
|
522
525
|
}
|
|
523
526
|
newClustersReferencesSet.add(clusterHostName);
|
|
524
|
-
// ignore references that are already in the GlobalState.
|
|
527
|
+
// ignore references that are already in the GlobalState.
|
|
525
528
|
if (!this._clustersSetInGlobalState.has(clusterHostName)) {
|
|
526
529
|
newClustersReferences.push({ clusterName: clusterHostName });
|
|
527
530
|
}
|
|
@@ -552,13 +555,13 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
552
555
|
if (!foundInGlobalState) {
|
|
553
556
|
newDatabasesReferences.push({
|
|
554
557
|
databaseName: databaseReference.Database,
|
|
555
|
-
clusterName: databaseReference.Cluster
|
|
558
|
+
clusterName: databaseReference.Cluster,
|
|
556
559
|
});
|
|
557
560
|
}
|
|
558
561
|
}
|
|
559
562
|
return Promise.resolve(newDatabasesReferences);
|
|
560
563
|
};
|
|
561
|
-
KustoLanguageService.prototype.doValidation = function (document, changeIntervals) {
|
|
564
|
+
KustoLanguageService.prototype.doValidation = function (document, changeIntervals, includeWarnings, includeSuggestions) {
|
|
562
565
|
var _this = this;
|
|
563
566
|
// didn't implement validation for v1.
|
|
564
567
|
if (!document || !this.isIntellisenseV2()) {
|
|
@@ -571,11 +574,23 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
571
574
|
}
|
|
572
575
|
var diagnostics = blocks
|
|
573
576
|
.map(function (block) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
+
// GetDiagnostics returns the errors in the block
|
|
578
|
+
var diagnostics = _this.toArray(block.Service.GetDiagnostics(false));
|
|
579
|
+
var enableWarnings = includeWarnings !== null && includeWarnings !== void 0 ? includeWarnings : _this._languageSettings.enableQueryWarnings;
|
|
580
|
+
var enableSuggestions = includeSuggestions !== null && includeSuggestions !== void 0 ? includeSuggestions : _this._languageSettings.enableQuerySuggestions;
|
|
581
|
+
if (enableWarnings || enableSuggestions) {
|
|
582
|
+
// Concat Warnings and suggestions to the diagnostics
|
|
583
|
+
var warningAndSuggestionDiagnostics = block.Service.GetAnalyzerDiagnostics(null, true);
|
|
584
|
+
var filterredDiagnostics = _this.toArray(warningAndSuggestionDiagnostics).filter(function (d) {
|
|
585
|
+
var _a;
|
|
586
|
+
var allowSeverity = (enableWarnings && d.Severity === 'Warning') ||
|
|
587
|
+
(enableSuggestions && d.Severity === 'Suggestion');
|
|
588
|
+
var allowCode = !((_a = _this._languageSettings.disabledDiagnoticCodes) === null || _a === void 0 ? void 0 : _a.includes(d.Code));
|
|
589
|
+
return allowSeverity && allowCode;
|
|
590
|
+
});
|
|
591
|
+
diagnostics = diagnostics.concat(filterredDiagnostics);
|
|
577
592
|
}
|
|
578
|
-
return
|
|
593
|
+
return diagnostics;
|
|
579
594
|
})
|
|
580
595
|
.reduce(function (prev, curr) { return prev.concat(curr); }, []);
|
|
581
596
|
var lsDiagnostics = this.toLsDiagnostics(diagnostics, document);
|
|
@@ -588,7 +603,18 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
588
603
|
var start = document.positionAt(diag.Start);
|
|
589
604
|
var end = document.positionAt(diag.Start + diag.Length);
|
|
590
605
|
var range = ls.Range.create(start, end);
|
|
591
|
-
|
|
606
|
+
var severity;
|
|
607
|
+
switch (diag.Severity) {
|
|
608
|
+
case 'Suggestion':
|
|
609
|
+
severity = ls.DiagnosticSeverity.Information;
|
|
610
|
+
break;
|
|
611
|
+
case 'Warning':
|
|
612
|
+
severity = ls.DiagnosticSeverity.Warning;
|
|
613
|
+
break;
|
|
614
|
+
default:
|
|
615
|
+
severity = ls.DiagnosticSeverity.Error;
|
|
616
|
+
}
|
|
617
|
+
return ls.Diagnostic.create(range, diag.Message, severity, diag.Code);
|
|
592
618
|
});
|
|
593
619
|
};
|
|
594
620
|
/**
|
|
@@ -711,8 +737,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
711
737
|
});
|
|
712
738
|
}
|
|
713
739
|
if (!cluster) {
|
|
714
|
-
var databaseSymbols = databaseNames
|
|
715
|
-
.map(function (databaseName) {
|
|
740
|
+
var databaseSymbols = databaseNames.map(function (databaseName) {
|
|
716
741
|
var symbol = new sym.DatabaseSymbol.$ctor1(databaseName, undefined, false);
|
|
717
742
|
return symbol;
|
|
718
743
|
});
|
|
@@ -788,16 +813,18 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
788
813
|
name: Name,
|
|
789
814
|
minorVersion: MinorVersion,
|
|
790
815
|
majorVersion: MajorVersion,
|
|
791
|
-
tables: [].concat.apply([], [
|
|
816
|
+
tables: [].concat.apply([], [
|
|
817
|
+
[Tables, 'Table'],
|
|
818
|
+
[MaterializedViews, 'MaterializedView'],
|
|
819
|
+
[ExternalTables, 'ExternalTable'],
|
|
820
|
+
]
|
|
792
821
|
.filter(function (_a) {
|
|
793
822
|
var tableContainer = _a[0];
|
|
794
823
|
return tableContainer;
|
|
795
824
|
})
|
|
796
825
|
.map(function (_a) {
|
|
797
826
|
var tableContainer = _a[0], tableEntity = _a[1];
|
|
798
|
-
return Object
|
|
799
|
-
.values(tableContainer)
|
|
800
|
-
.map(function (_a) {
|
|
827
|
+
return Object.values(tableContainer).map(function (_a) {
|
|
801
828
|
var Name = _a.Name, OrderedColumns = _a.OrderedColumns, DocString = _a.DocString;
|
|
802
829
|
return ({
|
|
803
830
|
name: Name,
|
|
@@ -1239,8 +1266,12 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1239
1266
|
if (!items) {
|
|
1240
1267
|
return Promise.resolve(undefined);
|
|
1241
1268
|
}
|
|
1242
|
-
// Errors are already shown in getDiagnostics. we don't want them in doHover.
|
|
1243
|
-
items = items.filter(function (item) {
|
|
1269
|
+
// Errors, Warnings and Suggestions are already shown in getDiagnostics. we don't want them in doHover.
|
|
1270
|
+
items = items.filter(function (item) {
|
|
1271
|
+
return item.Kind !== k2.QuickInfoKind.Error &&
|
|
1272
|
+
item.Kind !== k2.QuickInfoKind.Suggestion &&
|
|
1273
|
+
item.Kind !== k2.QuickInfoKind.Warning;
|
|
1274
|
+
});
|
|
1244
1275
|
var itemsText = items.map(function (item) { return item.Text.replace('\n\n', '\n* * *\n'); });
|
|
1245
1276
|
// separate items by horizontal line.
|
|
1246
1277
|
var text = itemsText.join('\n* * *\n');
|
|
@@ -59,6 +59,9 @@ var defaultLanguageSettings = {
|
|
|
59
59
|
syntaxErrorAsMarkDown: {
|
|
60
60
|
enableSyntaxErrorAsMarkDown: false,
|
|
61
61
|
},
|
|
62
|
+
enableQueryWarnings: false,
|
|
63
|
+
enableQuerySuggestions: false,
|
|
64
|
+
disabledDiagnoticCodes: [],
|
|
62
65
|
};
|
|
63
66
|
function getKustoWorker() {
|
|
64
67
|
return new Promise(function (resolve, reject) {
|
|
@@ -111,11 +114,7 @@ export function setupMonacoKusto(monacoInstance) {
|
|
|
111
114
|
{ token: 'annotation', foreground: '9400D3' },
|
|
112
115
|
{ token: 'invalid', background: 'cd3131' },
|
|
113
116
|
],
|
|
114
|
-
colors: {
|
|
115
|
-
// see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
|
|
116
|
-
'editorSuggestWidget.selectedBackground': '#93CFFB',
|
|
117
|
-
'editorSuggestWidget.background': '#FAF9F8',
|
|
118
|
-
},
|
|
117
|
+
colors: {},
|
|
119
118
|
});
|
|
120
119
|
monacoInstance.editor.defineTheme('kusto-dark', {
|
|
121
120
|
base: 'vs-dark',
|
|
@@ -139,9 +138,7 @@ export function setupMonacoKusto(monacoInstance) {
|
|
|
139
138
|
{ token: 'invalid', background: 'cd3131' },
|
|
140
139
|
],
|
|
141
140
|
colors: {
|
|
142
|
-
|
|
143
|
-
'editor.background': '#1B1A19',
|
|
144
|
-
'editorSuggestWidget.selectedBackground': '#004E8C',
|
|
141
|
+
// see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
|
|
145
142
|
},
|
|
146
143
|
});
|
|
147
144
|
monacoInstance.editor.defineTheme('kusto-dark2', {
|
package/release/esm/monaco.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ declare module monaco.languages.kusto {
|
|
|
23
23
|
onDidProvideCompletionItems?: monaco.languages.kusto.OnDidProvideCompletionItems;
|
|
24
24
|
enableHover?: boolean;
|
|
25
25
|
formatter?: FormatterOptions;
|
|
26
|
+
enableQueryWarnings?: boolean;
|
|
27
|
+
enableQuerySuggestions?: boolean;
|
|
28
|
+
disabledDiagnoticCodes?: string[];
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export interface SyntaxErrorAsMarkDownOptions {
|