@kusto/monaco-kusto 4.1.8 → 5.0.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 +1954 -1570
- package/release/dev/kustoWorker.js +1936 -1552
- package/release/dev/monaco.contribution.js +16 -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 +33 -31
- package/release/esm/languageService/kustoLanguageService.js +15 -13
- package/release/esm/monaco.contribution.js +2 -8
- package/release/min/kustoMode.js +3 -3
- package/release/min/kustoWorker.js +6 -6
- package/release/min/monaco.contribution.js +2 -2
|
@@ -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,32 @@ 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
|
+
})
|
|
139
|
+
.filter(function (marker) { return marker.severity == monaco.MarkerSeverity.Error; });
|
|
137
140
|
if (oldMarkers && oldMarkers.length > 0) {
|
|
138
141
|
// In case there were previous markers, remove their decorations (for example, when enabling syntaxErrorAsMarkDown after it was disabled)
|
|
139
142
|
oldDecorations = [];
|
|
@@ -280,11 +283,11 @@ var ColorizationAdapter = /** @class */ (function () {
|
|
|
280
283
|
this.decorations = [];
|
|
281
284
|
injectCss();
|
|
282
285
|
var onModelAdd = function (model) {
|
|
283
|
-
var
|
|
284
|
-
if (
|
|
286
|
+
var languageId = model.getLanguageId();
|
|
287
|
+
if (languageId !== _this._languageId) {
|
|
285
288
|
return;
|
|
286
289
|
}
|
|
287
|
-
var debouncedColorization = _.debounce(function (intervals) { return _this._doColorization(model,
|
|
290
|
+
var debouncedColorization = _.debounce(function (intervals) { return _this._doColorization(model, languageId, intervals); }, 500);
|
|
288
291
|
var handle;
|
|
289
292
|
_this._contentListener[model.uri.toString()] = model.onDidChangeContent(function (e) {
|
|
290
293
|
// Changes are represented as a range in doc before change, plus the text that it was replaced with.
|
|
@@ -294,10 +297,10 @@ var ColorizationAdapter = /** @class */ (function () {
|
|
|
294
297
|
debouncedColorization(intervalsToColorize);
|
|
295
298
|
});
|
|
296
299
|
_this._configurationListener[model.uri.toString()] = defaults.onDidChange(function () {
|
|
297
|
-
self.setTimeout(function () { return _this._doColorization(model,
|
|
300
|
+
self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
|
|
298
301
|
});
|
|
299
302
|
_this._schemaListener[model.uri.toString()] = onSchemaChange(function () {
|
|
300
|
-
self.setTimeout(function () { return _this._doColorization(model,
|
|
303
|
+
self.setTimeout(function () { return _this._doColorization(model, languageId, []); }, 0);
|
|
301
304
|
});
|
|
302
305
|
};
|
|
303
306
|
var onModelRemoved = function (model) {
|
|
@@ -395,7 +398,7 @@ var ColorizationAdapter = /** @class */ (function () {
|
|
|
395
398
|
.reduce(function (prev, curr) { return prev.concat(curr); }, []);
|
|
396
399
|
// Flatten decoration groups to an array of decorations
|
|
397
400
|
var newDecorations = decorationRanges.reduce(function (prev, next) { return prev.concat(next.decorations); }, []);
|
|
398
|
-
if (model && model.
|
|
401
|
+
if (model && model.getLanguageId() === languageId) {
|
|
399
402
|
_this.decorations = model.deltaDecorations(oldDecorations, newDecorations);
|
|
400
403
|
}
|
|
401
404
|
})
|
|
@@ -553,8 +556,7 @@ var CompletionAdapter = /** @class */ (function () {
|
|
|
553
556
|
var wordInfo = model.getWordUntilPosition(position);
|
|
554
557
|
var wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
|
|
555
558
|
var resource = model.uri;
|
|
556
|
-
var onDidProvideCompletionItems = this.languageSettings
|
|
557
|
-
.onDidProvideCompletionItems;
|
|
559
|
+
var onDidProvideCompletionItems = this.languageSettings.onDidProvideCompletionItems;
|
|
558
560
|
return this._worker(resource)
|
|
559
561
|
.then(function (worker) {
|
|
560
562
|
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,7 +553,7 @@ 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
|
}
|
|
@@ -711,8 +712,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
711
712
|
});
|
|
712
713
|
}
|
|
713
714
|
if (!cluster) {
|
|
714
|
-
var databaseSymbols = databaseNames
|
|
715
|
-
.map(function (databaseName) {
|
|
715
|
+
var databaseSymbols = databaseNames.map(function (databaseName) {
|
|
716
716
|
var symbol = new sym.DatabaseSymbol.$ctor1(databaseName, undefined, false);
|
|
717
717
|
return symbol;
|
|
718
718
|
});
|
|
@@ -788,16 +788,18 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
788
788
|
name: Name,
|
|
789
789
|
minorVersion: MinorVersion,
|
|
790
790
|
majorVersion: MajorVersion,
|
|
791
|
-
tables: [].concat.apply([], [
|
|
791
|
+
tables: [].concat.apply([], [
|
|
792
|
+
[Tables, 'Table'],
|
|
793
|
+
[MaterializedViews, 'MaterializedView'],
|
|
794
|
+
[ExternalTables, 'ExternalTable'],
|
|
795
|
+
]
|
|
792
796
|
.filter(function (_a) {
|
|
793
797
|
var tableContainer = _a[0];
|
|
794
798
|
return tableContainer;
|
|
795
799
|
})
|
|
796
800
|
.map(function (_a) {
|
|
797
801
|
var tableContainer = _a[0], tableEntity = _a[1];
|
|
798
|
-
return Object
|
|
799
|
-
.values(tableContainer)
|
|
800
|
-
.map(function (_a) {
|
|
802
|
+
return Object.values(tableContainer).map(function (_a) {
|
|
801
803
|
var Name = _a.Name, OrderedColumns = _a.OrderedColumns, DocString = _a.DocString;
|
|
802
804
|
return ({
|
|
803
805
|
name: Name,
|
|
@@ -111,11 +111,7 @@ export function setupMonacoKusto(monacoInstance) {
|
|
|
111
111
|
{ token: 'annotation', foreground: '9400D3' },
|
|
112
112
|
{ token: 'invalid', background: 'cd3131' },
|
|
113
113
|
],
|
|
114
|
-
colors: {
|
|
115
|
-
// see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
|
|
116
|
-
'editorSuggestWidget.selectedBackground': '#93CFFB',
|
|
117
|
-
'editorSuggestWidget.background': '#FAF9F8',
|
|
118
|
-
},
|
|
114
|
+
colors: {},
|
|
119
115
|
});
|
|
120
116
|
monacoInstance.editor.defineTheme('kusto-dark', {
|
|
121
117
|
base: 'vs-dark',
|
|
@@ -139,9 +135,7 @@ export function setupMonacoKusto(monacoInstance) {
|
|
|
139
135
|
{ token: 'invalid', background: 'cd3131' },
|
|
140
136
|
],
|
|
141
137
|
colors: {
|
|
142
|
-
|
|
143
|
-
'editor.background': '#1B1A19',
|
|
144
|
-
'editorSuggestWidget.selectedBackground': '#004E8C',
|
|
138
|
+
// see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
|
|
145
139
|
},
|
|
146
140
|
});
|
|
147
141
|
monacoInstance.editor.defineTheme('kusto-dark2', {
|