@kusto/monaco-kusto 4.1.7 → 5.1.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 +6 -6
- package/release/dev/kustoMode.js +1953 -1570
- package/release/dev/kustoWorker.js +1966 -1560
- package/release/dev/monaco.contribution.js +27 -28
- 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 +45 -21
- package/release/esm/monaco.contribution.js +13 -20
- 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
|
}
|
|
@@ -372,6 +372,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
372
372
|
var endPosition = document.positionAt(completionItems.EditStart + completionItems.EditLength);
|
|
373
373
|
lsItem.textEdit = ls.TextEdit.replace(ls.Range.create(startPosition, endPosition), textToInsert);
|
|
374
374
|
lsItem.sortText = _this.getSortText(i + 1);
|
|
375
|
+
// lsItem.filterText = lsItem.sortText;
|
|
375
376
|
lsItem.kind = _this.kustoKindToLsKindV2(kItem.Kind);
|
|
376
377
|
lsItem.insertTextFormat = format;
|
|
377
378
|
lsItem.detail = helpTopic ? helpTopic.ShortDescription : undefined;
|
|
@@ -511,7 +512,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
511
512
|
return Promise.resolve([]);
|
|
512
513
|
}
|
|
513
514
|
var newClustersReferences = [];
|
|
514
|
-
var newClustersReferencesSet = new Set(); // used to remove duplicates
|
|
515
|
+
var newClustersReferencesSet = new Set(); // used to remove duplicates
|
|
515
516
|
// Keep only unique clusters that aren't already exist in the Global State
|
|
516
517
|
for (var i = 0; i < clusterReferences.Count; i++) {
|
|
517
518
|
var clusterReference = clusterReferences.getItem(i);
|
|
@@ -521,7 +522,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
521
522
|
continue;
|
|
522
523
|
}
|
|
523
524
|
newClustersReferencesSet.add(clusterHostName);
|
|
524
|
-
// ignore references that are already in the GlobalState.
|
|
525
|
+
// ignore references that are already in the GlobalState.
|
|
525
526
|
if (!this._clustersSetInGlobalState.has(clusterHostName)) {
|
|
526
527
|
newClustersReferences.push({ clusterName: clusterHostName });
|
|
527
528
|
}
|
|
@@ -552,13 +553,13 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
552
553
|
if (!foundInGlobalState) {
|
|
553
554
|
newDatabasesReferences.push({
|
|
554
555
|
databaseName: databaseReference.Database,
|
|
555
|
-
clusterName: databaseReference.Cluster
|
|
556
|
+
clusterName: databaseReference.Cluster,
|
|
556
557
|
});
|
|
557
558
|
}
|
|
558
559
|
}
|
|
559
560
|
return Promise.resolve(newDatabasesReferences);
|
|
560
561
|
};
|
|
561
|
-
KustoLanguageService.prototype.doValidation = function (document, changeIntervals) {
|
|
562
|
+
KustoLanguageService.prototype.doValidation = function (document, changeIntervals, includeWarnings, includeSuggestions) {
|
|
562
563
|
var _this = this;
|
|
563
564
|
// didn't implement validation for v1.
|
|
564
565
|
if (!document || !this.isIntellisenseV2()) {
|
|
@@ -571,11 +572,22 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
571
572
|
}
|
|
572
573
|
var diagnostics = blocks
|
|
573
574
|
.map(function (block) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
575
|
+
// GetDiagnostics returns the errors in the block
|
|
576
|
+
var diagnostics = _this.toArray(block.Service.GetDiagnostics(false));
|
|
577
|
+
var enableWarnings = includeWarnings !== null && includeWarnings !== void 0 ? includeWarnings : _this._languageSettings.enableQueryWarnings;
|
|
578
|
+
var enableSuggestions = includeSuggestions !== null && includeSuggestions !== void 0 ? includeSuggestions : _this._languageSettings.enableQuerySuggestions;
|
|
579
|
+
if (enableWarnings || enableSuggestions) {
|
|
580
|
+
// Concat Warnings and suggestions to the diagnostics
|
|
581
|
+
var warningAndSuggestionDiagnostics = block.Service.GetAnalyzerDiagnostics(null, true);
|
|
582
|
+
var filterredDiagnostics = _this.toArray(warningAndSuggestionDiagnostics).filter(function (d) {
|
|
583
|
+
var _a;
|
|
584
|
+
var allowSeverity = (enableWarnings && d.Severity === 'Warning') || (enableSuggestions && d.Severity === 'Suggestion');
|
|
585
|
+
var allowCode = !((_a = _this._languageSettings.disabledDiagnoticCodes) === null || _a === void 0 ? void 0 : _a.includes(d.Code));
|
|
586
|
+
return allowSeverity && allowCode;
|
|
587
|
+
});
|
|
588
|
+
diagnostics = diagnostics.concat(filterredDiagnostics);
|
|
577
589
|
}
|
|
578
|
-
return
|
|
590
|
+
return diagnostics;
|
|
579
591
|
})
|
|
580
592
|
.reduce(function (prev, curr) { return prev.concat(curr); }, []);
|
|
581
593
|
var lsDiagnostics = this.toLsDiagnostics(diagnostics, document);
|
|
@@ -588,7 +600,18 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
588
600
|
var start = document.positionAt(diag.Start);
|
|
589
601
|
var end = document.positionAt(diag.Start + diag.Length);
|
|
590
602
|
var range = ls.Range.create(start, end);
|
|
591
|
-
|
|
603
|
+
var severity;
|
|
604
|
+
switch (diag.Severity) {
|
|
605
|
+
case 'Suggestion':
|
|
606
|
+
severity = ls.DiagnosticSeverity.Information;
|
|
607
|
+
break;
|
|
608
|
+
case 'Warning':
|
|
609
|
+
severity = ls.DiagnosticSeverity.Warning;
|
|
610
|
+
break;
|
|
611
|
+
default:
|
|
612
|
+
severity = ls.DiagnosticSeverity.Error;
|
|
613
|
+
}
|
|
614
|
+
return ls.Diagnostic.create(range, diag.Message, severity, diag.Code);
|
|
592
615
|
});
|
|
593
616
|
};
|
|
594
617
|
/**
|
|
@@ -711,8 +734,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
711
734
|
});
|
|
712
735
|
}
|
|
713
736
|
if (!cluster) {
|
|
714
|
-
var databaseSymbols = databaseNames
|
|
715
|
-
.map(function (databaseName) {
|
|
737
|
+
var databaseSymbols = databaseNames.map(function (databaseName) {
|
|
716
738
|
var symbol = new sym.DatabaseSymbol.$ctor1(databaseName, undefined, false);
|
|
717
739
|
return symbol;
|
|
718
740
|
});
|
|
@@ -788,16 +810,18 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
788
810
|
name: Name,
|
|
789
811
|
minorVersion: MinorVersion,
|
|
790
812
|
majorVersion: MajorVersion,
|
|
791
|
-
tables: [].concat.apply([], [
|
|
813
|
+
tables: [].concat.apply([], [
|
|
814
|
+
[Tables, 'Table'],
|
|
815
|
+
[MaterializedViews, 'MaterializedView'],
|
|
816
|
+
[ExternalTables, 'ExternalTable'],
|
|
817
|
+
]
|
|
792
818
|
.filter(function (_a) {
|
|
793
819
|
var tableContainer = _a[0];
|
|
794
820
|
return tableContainer;
|
|
795
821
|
})
|
|
796
822
|
.map(function (_a) {
|
|
797
823
|
var tableContainer = _a[0], tableEntity = _a[1];
|
|
798
|
-
return Object
|
|
799
|
-
.values(tableContainer)
|
|
800
|
-
.map(function (_a) {
|
|
824
|
+
return Object.values(tableContainer).map(function (_a) {
|
|
801
825
|
var Name = _a.Name, OrderedColumns = _a.OrderedColumns, DocString = _a.DocString;
|
|
802
826
|
return ({
|
|
803
827
|
name: Name,
|
|
@@ -1239,8 +1263,8 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1239
1263
|
if (!items) {
|
|
1240
1264
|
return Promise.resolve(undefined);
|
|
1241
1265
|
}
|
|
1242
|
-
// Errors are already shown in getDiagnostics. we don't want them in doHover.
|
|
1243
|
-
items = items.filter(function (item) { return item.Kind !== k2.QuickInfoKind.Error; });
|
|
1266
|
+
// Errors, Warnings and Suggestions are already shown in getDiagnostics. we don't want them in doHover.
|
|
1267
|
+
items = items.filter(function (item) { return item.Kind !== k2.QuickInfoKind.Error && item.Kind !== k2.QuickInfoKind.Suggestion && item.Kind !== k2.QuickInfoKind.Warning; });
|
|
1244
1268
|
var itemsText = items.map(function (item) { return item.Text.replace('\n\n', '\n* * *\n'); });
|
|
1245
1269
|
// separate items by horizontal line.
|
|
1246
1270
|
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', {
|
|
@@ -171,22 +168,18 @@ export function setupMonacoKusto(monacoInstance) {
|
|
|
171
168
|
if (kustoDefaults &&
|
|
172
169
|
kustoDefaults.languageSettings &&
|
|
173
170
|
kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
|
|
174
|
-
var didAcceptSuggestion = event.source === '
|
|
175
|
-
event.reason === monaco.editor.CursorChangeReason.RecoverFromMarkers;
|
|
171
|
+
var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
|
|
176
172
|
if (!didAcceptSuggestion) {
|
|
177
173
|
return;
|
|
178
174
|
}
|
|
179
175
|
event.selection;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// this is the best we have.
|
|
188
|
-
setTimeout(function () { return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}); }, 10);
|
|
189
|
-
}
|
|
176
|
+
// OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
|
|
177
|
+
// the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
|
|
178
|
+
// The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
|
|
179
|
+
// the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
|
|
180
|
+
// the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
|
|
181
|
+
// this is the best we have.
|
|
182
|
+
setTimeout(function () { return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}); }, 10);
|
|
190
183
|
}
|
|
191
184
|
});
|
|
192
185
|
}
|
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 {
|