@kusto/monaco-kusto 8.2.0 → 8.3.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 +16 -16
- package/release/dev/Kusto.Language.Bridge.min.js +1 -1
- package/release/dev/kusto.javascript.client.min.js +1 -1
- package/release/dev/kustoMode.js +21 -21
- package/release/dev/kustoWorker.js +23 -21
- package/release/dev/{main-f25d1ca7.js → main-e6ef956d.js} +168 -381
- package/release/dev/monaco.contribution.js +6 -9
- package/release/dev/{schema-8dc56616.js → schema-7d65ed04.js} +4 -4
- package/release/esm/commandFormatter.js +37 -0
- package/release/esm/commandHighlighter.js +52 -0
- package/release/esm/extendedEditor.js +41 -0
- package/release/esm/kusto.worker.js +2 -2
- package/release/esm/kustoMode.js +139 -1158
- package/release/esm/kustoWorker.js +252 -0
- package/release/esm/languageFeatures.js +1072 -0
- package/release/esm/languageService/kustoLanguageService.js +1923 -0
- package/release/esm/languageService/kustoMonarchLanguageDefinition.js +211 -0
- package/release/esm/languageService/renderInfo.js +1 -0
- package/release/esm/languageService/schema.js +64 -0
- package/release/esm/languageService/settings.js +1 -0
- package/release/esm/monaco.contribution.js +178 -426
- package/release/esm/{schema-1d41f705.js → schema-ee621489.js} +1 -2
- package/release/esm/types.js +1 -0
- package/release/esm/workerManager.js +102 -0
- package/release/min/Kusto.Language.Bridge.min.js +1 -1
- package/release/min/kusto.javascript.client.min.js +1 -1
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +2 -2
- package/release/min/main-04a9f035.js +7 -0
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-ef0ffe13.js → schema-095fdf5a.js} +2 -2
- package/release/min/main-c1317e01.js +0 -7
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import * as ls from 'vscode-languageserver-types';
|
|
2
|
+
import * as kustoService from './languageService/kustoLanguageService';
|
|
3
|
+
var KustoWorkerImpl = /** @class */ (function () {
|
|
4
|
+
function KustoWorkerImpl(ctx, createData) {
|
|
5
|
+
this._ctx = ctx;
|
|
6
|
+
this._languageSettings = createData.languageSettings;
|
|
7
|
+
this._languageService = kustoService.getKustoLanguageService();
|
|
8
|
+
this._languageService.configure(this._languageSettings);
|
|
9
|
+
}
|
|
10
|
+
// --- language service host ---------------
|
|
11
|
+
KustoWorkerImpl.prototype.setSchema = function (schema) {
|
|
12
|
+
return this._languageService.setSchema(schema);
|
|
13
|
+
};
|
|
14
|
+
KustoWorkerImpl.prototype.addClusterToSchema = function (uri, clusterName, databasesNames) {
|
|
15
|
+
var document = this._getTextDocument(uri);
|
|
16
|
+
if (!document) {
|
|
17
|
+
console.error("addClusterToSchema: document is ".concat(document, ". uri is ").concat(uri));
|
|
18
|
+
return Promise.resolve();
|
|
19
|
+
}
|
|
20
|
+
return this._languageService.addClusterToSchema(document, clusterName, databasesNames);
|
|
21
|
+
};
|
|
22
|
+
KustoWorkerImpl.prototype.addDatabaseToSchema = function (uri, clusterName, databaseSchema) {
|
|
23
|
+
var document = this._getTextDocument(uri);
|
|
24
|
+
if (!document) {
|
|
25
|
+
console.error("addDatabaseToSchema: document is ".concat(document, ". uri is ").concat(uri));
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
return this._languageService.addDatabaseToSchema(document, clusterName, databaseSchema);
|
|
29
|
+
};
|
|
30
|
+
KustoWorkerImpl.prototype.setSchemaFromShowSchema = function (schema, clusterConnectionString, databaseInContextName) {
|
|
31
|
+
return this._languageService.setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName);
|
|
32
|
+
};
|
|
33
|
+
KustoWorkerImpl.prototype.normalizeSchema = function (schema, clusterConnectionString, databaseInContextName) {
|
|
34
|
+
return this._languageService.normalizeSchema(schema, clusterConnectionString, databaseInContextName);
|
|
35
|
+
};
|
|
36
|
+
KustoWorkerImpl.prototype.getSchema = function () {
|
|
37
|
+
return this._languageService.getSchema();
|
|
38
|
+
};
|
|
39
|
+
KustoWorkerImpl.prototype.getCommandInContext = function (uri, cursorOffset) {
|
|
40
|
+
var document = this._getTextDocument(uri);
|
|
41
|
+
if (!document) {
|
|
42
|
+
console.error("getCommandInContext: document is ".concat(document, ". uri is ").concat(uri));
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
var commandInContext = this._languageService.getCommandInContext(document, cursorOffset);
|
|
46
|
+
if (commandInContext === undefined) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return commandInContext;
|
|
50
|
+
};
|
|
51
|
+
KustoWorkerImpl.prototype.getQueryParams = function (uri, cursorOffset) {
|
|
52
|
+
var document = this._getTextDocument(uri);
|
|
53
|
+
if (!document) {
|
|
54
|
+
console.error("getQueryParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
var queryParams = this._languageService.getQueryParams(document, cursorOffset);
|
|
58
|
+
if (queryParams === undefined) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return queryParams;
|
|
62
|
+
};
|
|
63
|
+
KustoWorkerImpl.prototype.getGlobalParams = function (uri) {
|
|
64
|
+
var document = this._getTextDocument(uri);
|
|
65
|
+
if (!document) {
|
|
66
|
+
console.error("getGLobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
var globalParams = this._languageService.getGlobalParams(document);
|
|
70
|
+
if (globalParams === undefined) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return globalParams;
|
|
74
|
+
};
|
|
75
|
+
KustoWorkerImpl.prototype.getReferencedSymbols = function (uri, cursorOffset) {
|
|
76
|
+
var document = this._getTextDocument(uri);
|
|
77
|
+
if (!document) {
|
|
78
|
+
console.error("getReferencedGlobalParams: document is ".concat(document, ". uri is ").concat(uri));
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
var referencedParams = this._languageService.getReferencedSymbols(document, cursorOffset);
|
|
82
|
+
if (referencedParams === undefined) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return referencedParams;
|
|
86
|
+
};
|
|
87
|
+
KustoWorkerImpl.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);
|
|
94
|
+
if (referencedParams === undefined) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return referencedParams;
|
|
98
|
+
};
|
|
99
|
+
KustoWorkerImpl.prototype.getRenderInfo = function (uri, cursorOffset) {
|
|
100
|
+
var document = this._getTextDocument(uri);
|
|
101
|
+
if (!document) {
|
|
102
|
+
console.error("getRenderInfo: document is ".concat(document, ". uri is ").concat(uri));
|
|
103
|
+
}
|
|
104
|
+
return this._languageService.getRenderInfo(document, cursorOffset).then(function (result) {
|
|
105
|
+
if (!result) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Get command in context and the command range.
|
|
113
|
+
* This method will basically convert generate microsoft language service interface to monaco interface.
|
|
114
|
+
* @param uri document URI
|
|
115
|
+
* @param cursorOffset offset from start of document to cursor
|
|
116
|
+
*/
|
|
117
|
+
KustoWorkerImpl.prototype.getCommandAndLocationInContext = function (uri, cursorOffset) {
|
|
118
|
+
var document = this._getTextDocument(uri);
|
|
119
|
+
if (!document) {
|
|
120
|
+
console.error("getCommandAndLocationInContext: document is ".concat(document, ". uri is ").concat(uri));
|
|
121
|
+
return Promise.resolve(null);
|
|
122
|
+
}
|
|
123
|
+
return this._languageService.getCommandAndLocationInContext(document, cursorOffset).then(function (result) {
|
|
124
|
+
if (!result) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
// convert to monaco object.
|
|
128
|
+
var text = result.text, _a = result.location.range, start = _a.start, end = _a.end;
|
|
129
|
+
return {
|
|
130
|
+
range: {
|
|
131
|
+
startLineNumber: start.line + 1,
|
|
132
|
+
startColumn: start.character + 1,
|
|
133
|
+
endLineNumber: end.line + 1,
|
|
134
|
+
endColumn: end.character + 1,
|
|
135
|
+
},
|
|
136
|
+
text: text,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
KustoWorkerImpl.prototype.getCommandsInDocument = function (uri) {
|
|
141
|
+
var document = this._getTextDocument(uri);
|
|
142
|
+
if (!document) {
|
|
143
|
+
console.error("getCommandInDocument: document is ".concat(document, ". uri is ").concat(uri));
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
return this._languageService.getCommandsInDocument(document);
|
|
147
|
+
};
|
|
148
|
+
KustoWorkerImpl.prototype.doComplete = function (uri, position) {
|
|
149
|
+
var document = this._getTextDocument(uri);
|
|
150
|
+
if (!document) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
var completions = this._languageService.doComplete(document, position);
|
|
154
|
+
return completions;
|
|
155
|
+
};
|
|
156
|
+
KustoWorkerImpl.prototype.doValidation = function (uri, intervals, includeWarnings, includeSuggestions) {
|
|
157
|
+
var document = this._getTextDocument(uri);
|
|
158
|
+
var diagnostics = this._languageService.doValidation(document, intervals, includeWarnings, includeSuggestions);
|
|
159
|
+
return diagnostics;
|
|
160
|
+
};
|
|
161
|
+
KustoWorkerImpl.prototype.getResultActions = function (uri, start, end) {
|
|
162
|
+
var document = this._getTextDocument(uri);
|
|
163
|
+
return this._languageService.getResultActions(document, start, end);
|
|
164
|
+
};
|
|
165
|
+
KustoWorkerImpl.prototype.doRangeFormat = function (uri, range) {
|
|
166
|
+
var document = this._getTextDocument(uri);
|
|
167
|
+
var formatted = this._languageService.doRangeFormat(document, range);
|
|
168
|
+
return formatted;
|
|
169
|
+
};
|
|
170
|
+
KustoWorkerImpl.prototype.doFolding = function (uri) {
|
|
171
|
+
var document = this._getTextDocument(uri);
|
|
172
|
+
var folding = this._languageService.doFolding(document);
|
|
173
|
+
return folding;
|
|
174
|
+
};
|
|
175
|
+
KustoWorkerImpl.prototype.doDocumentFormat = function (uri) {
|
|
176
|
+
var document = this._getTextDocument(uri);
|
|
177
|
+
var formatted = this._languageService.doDocumentFormat(document);
|
|
178
|
+
return formatted;
|
|
179
|
+
};
|
|
180
|
+
KustoWorkerImpl.prototype.doCurrentCommandFormat = function (uri, caretPosition) {
|
|
181
|
+
var document = this._getTextDocument(uri);
|
|
182
|
+
var formatted = this._languageService.doCurrentCommandFormat(document, caretPosition);
|
|
183
|
+
return formatted;
|
|
184
|
+
};
|
|
185
|
+
// Colorize document. if offsets provided, will only colorize commands at these offsets. otherwise - will color the entire document.
|
|
186
|
+
KustoWorkerImpl.prototype.doColorization = function (uri, colorizationIntervals) {
|
|
187
|
+
var document = this._getTextDocument(uri);
|
|
188
|
+
var colorizationInfo = this._languageService.doColorization(document, colorizationIntervals);
|
|
189
|
+
return colorizationInfo;
|
|
190
|
+
};
|
|
191
|
+
KustoWorkerImpl.prototype.getClientDirective = function (text) {
|
|
192
|
+
return this._languageService.getClientDirective(text);
|
|
193
|
+
};
|
|
194
|
+
KustoWorkerImpl.prototype.getAdminCommand = function (text) {
|
|
195
|
+
return this._languageService.getAdminCommand(text);
|
|
196
|
+
};
|
|
197
|
+
KustoWorkerImpl.prototype.findDefinition = function (uri, position) {
|
|
198
|
+
var document = this._getTextDocument(uri);
|
|
199
|
+
var definition = this._languageService.findDefinition(document, position);
|
|
200
|
+
return definition;
|
|
201
|
+
};
|
|
202
|
+
KustoWorkerImpl.prototype.findReferences = function (uri, position) {
|
|
203
|
+
var document = this._getTextDocument(uri);
|
|
204
|
+
var references = this._languageService.findReferences(document, position);
|
|
205
|
+
return references;
|
|
206
|
+
};
|
|
207
|
+
KustoWorkerImpl.prototype.doRename = function (uri, position, newName) {
|
|
208
|
+
var document = this._getTextDocument(uri);
|
|
209
|
+
var workspaceEdit = this._languageService.doRename(document, position, newName);
|
|
210
|
+
return workspaceEdit;
|
|
211
|
+
};
|
|
212
|
+
KustoWorkerImpl.prototype.doHover = function (uri, position) {
|
|
213
|
+
var document = this._getTextDocument(uri);
|
|
214
|
+
var hover = this._languageService.doHover(document, position);
|
|
215
|
+
return hover;
|
|
216
|
+
};
|
|
217
|
+
KustoWorkerImpl.prototype.setParameters = function (scalarParameters, tabularParameters) {
|
|
218
|
+
return this._languageService.setParameters(scalarParameters, tabularParameters);
|
|
219
|
+
};
|
|
220
|
+
KustoWorkerImpl.prototype.getClusterReferences = function (uri, cursorOffset) {
|
|
221
|
+
var document = this._getTextDocument(uri);
|
|
222
|
+
if (!document) {
|
|
223
|
+
return Promise.resolve(null);
|
|
224
|
+
}
|
|
225
|
+
return this._languageService.getClusterReferences(document, cursorOffset);
|
|
226
|
+
};
|
|
227
|
+
KustoWorkerImpl.prototype.getDatabaseReferences = function (uri, cursorOffset) {
|
|
228
|
+
var document = this._getTextDocument(uri);
|
|
229
|
+
if (!document) {
|
|
230
|
+
return Promise.resolve(null);
|
|
231
|
+
}
|
|
232
|
+
return this._languageService.getDatabaseReferences(document, cursorOffset);
|
|
233
|
+
};
|
|
234
|
+
KustoWorkerImpl.prototype._getTextDocument = function (uri) {
|
|
235
|
+
var models = this._ctx.getMirrorModels();
|
|
236
|
+
for (var _i = 0, models_1 = models; _i < models_1.length; _i++) {
|
|
237
|
+
var model = models_1[_i];
|
|
238
|
+
if (model.uri.toString() === uri) {
|
|
239
|
+
return ls.TextDocument.create(uri, this._languageId, model.version, model.getValue());
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
};
|
|
244
|
+
return KustoWorkerImpl;
|
|
245
|
+
}());
|
|
246
|
+
export { KustoWorkerImpl };
|
|
247
|
+
/**
|
|
248
|
+
* Used when monaco-editor is resolved via amd modules
|
|
249
|
+
*/
|
|
250
|
+
export function create(ctx, createData) {
|
|
251
|
+
return new KustoWorkerImpl(ctx, createData);
|
|
252
|
+
}
|