@kusto/monaco-kusto 12.0.0 → 12.0.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/README.md +6 -0
- package/package.json +1 -1
- package/release/dev/kustoMode-d3f9e09a.js +1818 -0
- package/release/dev/kustoMode.js +4 -1757
- package/release/dev/kustoWorker.js +2 -2
- package/release/dev/{main-b690e47e.js → main-f36cb42f.js} +2 -2
- package/release/dev/monaco.contribution.js +72 -66
- package/release/dev/{schema-957f5e9b.js → schema-077630e6.js} +2 -2
- package/release/esm/kusto.worker.js +2 -2
- package/release/esm/kustoMode-349f5467.js +957 -0
- package/release/esm/kustoMode.d.ts +4 -8
- package/release/esm/kustoMode.js +91 -111
- package/release/esm/languageFeatures.d.ts +1 -1
- package/release/esm/languageServiceManager/schema.d.ts +2 -2
- package/release/esm/monaco.contribution.js +42 -9
- package/release/esm/{schema-66580db4.js → schema-b8f0ba9b.js} +1 -1
- package/release/esm/syntaxHighlighting/SemanticTokensProvider.d.ts +1 -1
- package/release/esm/syntaxHighlighting/SemanticTokensProvider.js +3 -3
- package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.d.ts +6 -0
- package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.js +23 -0
- package/release/min/kustoMode-2dd4a01e.js +7 -0
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +2 -2
- package/release/min/{main-13659fc4.js → main-86d6c837.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-ab3cbb28.js → schema-a60c216c.js} +2 -2
- package/release/dev/globals-0aacfe72.js +0 -46
- package/release/esm/globals-88d92b64.js +0 -40
- package/release/min/globals-cce7b304.js +0 -7
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { KustoWorker, LanguageServiceDefaults } from './monaco.contribution';
|
|
3
|
+
import { IKustoWorkerImpl } from './kustoWorker';
|
|
4
4
|
export interface AugmentedWorker extends KustoWorker, Omit<IKustoWorkerImpl, 'setSchemaFromShowSchema' | 'getReferencedSymbols'> {
|
|
5
5
|
}
|
|
6
6
|
export interface AugmentedWorkerAccessor {
|
|
7
|
-
(first: monaco.Uri
|
|
7
|
+
(first: monaco.Uri): Promise<AugmentedWorker>;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
* Called when Kusto language is first needed (a model has the language set)
|
|
11
|
-
* @param defaults
|
|
12
|
-
*/
|
|
13
|
-
export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): AugmentedWorkerAccessor;
|
|
9
|
+
export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof monaco): Promise<AugmentedWorkerAccessor>;
|
|
14
10
|
export declare function getKustoWorker(): Promise<AugmentedWorkerAccessor>;
|
package/release/esm/kustoMode.js
CHANGED
|
@@ -48,124 +48,104 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
49
49
|
import { WorkerManager } from './workerManager';
|
|
50
50
|
import * as languageFeatures from './languageFeatures';
|
|
51
|
-
import { SemanticTokensProvider } from './syntaxHighlighting/SemanticTokensProvider';
|
|
52
|
-
import { kustoLanguageDefinition } from './syntaxHighlighting/kustoMonarchLanguageDefinition';
|
|
53
51
|
import { LANGUAGE_ID } from './globals';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
var workerPromise = new Promise(function (resolve, reject) {
|
|
58
|
-
resolveWorker = resolve;
|
|
59
|
-
rejectWorker = reject;
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Called when Kusto language is first needed (a model has the language set)
|
|
63
|
-
* @param defaults
|
|
64
|
-
*/
|
|
52
|
+
import { semanticTokensProviderRegistrarCreator } from './syntaxHighlighting/semanticTokensProviderRegistrar';
|
|
53
|
+
import { kustoLanguageDefinition } from './syntaxHighlighting/kustoMonarchLanguageDefinition';
|
|
54
|
+
var workerAccessor;
|
|
65
55
|
export function setupMode(defaults, monacoInstance) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
}); };
|
|
92
|
-
var worker = client.getLanguageServiceWorker.apply(client, [first].concat(more));
|
|
93
|
-
return worker.then(function (worker) { return (__assign(__assign({}, worker), { setSchema: function (schema) { return augmentedSetSchema(schema, worker); }, setSchemaFromShowSchema: function (schema, connection, database, globalScalarParameters, globalTabularParameters) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
return __generator(this, function (_a) {
|
|
96
|
-
switch (_a.label) {
|
|
97
|
-
case 0: return [4 /*yield*/, worker.normalizeSchema(schema, connection, database).then(function (schema) {
|
|
98
|
-
if (globalScalarParameters || globalTabularParameters) {
|
|
99
|
-
schema = __assign(__assign({}, schema), { globalScalarParameters: globalScalarParameters, globalTabularParameters: globalTabularParameters });
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var onSchemaChange, client, semanticTokensProviderRegistrar, completionAdapter, documentRangeFormattingAdapter, foldingRangeAdapter, definitionProvider, referenceProvider, hoverAdapter, documentFormattingAdapter, languageConfiguration;
|
|
58
|
+
var _this = this;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
onSchemaChange = new monaco.Emitter();
|
|
61
|
+
client = new WorkerManager(monacoInstance, defaults);
|
|
62
|
+
semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreator();
|
|
63
|
+
workerAccessor = function (uri) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
var worker, augmentedSetSchema, setSchemaFromShowSchema;
|
|
65
|
+
var _this = this;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0: return [4 /*yield*/, client.getLanguageServiceWorker(uri)];
|
|
69
|
+
case 1:
|
|
70
|
+
worker = _a.sent();
|
|
71
|
+
augmentedSetSchema = function (schema) { return __awaiter(_this, void 0, void 0, function () {
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, worker.setSchema(schema)];
|
|
75
|
+
case 1:
|
|
76
|
+
_a.sent();
|
|
77
|
+
onSchemaChange.fire(schema);
|
|
78
|
+
semanticTokensProviderRegistrar(monacoInstance, worker);
|
|
79
|
+
return [2 /*return*/];
|
|
100
80
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
81
|
+
});
|
|
82
|
+
}); };
|
|
83
|
+
setSchemaFromShowSchema = function (schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters) { return __awaiter(_this, void 0, void 0, function () {
|
|
84
|
+
var normalizedSchema;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0: return [4 /*yield*/, worker.normalizeSchema(schema, clusterConnectionString, databaseInContextName)];
|
|
88
|
+
case 1:
|
|
89
|
+
normalizedSchema = _a.sent();
|
|
90
|
+
normalizedSchema.globalScalarParameters = globalScalarParameters;
|
|
91
|
+
normalizedSchema.globalTabularParameters = globalTabularParameters;
|
|
92
|
+
return [4 /*yield*/, augmentedSetSchema(normalizedSchema)];
|
|
93
|
+
case 2:
|
|
94
|
+
_a.sent();
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); };
|
|
99
|
+
return [2 /*return*/, __assign(__assign({}, worker), { setSchema: augmentedSetSchema, setSchemaFromShowSchema: setSchemaFromShowSchema })];
|
|
100
|
+
}
|
|
108
101
|
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
102
|
+
}); };
|
|
103
|
+
monacoInstance.languages.setMonarchTokensProvider(LANGUAGE_ID, kustoLanguageDefinition);
|
|
104
|
+
completionAdapter = new languageFeatures.CompletionAdapter(workerAccessor, defaults.languageSettings);
|
|
105
|
+
monacoInstance.languages.registerCompletionItemProvider(LANGUAGE_ID, completionAdapter);
|
|
106
|
+
// this constructor has side effects and therefore doesn't need to be passed anywhere
|
|
107
|
+
new languageFeatures.DiagnosticsAdapter(monacoInstance, LANGUAGE_ID, workerAccessor, defaults, onSchemaChange.event);
|
|
108
|
+
documentRangeFormattingAdapter = new languageFeatures.FormatAdapter(workerAccessor);
|
|
109
|
+
monacoInstance.languages.registerDocumentRangeFormattingEditProvider(LANGUAGE_ID, documentRangeFormattingAdapter);
|
|
110
|
+
foldingRangeAdapter = new languageFeatures.FoldingAdapter(workerAccessor);
|
|
111
|
+
monacoInstance.languages.registerFoldingRangeProvider(LANGUAGE_ID, foldingRangeAdapter);
|
|
112
|
+
definitionProvider = new languageFeatures.DefinitionAdapter(workerAccessor);
|
|
113
|
+
monacoInstance.languages.registerDefinitionProvider(LANGUAGE_ID, definitionProvider);
|
|
114
|
+
monacoInstance.languages.registerRenameProvider(LANGUAGE_ID, new languageFeatures.RenameAdapter(workerAccessor));
|
|
115
|
+
referenceProvider = new languageFeatures.ReferenceAdapter(workerAccessor);
|
|
116
|
+
monacoInstance.languages.registerReferenceProvider(LANGUAGE_ID, referenceProvider);
|
|
117
|
+
if (defaults.languageSettings.enableHover) {
|
|
118
|
+
hoverAdapter = new languageFeatures.HoverAdapter(workerAccessor);
|
|
119
|
+
monacoInstance.languages.registerHoverProvider(LANGUAGE_ID, hoverAdapter);
|
|
120
|
+
}
|
|
121
|
+
documentFormattingAdapter = new languageFeatures.DocumentFormatAdapter(workerAccessor);
|
|
122
|
+
monacoInstance.languages.registerDocumentFormattingEditProvider(LANGUAGE_ID, documentFormattingAdapter);
|
|
123
|
+
languageConfiguration = {
|
|
124
|
+
folding: {
|
|
125
|
+
offSide: false,
|
|
126
|
+
markers: { start: /^\s*[\r\n]/gm, end: /^\s*[\r\n]/gm },
|
|
127
|
+
},
|
|
128
|
+
comments: {
|
|
129
|
+
lineComment: '//',
|
|
130
|
+
blockComment: null,
|
|
131
|
+
},
|
|
132
|
+
autoClosingPairs: [
|
|
133
|
+
{ open: '{', close: '}' },
|
|
134
|
+
{ open: '[', close: ']' },
|
|
135
|
+
{ open: '(', close: ')' },
|
|
136
|
+
{ open: "'", close: "'", notIn: ['string', 'comment'] },
|
|
137
|
+
{ open: '"', close: '"', notIn: ['string', 'comment'] },
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
monacoInstance.languages.setLanguageConfiguration(LANGUAGE_ID, languageConfiguration);
|
|
141
|
+
return [2 /*return*/, workerAccessor];
|
|
142
|
+
});
|
|
142
143
|
});
|
|
143
|
-
return kustoWorker;
|
|
144
144
|
}
|
|
145
145
|
export function getKustoWorker() {
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
// This function sets the Monarch token provider,
|
|
149
|
-
// enabling fast syntax highlighting before the language service is called for semantic coloring.
|
|
150
|
-
function setMonarchTokensProvider(monacoInstance, disposables) {
|
|
151
|
-
var monarchTokensProvider = monacoInstance.languages.setMonarchTokensProvider(LANGUAGE_ID, kustoLanguageDefinition);
|
|
152
|
-
disposables.push(monarchTokensProvider);
|
|
153
|
-
}
|
|
154
|
-
// This function registers a semantic token provider that utilizes the language service
|
|
155
|
-
// for more context-relevant syntax highlighting.
|
|
156
|
-
function registerDocumentSemanticTokensProvider(workerAccessor, monacoInstance) {
|
|
157
|
-
var _this = this;
|
|
158
|
-
var classificationsGetter = function (resource) { return __awaiter(_this, void 0, void 0, function () {
|
|
159
|
-
var worker;
|
|
146
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
160
147
|
return __generator(this, function (_a) {
|
|
161
|
-
|
|
162
|
-
case 0: return [4 /*yield*/, workerAccessor(resource)];
|
|
163
|
-
case 1:
|
|
164
|
-
worker = _a.sent();
|
|
165
|
-
return [2 /*return*/, worker.getClassifications(resource.toString())];
|
|
166
|
-
}
|
|
148
|
+
return [2 /*return*/, workerAccessor];
|
|
167
149
|
});
|
|
168
|
-
});
|
|
169
|
-
var semanticTokenProvider = new SemanticTokensProvider(classificationsGetter);
|
|
170
|
-
monacoInstance.languages.registerDocumentSemanticTokensProvider(LANGUAGE_ID, semanticTokenProvider);
|
|
150
|
+
});
|
|
171
151
|
}
|
|
@@ -13,7 +13,7 @@ export declare class DiagnosticsAdapter {
|
|
|
13
13
|
private _schemaListener;
|
|
14
14
|
private _cursorListener;
|
|
15
15
|
private _debouncedValidations;
|
|
16
|
-
constructor(_monacoInstance: typeof
|
|
16
|
+
constructor(_monacoInstance: typeof monaco, _languageId: string, _worker: AugmentedWorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
|
|
17
17
|
private getMonacoCodeActions;
|
|
18
18
|
private getOrCreateDebouncedValidation;
|
|
19
19
|
dispose(): void;
|
|
@@ -62,8 +62,8 @@ export interface EngineSchema {
|
|
|
62
62
|
readonly databases: readonly Database[];
|
|
63
63
|
};
|
|
64
64
|
readonly database: Database | undefined;
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
globalScalarParameters?: readonly ScalarParameter[];
|
|
66
|
+
globalTabularParameters?: readonly TabularParameter[];
|
|
67
67
|
}
|
|
68
68
|
export type TableEntityType = 'Table' | 'ExternalTable' | 'MaterializedViewTable';
|
|
69
69
|
export interface ClusterMangerSchema {
|
|
@@ -9,7 +9,44 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
49
|
+
import * as mode from './kustoMode';
|
|
13
50
|
import KustoCommandHighlighter from './commandHighlighter';
|
|
14
51
|
import KustoCommandFormatter from './commandFormatter';
|
|
15
52
|
import { extend } from './extendedEditor';
|
|
@@ -22,7 +59,6 @@ export * from './languageServiceManager/renderInfo';
|
|
|
22
59
|
export * from './languageServiceManager/settings';
|
|
23
60
|
export * from './types';
|
|
24
61
|
export * from './extendedGlobalApi';
|
|
25
|
-
// --- Kusto configuration and defaults ---------
|
|
26
62
|
var LanguageServiceDefaultsImpl = /** @class */ (function () {
|
|
27
63
|
function LanguageServiceDefaultsImpl(languageSettings) {
|
|
28
64
|
this._onDidChange = new monaco.Emitter();
|
|
@@ -83,18 +119,15 @@ var defaultLanguageSettings = {
|
|
|
83
119
|
completionOptions: { includeExtendedSyntax: false },
|
|
84
120
|
};
|
|
85
121
|
export function getKustoWorker() {
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
mode.getKustoWorker()
|
|
122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
+
return __generator(this, function (_a) {
|
|
124
|
+
return [2 /*return*/, mode.getKustoWorker()];
|
|
89
125
|
});
|
|
90
126
|
});
|
|
91
127
|
}
|
|
92
|
-
function withMode(callback) {
|
|
93
|
-
import('./kustoMode').then(callback);
|
|
94
|
-
}
|
|
95
128
|
export var kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
|
|
96
|
-
monaco.languages.onLanguage(
|
|
97
|
-
|
|
129
|
+
monaco.languages.onLanguage(LANGUAGE_ID, function () {
|
|
130
|
+
mode.setupMode(kustoDefaults, monaco);
|
|
98
131
|
});
|
|
99
132
|
monaco.languages.register({
|
|
100
133
|
id: LANGUAGE_ID,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 12.0.
|
|
3
|
+
* monaco-kusto version: 12.0.1(56b90ce0fd31e7d6792f5098d1e8204274966b6e)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as monaco from 'monaco-editor';
|
|
2
2
|
import { editor } from 'monaco-editor';
|
|
3
3
|
import { ClassificationRange } from './types';
|
|
4
|
-
type ClassificationsGetter = (
|
|
4
|
+
type ClassificationsGetter = (uri: string) => Promise<ClassificationRange[]>;
|
|
5
5
|
export declare class SemanticTokensProvider implements monaco.languages.DocumentSemanticTokensProvider {
|
|
6
6
|
private readonly classificationsGetter;
|
|
7
7
|
constructor(classificationsGetter: ClassificationsGetter);
|
|
@@ -44,12 +44,12 @@ var SemanticTokensProvider = /** @class */ (function () {
|
|
|
44
44
|
};
|
|
45
45
|
SemanticTokensProvider.prototype.provideDocumentSemanticTokens = function (model) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var
|
|
47
|
+
var uri, classifications, semanticTokens;
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
49
|
switch (_a.label) {
|
|
50
50
|
case 0:
|
|
51
|
-
|
|
52
|
-
return [4 /*yield*/, this.classificationsGetter(
|
|
51
|
+
uri = model.uri.toString();
|
|
52
|
+
return [4 /*yield*/, this.classificationsGetter(uri)];
|
|
53
53
|
case 1:
|
|
54
54
|
classifications = _a.sent();
|
|
55
55
|
semanticTokens = classifications.map(function (classification, index) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
import { SemanticTokensProvider } from './SemanticTokensProvider';
|
|
3
|
+
import { IKustoWorkerImpl } from '../kustoWorker';
|
|
4
|
+
export type SemanticTokensProviderRegistrar = (monacoInstance: typeof monaco, semanticTokensProvider: SemanticTokensProvider) => void;
|
|
5
|
+
export declare function semanticTokensProviderRegistrarCreator(): (monacoInstance: typeof monaco, worker: IKustoWorkerImpl) => void;
|
|
6
|
+
export declare function semanticTokensProviderRegistrarCreatorForTest(): (monacoInstance: typeof monaco, semanticTokensProvider: SemanticTokensProvider) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LANGUAGE_ID } from '../globals';
|
|
2
|
+
import { SemanticTokensProvider } from './SemanticTokensProvider';
|
|
3
|
+
// Registers semantic token provider that utilizes the language service
|
|
4
|
+
// for more context-relevant syntax highlighting.
|
|
5
|
+
export function semanticTokensProviderRegistrarCreator() {
|
|
6
|
+
var semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreatorForTest();
|
|
7
|
+
return function (monacoInstance, worker) {
|
|
8
|
+
var semanticTokensProvider = semanticTokensProviderMaker(worker);
|
|
9
|
+
semanticTokensProviderRegistrar(monacoInstance, semanticTokensProvider);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function semanticTokensProviderRegistrarCreatorForTest() {
|
|
13
|
+
var semanticTokensDisposable;
|
|
14
|
+
return function (monacoInstance, semanticTokensProvider) {
|
|
15
|
+
if (semanticTokensDisposable) {
|
|
16
|
+
semanticTokensDisposable.dispose();
|
|
17
|
+
}
|
|
18
|
+
semanticTokensDisposable = monacoInstance.languages.registerDocumentSemanticTokensProvider(LANGUAGE_ID, semanticTokensProvider);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function semanticTokensProviderMaker(worker) {
|
|
22
|
+
return new SemanticTokensProvider(worker.getClassifications);
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!-----------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* monaco-kusto version: 12.0.1(56b90ce0fd31e7d6792f5098d1e8204274966b6e)
|
|
4
|
+
* Released under the MIT license
|
|
5
|
+
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
|
+
*-----------------------------------------------------------------------------*/
|
|
7
|
+
define("vs/language/kusto/kustoMode-2dd4a01e",["exports","vs/editor/editor.main","./main-86d6c837"],(function(t,e,r){"use strict";function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var o=n(e),i=["onDidProvideCompletionItems"];function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function c(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==a(e)?e:e+""}var s=function(){return t=function t(e,r){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._monacoInstance=e,this._defaults=r,this._worker=null,this._idleCheckInterval=self.setInterval((function(){return n._checkIfIdle()}),3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange((function(){return n._saveStateAndStopWorker()}))},e=[{key:"_stopWorker",value:function(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}},{key:"_saveStateAndStopWorker",value:function(){var t=this;this._worker&&this._worker.getProxy().then((function(e){e.getSchema().then((function(e){t._storedState={schema:e},t._stopWorker()}))}))}},{key:"dispose",value:function(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}},{key:"_checkIfIdle",value:function(){if(this._worker){var t=this._defaults.getWorkerMaxIdleTime(),e=Date.now()-this._lastUsedTime;t>0&&e>t&&this._saveStateAndStopWorker()}}},{key:"_getClient",value:function(){var t=this;this._lastUsedTime=Date.now();var e=this._defaults.languageSettings;e.onDidProvideCompletionItems;var r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,i);return this._client||(this._worker=this._monacoInstance.editor.createWebWorker({moduleId:"vs/language/kusto/kustoWorker",label:"kusto",createData:{languageSettings:r,languageId:"kusto"}}),this._client=this._worker.getProxy().then((function(e){return t._storedState?e.setSchema(t._storedState.schema).then((function(){return e})):e}))),this._client}},{key:"getLanguageServiceWorker",value:function(){for(var t,e=this,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return this._getClient().then((function(e){t=e})).then((function(t){return e._worker.withSyncedResources(n)})).then((function(e){return t}))}}],e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function f(t){var e=l(t);return null!=t&&("object"==e||"function"==e)}function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}var h="object"==("undefined"==typeof global?"undefined":p(global))&&global&&global.Object===Object&&global;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}var m="object"==("undefined"==typeof self?"undefined":d(self))&&self&&self.Object===Object&&self,y=h||m||Function("return this")(),v=function(){return y.Date.now()},g=/\s/;var b=/^\s+/;function w(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&g.test(t.charAt(e)););return e}(t)+1).replace(b,""):t}var _=y.Symbol,k=Object.prototype,x=k.hasOwnProperty,S=k.toString,L=_?_.toStringTag:void 0;var j=Object.prototype.toString;var O="[object Null]",P="[object Undefined]",E=_?_.toStringTag:void 0;function I(t){return null==t?void 0===t?P:O:E&&E in Object(t)?function(t){var e=x.call(t,L),r=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);return n&&(e?t[L]=r:delete t[L]),o}(t):function(t){return j.call(t)}(t)}function C(t){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}var D="[object Symbol]";function M(t){return"symbol"==T(t)||function(t){return null!=t&&"object"==C(t)}(t)&&I(t)==D}var N=NaN,A=/^[-+]0x[0-9a-f]+$/i,F=/^0b[01]+$/i,G=/^0o[0-7]+$/i,V=parseInt;function K(t){if("number"==typeof t)return t;if(M(t))return N;if(f(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=f(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=w(t);var r=F.test(t);return r||G.test(t)?V(t.slice(2),r?2:8):A.test(t)?N:+t}var R=Math.max,W=Math.min;function q(t,e,r){var n,o,i,a,u,c,s=0,l=!1,p=!1,h=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var r=n,i=o;return n=o=void 0,s=e,a=t.apply(i,r)}function m(t){var r=t-c;return void 0===c||r>=e||r<0||p&&t-s>=i}function y(){var t=v();if(m(t))return g(t);u=setTimeout(y,function(t){var r=e-(t-c);return p?W(r,i-(t-s)):r}(t))}function g(t){return u=void 0,h&&n?d(t):(n=o=void 0,a)}function b(){var t=v(),r=m(t);if(n=arguments,o=this,c=t,r){if(void 0===u)return function(t){return s=t,u=setTimeout(y,e),l?d(t):a}(c);if(p)return clearTimeout(u),u=setTimeout(y,e),d(c)}return void 0===u&&(u=setTimeout(y,e)),a}return e=K(e)||0,f(r)&&(l=!!r.leading,i=(p="maxWait"in r)?R(K(r.maxWait)||0,e):i,h="trailing"in r?!!r.trailing:h),b.cancel=function(){void 0!==u&&clearTimeout(u),s=0,n=c=o=u=void 0},b.flush=function(){return void 0===u?a:g(v())},b}function z(t,e){return t&&e.filterText.toLowerCase().includes(t.toLowerCase())?"".concat(t).concat(e.filterText):e.filterText}function U(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=$(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function Y(t){return function(t){if(Array.isArray(t))return H(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){if(t){if("string"==typeof t)return H(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?H(t,e):void 0}}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function B(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */B=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new I(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(C([])));k&&k!==r&&n.call(k,a)&&(w=k);var x=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==Q(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function j(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Q(e)+" is not iterable")}return g.prototype=b,o(x,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},S(L.prototype),s(L.prototype,u,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(x),s(x,c,"Generator"),s(x,a,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function J(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function X(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){J(i,n,o,a,u,"next",t)}function u(t){J(i,n,o,a,u,"throw",t)}a(void 0)}))}}function Z(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nt(n.key),n)}}function et(t,e,r){return e&&tt(t.prototype,e),r&&tt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rt(t,e,r){return(e=nt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t){var e=function(t,e){if("object"!=Q(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Q(e)?e:e+""}var ot=function(){return et((function t(e,r,n,i,a){var u=this;Z(this,t),rt(this,"_disposables",[]),rt(this,"_contentListener",Object.create(null)),rt(this,"_configurationListener",Object.create(null)),rt(this,"_schemaListener",Object.create(null)),rt(this,"_cursorListener",Object.create(null)),rt(this,"_debouncedValidations",Object.create(null)),this._monacoInstance=e,this._languageId=r,this._worker=n,this.defaults=i;var c,s=function(t){var e=t.getLanguageId(),r=t.uri.toString();if(e===u._languageId){var n=u.getOrCreateDebouncedValidation(t,e);u._contentListener[r]=t.onDidChangeContent((function(t){var e=function(t){return t.changes.map((function(t){return{start:t.rangeOffset,end:t.rangeOffset+t.text.length}}))}(t);n(e)})),u._configurationListener[r]=u.defaults.onDidChange((function(){self.setTimeout((function(){return u._doValidate(t,e,[])}),0)})),u._schemaListener[r]=a((function(){self.setTimeout((function(){return u._doValidate(t,e,[])}),0)}))}},l=function(t){var e=t.getId();u._cursorListener[e]||(t.onDidDispose((function(){var t;null===(t=u._cursorListener[e])||void 0===t||t.dispose(),delete u._cursorListener[e]})),u._cursorListener[e]=t.onDidChangeCursorSelection((function(e){var r=t.getModel(),n=r.getLanguageId();if(n===u._languageId){var o=r.getOffsetAt(e.selection.getPosition());u.getOrCreateDebouncedValidation(r,n)([{start:o,end:o}])}})))},f=function(t){u._monacoInstance.editor.setModelMarkers(t,u._languageId,[]);var e=t.uri.toString(),r=u._contentListener[e];r&&(r.dispose(),delete u._contentListener[e]);var n=u._configurationListener[e];n&&(n.dispose(),delete u._configurationListener[e]);var o=u._schemaListener[e];o&&(o.dispose(),delete u._schemaListener[e]);var i=u._debouncedValidations[e];i&&(i.cancel(),delete u._debouncedValidations[e])};this.defaults.languageSettings.enableQuickFixes&&this._disposables.push(o.languages.registerCodeActionProvider(this._languageId,{provideCodeActions:(c=X(B().mark((function t(e,r,n,o){var i,a,c,s;return B().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=e.getOffsetAt(r.getStartPosition()),a=e.getOffsetAt(r.getEndPosition()),c=n.markers.length>0,t.next=5,u.getMonacoCodeActions(e,i,a,c);case 5:return s=t.sent,t.abrupt("return",{actions:s,dispose:function(){}});case 7:case"end":return t.stop()}}),t)}))),function(t,e,r,n){return c.apply(this,arguments)})})),this._disposables.push(this._monacoInstance.editor.onDidCreateEditor(l)),this._disposables.push(this._monacoInstance.editor.onDidCreateModel(s)),this._disposables.push(this._monacoInstance.editor.onWillDisposeModel(f)),this._disposables.push(this._monacoInstance.editor.onDidChangeModelLanguage((function(t){f(t.model),s(t.model)}))),this._disposables.push({dispose:function(){for(var t in u._contentListener)u._contentListener[t].dispose();for(var e in u._cursorListener)u._cursorListener[e].dispose();for(var r in u._debouncedValidations)u._debouncedValidations[r].cancel()}}),this._monacoInstance.editor.getModels().forEach(s),this._monacoInstance.editor.getEditors().forEach(l)}),[{key:"getMonacoCodeActions",value:(t=X(B().mark((function t(e,r,n,o){var i,a,u,c,s,l,f,p=this;return B().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=[],t.next=3,this._worker(e.uri);case 3:return a=t.sent,u=e.uri,t.next=7,a.getResultActions(u.toString(),r,n);case 7:c=t.sent,s=B().mark((function t(){var r,n,a,u,s;return B().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n=c[f]).kind.includes("Extract Function")){t.next=3;break}return t.abrupt("return",0);case 3:if("quickfix"!=(a=null!==(r=p.defaults.languageSettings.quickFixCodeActions)&&void 0!==r&&r.find((function(t){return n.kind.includes(t)}))?"quickfix":"custom")||o){t.next=6;break}return t.abrupt("return",{v:void 0});case 6:u=n.changes,s=u.map((function(t){var r,n=e.getPositionAt(t.start),o=e.getPositionAt(t.start+t.deleteLength);return{resource:e.uri,textEdit:{range:{startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:o.lineNumber,endColumn:o.column},text:null!==(r=t.insertText)&&void 0!==r?r:""}}})),i.push({title:n.title,diagnostics:[],kind:a,edit:{edits:Y(s)}});case 9:case"end":return t.stop()}}),t)})),f=0;case 10:if(!(f<c.length)){t.next=20;break}return t.delegateYield(s(),"t0",12);case 12:if(0!==(l=t.t0)){t.next=15;break}return t.abrupt("continue",17);case 15:if(!l){t.next=17;break}return t.abrupt("return",l.v);case 17:f++,t.next=10;break;case 20:return t.abrupt("return",i);case 21:case"end":return t.stop()}}),t,this)}))),function(e,r,n,o){return t.apply(this,arguments)})},{key:"getOrCreateDebouncedValidation",value:function(t,e){var r=this,n=t.uri.toString();return this._debouncedValidations[n]||(this._debouncedValidations[n]=q((function(n){return r._doValidate(t,e,n)}),500)),this._debouncedValidations[n]}},{key:"dispose",value:function(){this._disposables.forEach((function(t){return t&&t.dispose()})),this._disposables=[]}},{key:"_doValidate",value:function(t,e,r){var n=this;if(!t.isDisposed()){var i=t.uri,a=t.getVersionId();this._worker(i).then((function(t){return t.doValidation(i.toString(),r)})).then((function(t){if(n._monacoInstance.editor.getModel(i).getVersionId()===a){var r=t.map((function(t){return r="number"==typeof(e=t).code?String(e.code):e.code,{severity:it(e.severity),startLineNumber:e.range.start.line+1,startColumn:e.range.start.character+1,endLineNumber:e.range.end.line+1,endColumn:e.range.end.character+1,message:e.message,code:r,source:e.source};var e,r})),u=n._monacoInstance.editor.getModel(i),c=u.getAllDecorations().filter((function(t){return"squiggly-error"==t.options.className})).map((function(t){return t.id}));if(u&&u.getLanguageId()===e){var s=n.defaults.languageSettings.syntaxErrorAsMarkDown;if(s&&s.enableSyntaxErrorAsMarkDown){var l=s.header?"**".concat(s.header,"** \n\n"):"",f=s.icon?""):"",p="".concat(f," ").concat(l),h=r.map((function(t){return{range:{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.endLineNumber,endColumn:t.endColumn},options:{hoverMessage:{value:p+t.message},className:"squiggly-error",zIndex:100,overviewRuler:{color:"rgb(255, 18, 18, 0.7)",position:o.editor.OverviewRulerLane.Right},minimap:{color:"rgb(255, 18, 18, 0.7)",position:o.editor.MinimapPosition.Inline}}}})),d=o.editor.getModelMarkers({owner:e,resource:i});d&&d.length>0&&(c=[],n._monacoInstance.editor.setModelMarkers(u,e,[])),u.deltaDecorations(c,h)}else u.deltaDecorations(c,[]),n._monacoInstance.editor.setModelMarkers(u,e,r)}}})).then(void 0,(function(t){console.error(t)}))}}}]);var t}();function it(t){switch(t){case r.DiagnosticSeverity.Error:return o.MarkerSeverity.Error;case r.DiagnosticSeverity.Warning:return o.MarkerSeverity.Warning;case r.DiagnosticSeverity.Information:return o.MarkerSeverity.Info;case r.DiagnosticSeverity.Hint:return o.MarkerSeverity.Hint;default:return o.MarkerSeverity.Info}}function at(t){if(t)return{character:t.column-1,line:t.lineNumber-1}}function ut(t){if(t)return new o.Range(t.start.line+1,t.start.character+1,t.end.line+1,t.end.character+1)}function ct(t){var e=o.languages.CompletionItemKind;switch(t){case r.CompletionItemKind.Text:return e.Text;case r.CompletionItemKind.Method:return e.Method;case r.CompletionItemKind.Function:return e.Function;case r.CompletionItemKind.Constructor:return e.Constructor;case r.CompletionItemKind.Field:return e.Field;case r.CompletionItemKind.Variable:return e.Variable;case r.CompletionItemKind.Class:return e.Class;case r.CompletionItemKind.Interface:return e.Interface;case r.CompletionItemKind.Module:return e.Module;case r.CompletionItemKind.Property:return e.Property;case r.CompletionItemKind.Unit:return e.Unit;case r.CompletionItemKind.Value:return e.Value;case r.CompletionItemKind.Enum:return e.Enum;case r.CompletionItemKind.Keyword:return e.Keyword;case r.CompletionItemKind.Snippet:return e.Snippet;case r.CompletionItemKind.Color:return e.Color;case r.CompletionItemKind.File:return e.File;case r.CompletionItemKind.Reference:return e.Reference}return e.Property}function st(t){if(t)return{range:ut(t.range),text:t.newText}}var lt=function(){return et((function t(e,r){Z(this,t),this.languageSettings=r;var n=function(){var t=X(B().mark((function t(r,n){var o;return B().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e(r);case 2:return o=t.sent,t.abrupt("return",o.doComplete(r.toString(),n));case 4:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}();this.completionCacheManager=function(t){var e,r;return{getCompletionItems:function(n,o,i){return(!r||!n||!(null!=n&&n.includes(r)))&&(e=t(o,i)),r=n,e}}}(n)}),[{key:"triggerCharacters",get:function(){return[" ",".","("]}},{key:"provideCompletionItems",value:function(t,e,n,i){var a,u=this,c=t.getWordUntilPosition(e),s=new o.Range(e.lineNumber,c.startColumn,e.lineNumber,c.endColumn),l=t.uri,f=null==t||null===(a=t.getWordAtPosition(e))||void 0===a?void 0:a.word,p=this.languageSettings.onDidProvideCompletionItems;return this.completionCacheManager.getCompletionItems(f,l,at(e)).then((function(t){return p?p(t):t})).then((function(t){if(t){var e=function(t,e){var r=t[0];if(!e)return r;var n=t.find((function(t){var r;return null===(r=t.filterText)||void 0===r?void 0:r.toLowerCase().startsWith(e.toLowerCase())}));return null!=n?n:r}(t.items,f);return{incomplete:!0,suggestions:t.items.map((function(t,n){var i,a={label:t.label,insertText:t.insertText,sortText:t.sortText,filterText:z(f,t),documentation:u.formatDocLink(null===(i=t.documentation)||void 0===i?void 0:i.value),detail:t.detail,range:s,kind:ct(t.kind),preselect:e.filterText===t.filterText};return t.textEdit&&(a.range=ut(t.textEdit.range),a.insertText=t.textEdit.newText),t.insertTextFormat===r.InsertTextFormat.Snippet&&(a.insertTextRules=o.languages.CompletionItemInsertTextRule.InsertAsSnippet),a}))}}}))}},{key:"formatDocLink",value:function(t){if(t){var e=this.languageSettings,r=e.documentationBaseUrl,n=void 0===r?"https://learn.microsoft.com/azure/data-explorer/kusto/query":r,i=e.documentationSuffix;return{value:t,isTrusted:!0,uris:new Proxy({},{get:function(t,e,r){var a=e.toString().replace(".md","");a.startsWith("https")||(a="".concat(n,"/").concat(a));var u=o.Uri.parse(a);return i&&(u.toString=function(){return a+i}),u}})}}}}])}();function ft(t){return"string"==typeof t?{value:t}:(e=t)&&"object"===Q(e)&&"string"==typeof e.kind?"plaintext"===t.kind?{value:t.value.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}:{value:t.value}:{value:"```"+t.value+"\n"+t.value+"\n```\n"};var e}function pt(t){if(t)return Array.isArray(t)?t.map(ft):[ft(t)]}function ht(t){return{uri:o.Uri.parse(t.uri),range:ut(t.range)}}var dt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideDefinition",value:function(t,e,r){var n=t.uri;return this._worker(n).then((function(t){return t.findDefinition(n.toString(),at(e))})).then((function(t){if(t&&0!=t.length)return[ht(t[0])]}))}}])}(),mt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideReferences",value:function(t,e,r,n){var o=t.uri;return this._worker(o).then((function(t){return t.findReferences(o.toString(),at(e))})).then((function(t){if(t)return t.map(ht)}))}}])}();var yt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideRenameEdits",value:function(t,e,r,n){var i=t.uri;return this._worker(i).then((function(t){return t.doRename(i.toString(),at(e),r)})).then((function(t){return function(t){if(t&&t.changes){var e=[];for(var r in t.changes){var n,i=o.Uri.parse(r),a=U(t.changes[r]);try{for(a.s();!(n=a.n()).done;){var u=n.value;e.push({resource:i,textEdit:{range:ut(u.range),text:u.newText},versionId:void 0})}}catch(t){a.e(t)}finally{a.f()}}return{edits:e}}}(t)}))}}])}(),vt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideDocumentFormattingEdits",value:function(t,e,r){var n=t.uri;return this._worker(n).then((function(t){return t.doDocumentFormat(n.toString()).then((function(t){return t.map((function(t){return st(t)}))}))}))}}])}(),gt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideDocumentRangeFormattingEdits",value:function(t,e,r,n){var o=t.uri;return this._worker(o).then((function(t){return t.doRangeFormat(o.toString(),function(t){if(t)return{start:at(t.getStartPosition()),end:at(t.getEndPosition())}}(e)).then((function(t){return t.map((function(t){return st(t)}))}))}))}}])}(),bt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideFoldingRanges",value:function(t,e,r){var n=t.uri;return this._worker(n).then((function(t){return t.doFolding(n.toString()).then((function(t){return t.map((function(t){return function(t){return{start:t.startLine+1,end:t.endLine+1,kind:o.languages.FoldingRangeKind.Region}}(t)}))}))}))}}])}();var wt=function(){return et((function t(e){Z(this,t),this._worker=e}),[{key:"provideHover",value:function(t,e,r){var n=t.uri;return this._worker(n).then((function(t){return t.doHover(n.toString(),at(e))})).then((function(t){if(t)return{range:ut(t.range),contents:pt(t.contents)}}))}}])}(),_t="kusto",kt=function(t){return t.PlainText="plainText",t.Comment="comment",t.Punctuation="punctuation",t.Directive="directive",t.Literal="literal",t.StringLiteral="stringLiteral",t.Type="type",t.Column="column",t.Table="table",t.Database="database",t.Function="function",t.Parameter="parameter",t.Variable="variable",t.Identifier="identifier",t.ClientParameter="clientParameter",t.QueryParameter="queryParameter",t.ScalarParameter="scalarParameter",t.MathOperator="mathOperator",t.QueryOperator="queryOperator",t.Command="command",t.Keyword="keyword",t.MaterializedView="materializedView",t.SchemaMember="schemaMember",t.SignatureParameter="signatureParameter",t.Option="option",t}({}),xt=[kt.PlainText,kt.Comment,kt.Punctuation,kt.Directive,kt.Literal,kt.StringLiteral,kt.Type,kt.Column,kt.Table,kt.Database,kt.Function,kt.Parameter,kt.Variable,kt.Identifier,kt.ClientParameter,kt.QueryParameter,kt.ScalarParameter,kt.MathOperator,kt.QueryOperator,kt.Command,kt.Keyword,kt.MaterializedView,kt.SchemaMember,kt.SignatureParameter,kt.Option];function St(t){return St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St(t)}function Lt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Lt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new I(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(C([])));k&&k!==r&&n.call(k,a)&&(w=k);var x=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==St(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function j(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(St(e)+" is not iterable")}return g.prototype=b,o(x,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},S(L.prototype),s(L.prototype,u,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(x),s(x,c,"Generator"),s(x,a,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function jt(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function Ot(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pt(n.key),n)}}function Pt(t){var e=function(t,e){if("object"!=St(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=St(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==St(e)?e:e+""}var Et=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.classificationsGetter=e},e=[{key:"getLegend",value:function(){return{tokenTypes:xt,tokenModifiers:[]}}},{key:"provideDocumentSemanticTokens",value:(n=Lt().mark((function t(e){var r,n,o;return Lt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.uri.toString(),t.next=3,this.classificationsGetter(r);case 3:return n=t.sent,o=n.map((function(t,e){return Ct(t,n[e-1])})),t.abrupt("return",{data:new Uint32Array(o.flat()),resultId:e.getVersionId().toString()});case 6:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){jt(i,r,o,a,u,"next",t)}function u(t){jt(i,r,o,a,u,"throw",t)}a(void 0)}))},function(t){return o.apply(this,arguments)})},{key:"releaseDocumentSemanticTokens",value:function(){}}],e&&Ot(t.prototype,e),r&&Ot(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}(),It={line:0,character:0,length:0,kind:0};function Ct(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,r=t.line,n=t.character,o=t.length,i=t.kind,a=r-e.line;return[a,a?n:n-e.character,o,i,0]}function Tt(){var t,e=function(e,r){t&&t.dispose(),t=e.languages.registerDocumentSemanticTokensProvider(_t,r)};return function(t,r){var n=function(t){return new Et(t.getClassifications)}(r);e(t,n)}}var Dt,Mt={name:_t,mimeTypes:["text/kusto"],displayName:"Kusto",defaultToken:"invalid",queryOperators:["as","consume","distinct","evaluate","extend","getschema","graph-match","graph-merge","graph-to-table","invoke","join","limit","lookup","make-graph","make-series","mv-apply","mv-expand","order","parse","parse-kv","parse-where","project","project-away","project-keep","project-rename","project-reorder","range","reduce","render","sample","sample-distinct","scan","serialize","sort","summarize","take","top","top-hitters","top-nested","union","where","filter","fork","facet","range","consume","find","search","print","partition","lookup"],queryParameters:["kind"],types:["bool","datetime","decimal","double","dynamic","guid","int","long","real","string","timespan"],commands:[".add",".alter",".alter-merge",".append",".as",".assert",".attach",".consume",".count",".create",".create-merge",".create-or-alter",".create-set",".datatable",".default",".define",".delete",".detach",".distinct",".drop",".drop-pretend",".dup-next-failed-ingest",".dup-next-ingest",".evaluate",".export",".extend",".externaldata",".filter",".find",".fork",".getschema",".ingest",".join",".limit",".load",".make-series",".materialize",".move",".mv-expand",".order",".parse",".parse-where",".partition",".pivot",".print",".project",".project-away",".project-keep",".project-rename",".reduce",".remove",".rename",".replace",".restrict",".run",".sample",".sample-distinct",".save",".search",".serialize",".set",".set-or-append",".set-or-replace",".show",".sort",".summarize",".take",".top",".top-hitters",".top-nested",".union"],functions:["abs","acos","ago","array_concat","array_length","array_slice","array_split","asin","atan","atan2","avg","bag_keys","base64_decodestring","base64_encodestring","bin","bin_at","binary_and","binary_not","binary_or","binary_shift_left","binary_shift_right","binary_xor","case","ceiling","coalesce","columnifexists","cos","count","countof","cot","cursor_after","datatable","datepart","datetime_add","datetime_diff","datetime_part","dayofmonth","dayofweek","dayofyear","dcount","dcount_hll","degrees","endofday","endofmonth","endofweek","endofyear","exp","exp10","exp2","extract","extractall","extractjson","format_datetime","format_timespan","floor","gamma","geo_distance_2points","geo_geohash_to_central_point","geo_point_in_circle","geo_point_in_polygon","geo_point_to_geohash","getmonth","gettype","getyear","hash","hash_sha256","hll_merge","iif","indexof","isempty","isfinite","isinf","isascii","isnan","isnotempty","isnotnull","isnull","isutf8","log","log10","log2","loggamma","make_datetime","make_string","make_timespan","materialize","max","max_of","min","min_of","monthofyear","next","not","pack","pack_array","pack_dictionary","parse_csv","parse_ipv4","parse_json","parse_path","parse_url","parse_urlquery","parse_user_agent","parse_version","parse_xml","parsejson","percentrank_tdigest","percentile_tdigest","pow","prev","radians","rand","rank_tdigest","repeat","replace","reverse","round","row_cumsum","row_window_session","series_add","series_decompose","series_decompose_anomalies","series_decompose_forecast","series_divide","series_equals","series_fill_backward","series_fill_const","series_fill_forward","series_fill_linear","series_fir","series_fit_2lines","series_fit_2lines_dynamic","series_fit_line","series_fit_line_dynamic","series_greater","series_greater_equals","series_iir","series_less","series_less_equals","series_multiply","series_not_equals","series_outliers","series_pearson_correlation","series_periods_detect","series_periods_validate","series_seasonal","series_stats","series_stats_dynamic","series_subtract","sign","sin","split","sqrt","startofday","startofmonth","startofweek","startofyear","strcat","strcat_array","strcat_delim","strcmp","strlen","strrep","string_size","substring","sum","tan","tdigest_merge","tobool","toboolean","todecimal","todouble","todynamic","tofloat","toguid","tohex","toint","tolong","tolower","toobject","toreal","toscalar","tostring","totimespan","toupper","translate","trim","trim_end","trim_start","typeof","url_decode","url_encode","week_of_year","welch_test"],keywords:["and","as","asc","between","by","contains","count","desc","extend","false","filter","find","from","has","in","inner","join","leftouter","let","not","on","or","policy","project","project-away","project-rename","project-reorder","project-keep","range","rename","retention","summarize","table","take","to","true","where","with"],tokenizer:{root:[[/(\/\/.*$)/,kt.Comment],[/[\(\)\{\}\|\[\]\:\=\,\<|\.\..]/,kt.Punctuation],[/[\+\-\*\/\%\!\<\<=\>\>=\=\==\!=\<>\:\;\,\=~\@\?\=>\!~]/,kt.MathOperator],[/"([^"\\]*(\\.[^"\\]*)*)"/,kt.StringLiteral],[/'([^"\\]*(\\.[^"\\]*)*)'/,kt.StringLiteral],[/[\w@#\-$\.]+/,{cases:{"@queryOperators":kt.QueryOperator,"@queryParameters":kt.QueryParameter,"@types":kt.Type,"@commands":kt.Command,"@functions":kt.Function,"@keywords":kt.Keyword,"@default":"identifier"}}]]}};function Nt(t){return Nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nt(t)}function At(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ft(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?At(Object(r),!0).forEach((function(e){Gt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):At(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Gt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Nt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Vt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new I(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(C([])));k&&k!==r&&n.call(k,a)&&(w=k);var x=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==Nt(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function j(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Nt(e)+" is not iterable")}return g.prototype=b,o(x,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},S(L.prototype),s(L.prototype,u,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(x),s(x,c,"Generator"),s(x,a,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Kt(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function Rt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Kt(i,n,o,a,u,"next",t)}function u(t){Kt(i,n,o,a,u,"throw",t)}a(void 0)}))}}function Wt(){return Wt=Rt(Vt().mark((function t(e,r){var n,i,a,u,c,l,f,p,h,d,m;return Vt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new o.Emitter,i=new s(r,e),a=Tt(),Dt=function(){var t=Rt(Vt().mark((function t(e){var o,u,c;return Vt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.getLanguageServiceWorker(e);case 2:return o=t.sent,u=function(){var t=Rt(Vt().mark((function t(e){return Vt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.setSchema(e);case 2:n.fire(e),a(r,o);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),c=function(){var t=Rt(Vt().mark((function t(e,r,n,i,a){var c;return Vt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.normalizeSchema(e,r,n);case 2:return(c=t.sent).globalScalarParameters=i,c.globalTabularParameters=a,t.next=7,u(c);case 7:case"end":return t.stop()}}),t)})));return function(e,r,n,o,i){return t.apply(this,arguments)}}(),t.abrupt("return",Ft(Ft({},o),{},{setSchema:u,setSchemaFromShowSchema:c}));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),r.languages.setMonarchTokensProvider(_t,Mt),u=new lt(Dt,e.languageSettings),r.languages.registerCompletionItemProvider(_t,u),new ot(r,_t,Dt,e,n.event),c=new gt(Dt),r.languages.registerDocumentRangeFormattingEditProvider(_t,c),l=new bt(Dt),r.languages.registerFoldingRangeProvider(_t,l),f=new dt(Dt),r.languages.registerDefinitionProvider(_t,f),r.languages.registerRenameProvider(_t,new yt(Dt)),p=new mt(Dt),r.languages.registerReferenceProvider(_t,p),e.languageSettings.enableHover&&(h=new wt(Dt),r.languages.registerHoverProvider(_t,h)),d=new vt(Dt),r.languages.registerDocumentFormattingEditProvider(_t,d),m={folding:{offSide:!1,markers:{start:/^\s*[\r\n]/gm,end:/^\s*[\r\n]/gm}},comments:{lineComment:"//",blockComment:null},autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"'",close:"'",notIn:["string","comment"]},{open:'"',close:'"',notIn:["string","comment"]}]},r.languages.setLanguageConfiguration(_t,m),t.abrupt("return",Dt);case 23:case"end":return t.stop()}}),t)}))),Wt.apply(this,arguments)}function qt(){return(qt=Rt(Vt().mark((function t(){return Vt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Dt);case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}t.LANGUAGE_ID=_t,t.Token=kt,t.getKustoWorker=function(){return qt.apply(this,arguments)},t.setupMode=function(t,e){return Wt.apply(this,arguments)}}));
|