@kusto/monaco-kusto 12.0.1 → 12.0.3

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.
Files changed (32) hide show
  1. package/README.md +9 -1
  2. package/package.json +2 -2
  3. package/release/dev/kusto.javascript.client.min.js +1 -1
  4. package/release/dev/kustoMode.js +1771 -4
  5. package/release/dev/kustoWorker.js +2 -2
  6. package/release/dev/{main-f36cb42f.js → main-1546c7f5.js} +2 -2
  7. package/release/dev/monaco.contribution.js +73 -76
  8. package/release/dev/{schema-077630e6.js → schema-9341f93e.js} +2 -13
  9. package/release/dev/types-91878f5b.js +46 -0
  10. package/release/esm/globals-417d1e2f.js +40 -0
  11. package/release/esm/kusto.worker.js +11 -11
  12. package/release/esm/kustoMode.d.ts +8 -4
  13. package/release/esm/kustoMode.js +89 -92
  14. package/release/esm/languageFeatures.d.ts +1 -1
  15. package/release/esm/languageServiceManager/schema.d.ts +2 -2
  16. package/release/esm/monaco.contribution.js +20 -55
  17. package/release/esm/{schema-b8f0ba9b.js → schema-d4e431c7.js} +2 -12
  18. package/release/esm/syntaxHighlighting/SemanticTokensProvider.d.ts +1 -1
  19. package/release/esm/syntaxHighlighting/SemanticTokensProvider.js +3 -3
  20. package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.d.ts +2 -2
  21. package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.js +52 -4
  22. package/release/min/kusto.javascript.client.min.js +1 -1
  23. package/release/min/kustoMode.js +2 -2
  24. package/release/min/kustoWorker.js +2 -2
  25. package/release/min/{main-86d6c837.js → main-a2b9fd7b.js} +2 -2
  26. package/release/min/monaco.contribution.js +2 -2
  27. package/release/min/schema-319a2b5f.js +7 -0
  28. package/release/min/types-310c0d26.js +7 -0
  29. package/release/dev/kustoMode-d3f9e09a.js +0 -1818
  30. package/release/esm/kustoMode-349f5467.js +0 -957
  31. package/release/min/kustoMode-2dd4a01e.js +0 -7
  32. package/release/min/schema-a60c216c.js +0 -7
@@ -1,15 +1,1782 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 12.0.1(56b90ce0fd31e7d6792f5098d1e8204274966b6e)
3
+ * monaco-kusto version: 12.0.3(418f3d71791a9e0959cc8869c01ea6d9b94b3179)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
7
7
 
8
- define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './kustoMode-d3f9e09a', './main-f36cb42f'], (function (exports, monaco, kustoMode, main) { 'use strict';
8
+ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-1546c7f5', './types-91878f5b'], (function (exports, monaco, main, types$1) { 'use strict';
9
9
 
10
+ function _interopNamespaceDefault(e) {
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
10
26
 
27
+ var monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
11
28
 
12
- exports.getKustoWorker = kustoMode.getKustoWorker;
13
- exports.setupMode = kustoMode.setupMode;
29
+ var _excluded = ["onDidProvideCompletionItems"];
30
+ function _typeof$9(o) { "@babel/helpers - typeof"; return _typeof$9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$9(o); }
31
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
32
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
33
+ function _classCallCheck$2(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
34
+ function _defineProperties$2(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$3(o.key), o); } }
35
+ function _createClass$2(e, r, t) { return r && _defineProperties$2(e.prototype, r), t && _defineProperties$2(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
36
+ function _toPropertyKey$3(t) { var i = _toPrimitive$3(t, "string"); return "symbol" == _typeof$9(i) ? i : i + ""; }
37
+ function _toPrimitive$3(t, r) { if ("object" != _typeof$9(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$9(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38
+ var WorkerManager = /*#__PURE__*/function () {
39
+ function WorkerManager(_monacoInstance, defaults) {
40
+ var _this = this;
41
+ _classCallCheck$2(this, WorkerManager);
42
+ this._monacoInstance = _monacoInstance;
43
+ this._defaults = defaults;
44
+ this._worker = null;
45
+ this._idleCheckInterval = self.setInterval(function () {
46
+ return _this._checkIfIdle();
47
+ }, 30 * 1000);
48
+ this._lastUsedTime = 0;
49
+ this._configChangeListener = this._defaults.onDidChange(function () {
50
+ return _this._saveStateAndStopWorker();
51
+ });
52
+ }
53
+ return _createClass$2(WorkerManager, [{
54
+ key: "_stopWorker",
55
+ value: function _stopWorker() {
56
+ if (this._worker) {
57
+ this._worker.dispose();
58
+ this._worker = null;
59
+ }
60
+ this._client = null;
61
+ }
62
+ }, {
63
+ key: "_saveStateAndStopWorker",
64
+ value: function _saveStateAndStopWorker() {
65
+ var _this2 = this;
66
+ if (!this._worker) {
67
+ return;
68
+ }
69
+ this._worker.getProxy().then(function (proxy) {
70
+ proxy.getSchema().then(function (schema) {
71
+ _this2._storedState = {
72
+ schema: schema
73
+ };
74
+ _this2._stopWorker();
75
+ });
76
+ });
77
+ }
78
+ }, {
79
+ key: "dispose",
80
+ value: function dispose() {
81
+ clearInterval(this._idleCheckInterval);
82
+ this._configChangeListener.dispose();
83
+ this._stopWorker();
84
+ }
85
+ }, {
86
+ key: "_checkIfIdle",
87
+ value: function _checkIfIdle() {
88
+ if (!this._worker) {
89
+ return;
90
+ }
91
+ var maxIdleTime = this._defaults.getWorkerMaxIdleTime();
92
+ var timePassedSinceLastUsed = Date.now() - this._lastUsedTime;
93
+ if (maxIdleTime > 0 && timePassedSinceLastUsed > maxIdleTime) {
94
+ this._saveStateAndStopWorker();
95
+ }
96
+ }
97
+ }, {
98
+ key: "_getClient",
99
+ value: function _getClient() {
100
+ var _this3 = this;
101
+ this._lastUsedTime = Date.now();
102
+
103
+ // Since onDidProvideCompletionItems is not used in web worker, and since functions cannot be trivially serialized (throws exception unable to clone), We remove it here.
104
+ var _this$_defaults$langu = this._defaults.languageSettings;
105
+ _this$_defaults$langu.onDidProvideCompletionItems;
106
+ var languageSettings = _objectWithoutProperties(_this$_defaults$langu, _excluded);
107
+ if (!this._client) {
108
+ this._worker = this._monacoInstance.editor.createWebWorker({
109
+ // module that exports the create() method and returns a `KustoWorker` instance
110
+ moduleId: 'vs/language/kusto/kustoWorker',
111
+ label: 'kusto',
112
+ // passed in to the create() method
113
+ createData: {
114
+ languageSettings: languageSettings,
115
+ languageId: 'kusto'
116
+ }
117
+ });
118
+ this._client = this._worker.getProxy().then(function (proxy) {
119
+ // push state we held onto before killing the client.
120
+ if (_this3._storedState) {
121
+ return proxy.setSchema(_this3._storedState.schema).then(function () {
122
+ return proxy;
123
+ });
124
+ } else {
125
+ return proxy;
126
+ }
127
+ });
128
+ }
129
+ return this._client;
130
+ }
131
+ }, {
132
+ key: "getLanguageServiceWorker",
133
+ value: function getLanguageServiceWorker() {
134
+ var _this4 = this;
135
+ for (var _len = arguments.length, resources = new Array(_len), _key = 0; _key < _len; _key++) {
136
+ resources[_key] = arguments[_key];
137
+ }
138
+ var _client;
139
+ return this._getClient().then(function (client) {
140
+ _client = client;
141
+ }).then(function (_) {
142
+ return _this4._worker.withSyncedResources(resources);
143
+ }).then(function (_) {
144
+ return _client;
145
+ });
146
+ }
147
+ }]);
148
+ }();
149
+
150
+ function _typeof$8(o) { "@babel/helpers - typeof"; return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$8(o); }
151
+ /**
152
+ * Checks if `value` is the
153
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
154
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
155
+ *
156
+ * @static
157
+ * @memberOf _
158
+ * @since 0.1.0
159
+ * @category Lang
160
+ * @param {*} value The value to check.
161
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
162
+ * @example
163
+ *
164
+ * _.isObject({});
165
+ * // => true
166
+ *
167
+ * _.isObject([1, 2, 3]);
168
+ * // => true
169
+ *
170
+ * _.isObject(_.noop);
171
+ * // => true
172
+ *
173
+ * _.isObject(null);
174
+ * // => false
175
+ */
176
+ function isObject(value) {
177
+ var type = _typeof$8(value);
178
+ return value != null && (type == 'object' || type == 'function');
179
+ }
180
+
181
+ function _typeof$7(o) { "@babel/helpers - typeof"; return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$7(o); }
182
+ /** Detect free variable `global` from Node.js. */
183
+ var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof$7(global)) == 'object' && global && global.Object === Object && global;
184
+ var freeGlobal$1 = freeGlobal;
185
+
186
+ function _typeof$6(o) { "@babel/helpers - typeof"; return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$6(o); }
187
+
188
+ /** Detect free variable `self`. */
189
+ var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof$6(self)) == 'object' && self && self.Object === Object && self;
190
+
191
+ /** Used as a reference to the global object. */
192
+ var root = freeGlobal$1 || freeSelf || Function('return this')();
193
+ var root$1 = root;
194
+
195
+ /**
196
+ * Gets the timestamp of the number of milliseconds that have elapsed since
197
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
198
+ *
199
+ * @static
200
+ * @memberOf _
201
+ * @since 2.4.0
202
+ * @category Date
203
+ * @returns {number} Returns the timestamp.
204
+ * @example
205
+ *
206
+ * _.defer(function(stamp) {
207
+ * console.log(_.now() - stamp);
208
+ * }, _.now());
209
+ * // => Logs the number of milliseconds it took for the deferred invocation.
210
+ */
211
+ var now = function now() {
212
+ return root$1.Date.now();
213
+ };
214
+ var now$1 = now;
215
+
216
+ /** Used to match a single whitespace character. */
217
+ var reWhitespace = /\s/;
218
+
219
+ /**
220
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
221
+ * character of `string`.
222
+ *
223
+ * @private
224
+ * @param {string} string The string to inspect.
225
+ * @returns {number} Returns the index of the last non-whitespace character.
226
+ */
227
+ function trimmedEndIndex(string) {
228
+ var index = string.length;
229
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
230
+ return index;
231
+ }
232
+
233
+ /** Used to match leading whitespace. */
234
+ var reTrimStart = /^\s+/;
235
+
236
+ /**
237
+ * The base implementation of `_.trim`.
238
+ *
239
+ * @private
240
+ * @param {string} string The string to trim.
241
+ * @returns {string} Returns the trimmed string.
242
+ */
243
+ function baseTrim(string) {
244
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string;
245
+ }
246
+
247
+ /** Built-in value references. */
248
+ var _Symbol = root$1.Symbol;
249
+ var _Symbol$1 = _Symbol;
250
+
251
+ /** Used for built-in method references. */
252
+ var objectProto$1 = Object.prototype;
253
+
254
+ /** Used to check objects for own properties. */
255
+ var hasOwnProperty = objectProto$1.hasOwnProperty;
256
+
257
+ /**
258
+ * Used to resolve the
259
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
260
+ * of values.
261
+ */
262
+ var nativeObjectToString$1 = objectProto$1.toString;
263
+
264
+ /** Built-in value references. */
265
+ var symToStringTag$1 = _Symbol$1 ? _Symbol$1.toStringTag : undefined;
266
+
267
+ /**
268
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
269
+ *
270
+ * @private
271
+ * @param {*} value The value to query.
272
+ * @returns {string} Returns the raw `toStringTag`.
273
+ */
274
+ function getRawTag(value) {
275
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1),
276
+ tag = value[symToStringTag$1];
277
+ try {
278
+ value[symToStringTag$1] = undefined;
279
+ var unmasked = true;
280
+ } catch (e) {}
281
+ var result = nativeObjectToString$1.call(value);
282
+ if (unmasked) {
283
+ if (isOwn) {
284
+ value[symToStringTag$1] = tag;
285
+ } else {
286
+ delete value[symToStringTag$1];
287
+ }
288
+ }
289
+ return result;
290
+ }
291
+
292
+ /** Used for built-in method references. */
293
+ var objectProto = Object.prototype;
294
+
295
+ /**
296
+ * Used to resolve the
297
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
298
+ * of values.
299
+ */
300
+ var nativeObjectToString = objectProto.toString;
301
+
302
+ /**
303
+ * Converts `value` to a string using `Object.prototype.toString`.
304
+ *
305
+ * @private
306
+ * @param {*} value The value to convert.
307
+ * @returns {string} Returns the converted string.
308
+ */
309
+ function objectToString(value) {
310
+ return nativeObjectToString.call(value);
311
+ }
312
+
313
+ /** `Object#toString` result references. */
314
+ var nullTag = '[object Null]',
315
+ undefinedTag = '[object Undefined]';
316
+
317
+ /** Built-in value references. */
318
+ var symToStringTag = _Symbol$1 ? _Symbol$1.toStringTag : undefined;
319
+
320
+ /**
321
+ * The base implementation of `getTag` without fallbacks for buggy environments.
322
+ *
323
+ * @private
324
+ * @param {*} value The value to query.
325
+ * @returns {string} Returns the `toStringTag`.
326
+ */
327
+ function baseGetTag(value) {
328
+ if (value == null) {
329
+ return value === undefined ? undefinedTag : nullTag;
330
+ }
331
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
332
+ }
333
+
334
+ function _typeof$5(o) { "@babel/helpers - typeof"; return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$5(o); }
335
+ /**
336
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
337
+ * and has a `typeof` result of "object".
338
+ *
339
+ * @static
340
+ * @memberOf _
341
+ * @since 4.0.0
342
+ * @category Lang
343
+ * @param {*} value The value to check.
344
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
345
+ * @example
346
+ *
347
+ * _.isObjectLike({});
348
+ * // => true
349
+ *
350
+ * _.isObjectLike([1, 2, 3]);
351
+ * // => true
352
+ *
353
+ * _.isObjectLike(_.noop);
354
+ * // => false
355
+ *
356
+ * _.isObjectLike(null);
357
+ * // => false
358
+ */
359
+ function isObjectLike(value) {
360
+ return value != null && _typeof$5(value) == 'object';
361
+ }
362
+
363
+ function _typeof$4(o) { "@babel/helpers - typeof"; return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$4(o); }
364
+
365
+ /** `Object#toString` result references. */
366
+ var symbolTag = '[object Symbol]';
367
+
368
+ /**
369
+ * Checks if `value` is classified as a `Symbol` primitive or object.
370
+ *
371
+ * @static
372
+ * @memberOf _
373
+ * @since 4.0.0
374
+ * @category Lang
375
+ * @param {*} value The value to check.
376
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
377
+ * @example
378
+ *
379
+ * _.isSymbol(Symbol.iterator);
380
+ * // => true
381
+ *
382
+ * _.isSymbol('abc');
383
+ * // => false
384
+ */
385
+ function isSymbol(value) {
386
+ return _typeof$4(value) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
387
+ }
388
+
389
+ /** Used as references for various `Number` constants. */
390
+ var NAN = 0 / 0;
391
+
392
+ /** Used to detect bad signed hexadecimal string values. */
393
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
394
+
395
+ /** Used to detect binary string values. */
396
+ var reIsBinary = /^0b[01]+$/i;
397
+
398
+ /** Used to detect octal string values. */
399
+ var reIsOctal = /^0o[0-7]+$/i;
400
+
401
+ /** Built-in method references without a dependency on `root`. */
402
+ var freeParseInt = parseInt;
403
+
404
+ /**
405
+ * Converts `value` to a number.
406
+ *
407
+ * @static
408
+ * @memberOf _
409
+ * @since 4.0.0
410
+ * @category Lang
411
+ * @param {*} value The value to process.
412
+ * @returns {number} Returns the number.
413
+ * @example
414
+ *
415
+ * _.toNumber(3.2);
416
+ * // => 3.2
417
+ *
418
+ * _.toNumber(Number.MIN_VALUE);
419
+ * // => 5e-324
420
+ *
421
+ * _.toNumber(Infinity);
422
+ * // => Infinity
423
+ *
424
+ * _.toNumber('3.2');
425
+ * // => 3.2
426
+ */
427
+ function toNumber(value) {
428
+ if (typeof value == 'number') {
429
+ return value;
430
+ }
431
+ if (isSymbol(value)) {
432
+ return NAN;
433
+ }
434
+ if (isObject(value)) {
435
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
436
+ value = isObject(other) ? other + '' : other;
437
+ }
438
+ if (typeof value != 'string') {
439
+ return value === 0 ? value : +value;
440
+ }
441
+ value = baseTrim(value);
442
+ var isBinary = reIsBinary.test(value);
443
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
444
+ }
445
+
446
+ /** Error message constants. */
447
+ var FUNC_ERROR_TEXT = 'Expected a function';
448
+
449
+ /* Built-in method references for those with the same name as other `lodash` methods. */
450
+ var nativeMax = Math.max,
451
+ nativeMin = Math.min;
452
+
453
+ /**
454
+ * Creates a debounced function that delays invoking `func` until after `wait`
455
+ * milliseconds have elapsed since the last time the debounced function was
456
+ * invoked. The debounced function comes with a `cancel` method to cancel
457
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
458
+ * Provide `options` to indicate whether `func` should be invoked on the
459
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
460
+ * with the last arguments provided to the debounced function. Subsequent
461
+ * calls to the debounced function return the result of the last `func`
462
+ * invocation.
463
+ *
464
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
465
+ * invoked on the trailing edge of the timeout only if the debounced function
466
+ * is invoked more than once during the `wait` timeout.
467
+ *
468
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
469
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
470
+ *
471
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
472
+ * for details over the differences between `_.debounce` and `_.throttle`.
473
+ *
474
+ * @static
475
+ * @memberOf _
476
+ * @since 0.1.0
477
+ * @category Function
478
+ * @param {Function} func The function to debounce.
479
+ * @param {number} [wait=0] The number of milliseconds to delay.
480
+ * @param {Object} [options={}] The options object.
481
+ * @param {boolean} [options.leading=false]
482
+ * Specify invoking on the leading edge of the timeout.
483
+ * @param {number} [options.maxWait]
484
+ * The maximum time `func` is allowed to be delayed before it's invoked.
485
+ * @param {boolean} [options.trailing=true]
486
+ * Specify invoking on the trailing edge of the timeout.
487
+ * @returns {Function} Returns the new debounced function.
488
+ * @example
489
+ *
490
+ * // Avoid costly calculations while the window size is in flux.
491
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
492
+ *
493
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
494
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
495
+ * 'leading': true,
496
+ * 'trailing': false
497
+ * }));
498
+ *
499
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
500
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
501
+ * var source = new EventSource('/stream');
502
+ * jQuery(source).on('message', debounced);
503
+ *
504
+ * // Cancel the trailing debounced invocation.
505
+ * jQuery(window).on('popstate', debounced.cancel);
506
+ */
507
+ function debounce(func, wait, options) {
508
+ var lastArgs,
509
+ lastThis,
510
+ maxWait,
511
+ result,
512
+ timerId,
513
+ lastCallTime,
514
+ lastInvokeTime = 0,
515
+ leading = false,
516
+ maxing = false,
517
+ trailing = true;
518
+ if (typeof func != 'function') {
519
+ throw new TypeError(FUNC_ERROR_TEXT);
520
+ }
521
+ wait = toNumber(wait) || 0;
522
+ if (isObject(options)) {
523
+ leading = !!options.leading;
524
+ maxing = 'maxWait' in options;
525
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
526
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
527
+ }
528
+ function invokeFunc(time) {
529
+ var args = lastArgs,
530
+ thisArg = lastThis;
531
+ lastArgs = lastThis = undefined;
532
+ lastInvokeTime = time;
533
+ result = func.apply(thisArg, args);
534
+ return result;
535
+ }
536
+ function leadingEdge(time) {
537
+ // Reset any `maxWait` timer.
538
+ lastInvokeTime = time;
539
+ // Start the timer for the trailing edge.
540
+ timerId = setTimeout(timerExpired, wait);
541
+ // Invoke the leading edge.
542
+ return leading ? invokeFunc(time) : result;
543
+ }
544
+ function remainingWait(time) {
545
+ var timeSinceLastCall = time - lastCallTime,
546
+ timeSinceLastInvoke = time - lastInvokeTime,
547
+ timeWaiting = wait - timeSinceLastCall;
548
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
549
+ }
550
+ function shouldInvoke(time) {
551
+ var timeSinceLastCall = time - lastCallTime,
552
+ timeSinceLastInvoke = time - lastInvokeTime;
553
+
554
+ // Either this is the first call, activity has stopped and we're at the
555
+ // trailing edge, the system time has gone backwards and we're treating
556
+ // it as the trailing edge, or we've hit the `maxWait` limit.
557
+ return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
558
+ }
559
+ function timerExpired() {
560
+ var time = now$1();
561
+ if (shouldInvoke(time)) {
562
+ return trailingEdge(time);
563
+ }
564
+ // Restart the timer.
565
+ timerId = setTimeout(timerExpired, remainingWait(time));
566
+ }
567
+ function trailingEdge(time) {
568
+ timerId = undefined;
569
+
570
+ // Only invoke if we have `lastArgs` which means `func` has been
571
+ // debounced at least once.
572
+ if (trailing && lastArgs) {
573
+ return invokeFunc(time);
574
+ }
575
+ lastArgs = lastThis = undefined;
576
+ return result;
577
+ }
578
+ function cancel() {
579
+ if (timerId !== undefined) {
580
+ clearTimeout(timerId);
581
+ }
582
+ lastInvokeTime = 0;
583
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
584
+ }
585
+ function flush() {
586
+ return timerId === undefined ? result : trailingEdge(now$1());
587
+ }
588
+ function debounced() {
589
+ var time = now$1(),
590
+ isInvoking = shouldInvoke(time);
591
+ lastArgs = arguments;
592
+ lastThis = this;
593
+ lastCallTime = time;
594
+ if (isInvoking) {
595
+ if (timerId === undefined) {
596
+ return leadingEdge(lastCallTime);
597
+ }
598
+ if (maxing) {
599
+ // Handle invocations in a tight loop.
600
+ clearTimeout(timerId);
601
+ timerId = setTimeout(timerExpired, wait);
602
+ return invokeFunc(lastCallTime);
603
+ }
604
+ }
605
+ if (timerId === undefined) {
606
+ timerId = setTimeout(timerExpired, wait);
607
+ }
608
+ return result;
609
+ }
610
+ debounced.cancel = cancel;
611
+ debounced.flush = flush;
612
+ return debounced;
613
+ }
614
+
615
+ var createCompletionCacheManager = function createCompletionCacheManager(getFromLanguageService) {
616
+ var completionList;
617
+ var lastWord;
618
+ return {
619
+ getCompletionItems: function getCompletionItems(word, resource, position) {
620
+ var shouldGetItems = !lastWord || !word || !(word !== null && word !== void 0 && word.includes(lastWord));
621
+ if (shouldGetItems) {
622
+ completionList = getFromLanguageService(resource, position);
623
+ }
624
+ lastWord = word;
625
+ return completionList;
626
+ }
627
+ };
628
+ };
629
+
630
+ function createCompletionFilteredText(userInput, completionItem) {
631
+ if (!userInput) return completionItem.filterText;
632
+ var containedInFilterText = completionItem.filterText.toLowerCase().includes(userInput.toLowerCase());
633
+ if (!containedInFilterText) return completionItem.filterText;
634
+ return "".concat(userInput).concat(completionItem.filterText);
635
+ }
636
+ function getFocusedItem(completionItems, userInput) {
637
+ var firstCompletionItem = completionItems[0];
638
+ if (!userInput) return firstCompletionItem;
639
+ var firstMatchingItem = completionItems.find(function (item) {
640
+ var _item$filterText;
641
+ return (_item$filterText = item.filterText) === null || _item$filterText === void 0 ? void 0 : _item$filterText.toLowerCase().startsWith(userInput.toLowerCase());
642
+ });
643
+ return firstMatchingItem !== null && firstMatchingItem !== void 0 ? firstMatchingItem : firstCompletionItem;
644
+ }
645
+
646
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
647
+ function _typeof$3(o) { "@babel/helpers - typeof"; return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$3(o); }
648
+ function _toConsumableArray$1(r) { return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); }
649
+ function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
650
+ function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
651
+ function _iterableToArray$1(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
652
+ function _arrayWithoutHoles$1(r) { if (Array.isArray(r)) return _arrayLikeToArray$1(r); }
653
+ function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
654
+ function _regeneratorRuntime$3() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime$3 = function _regeneratorRuntime() { 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", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof$3(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(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, maybeInvokeDelegate(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 = tryCatch(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 pushTryEntry(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 resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(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 next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof$3(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "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 next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(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(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(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 complete(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 finish(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), resetTryEntry(r), y; } }, catch: function _catch(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; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
655
+ function asyncGeneratorStep$3(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
656
+ function _asyncToGenerator$3(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep$3(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep$3(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
657
+ function _classCallCheck$1(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
658
+ function _defineProperties$1(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$2(o.key), o); } }
659
+ function _createClass$1(e, r, t) { return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
660
+ function _defineProperty$1(e, r, t) { return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
661
+ function _toPropertyKey$2(t) { var i = _toPrimitive$2(t, "string"); return "symbol" == _typeof$3(i) ? i : i + ""; }
662
+ function _toPrimitive$2(t, r) { if ("object" != _typeof$3(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$3(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
663
+
664
+ // --- diagnostics ---
665
+
666
+ var DiagnosticsAdapter = /*#__PURE__*/function () {
667
+ function DiagnosticsAdapter(_monacoInstance, _languageId, _worker, defaults, onSchemaChange) {
668
+ var _this = this;
669
+ _classCallCheck$1(this, DiagnosticsAdapter);
670
+ _defineProperty$1(this, "_disposables", []);
671
+ _defineProperty$1(this, "_contentListener", Object.create(null));
672
+ _defineProperty$1(this, "_configurationListener", Object.create(null));
673
+ _defineProperty$1(this, "_schemaListener", Object.create(null));
674
+ _defineProperty$1(this, "_cursorListener", Object.create(null));
675
+ _defineProperty$1(this, "_debouncedValidations", Object.create(null));
676
+ this._monacoInstance = _monacoInstance;
677
+ this._languageId = _languageId;
678
+ this._worker = _worker;
679
+ this.defaults = defaults;
680
+ var onModelAdd = function onModelAdd(model) {
681
+ var languageId = model.getLanguageId();
682
+ var modelUri = model.uri.toString();
683
+ if (languageId !== _this._languageId) {
684
+ return;
685
+ }
686
+ var debouncedValidation = _this.getOrCreateDebouncedValidation(model, languageId);
687
+ _this._contentListener[modelUri] = model.onDidChangeContent(function (e) {
688
+ var intervalsToValidate = changeEventToIntervals(e);
689
+ debouncedValidation(intervalsToValidate);
690
+ });
691
+ _this._configurationListener[modelUri] = _this.defaults.onDidChange(function () {
692
+ self.setTimeout(function () {
693
+ return _this._doValidate(model, languageId, []);
694
+ }, 0);
695
+ });
696
+ _this._schemaListener[modelUri] = onSchemaChange(function () {
697
+ self.setTimeout(function () {
698
+ return _this._doValidate(model, languageId, []);
699
+ }, 0);
700
+ });
701
+ };
702
+ var onEditorAdd = function onEditorAdd(editor) {
703
+ var editorId = editor.getId();
704
+ if (!_this._cursorListener[editorId]) {
705
+ editor.onDidDispose(function () {
706
+ var _this$_cursorListener;
707
+ (_this$_cursorListener = _this._cursorListener[editorId]) === null || _this$_cursorListener === void 0 || _this$_cursorListener.dispose();
708
+ delete _this._cursorListener[editorId];
709
+ });
710
+ _this._cursorListener[editorId] = editor.onDidChangeCursorSelection(function (e) {
711
+ var model = editor.getModel();
712
+ var languageId = model.getLanguageId();
713
+ if (languageId !== _this._languageId) {
714
+ return;
715
+ }
716
+ var cursorOffset = model.getOffsetAt(e.selection.getPosition());
717
+ var debouncedValidation = _this.getOrCreateDebouncedValidation(model, languageId);
718
+ debouncedValidation([{
719
+ start: cursorOffset,
720
+ end: cursorOffset
721
+ }]);
722
+ });
723
+ }
724
+ };
725
+ var onModelRemoved = function onModelRemoved(model) {
726
+ _this._monacoInstance.editor.setModelMarkers(model, _this._languageId, []);
727
+ var uriStr = model.uri.toString();
728
+ var contentListener = _this._contentListener[uriStr];
729
+ if (contentListener) {
730
+ contentListener.dispose();
731
+ delete _this._contentListener[uriStr];
732
+ }
733
+ var configurationListener = _this._configurationListener[uriStr];
734
+ if (configurationListener) {
735
+ configurationListener.dispose();
736
+ delete _this._configurationListener[uriStr];
737
+ }
738
+ var schemaListener = _this._schemaListener[uriStr];
739
+ if (schemaListener) {
740
+ schemaListener.dispose();
741
+ delete _this._schemaListener[uriStr];
742
+ }
743
+ var debouncedValidation = _this._debouncedValidations[uriStr];
744
+ if (debouncedValidation) {
745
+ debouncedValidation.cancel();
746
+ delete _this._debouncedValidations[uriStr];
747
+ }
748
+ };
749
+ if (this.defaults.languageSettings.enableQuickFixes) {
750
+ this._disposables.push(monaco__namespace.languages.registerCodeActionProvider(this._languageId, {
751
+ provideCodeActions: function () {
752
+ var _provideCodeActions = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(model, range, context, _token) {
753
+ var startOffset, endOffset, showQuickFix, actions;
754
+ return _regeneratorRuntime$3().wrap(function _callee$(_context) {
755
+ while (1) switch (_context.prev = _context.next) {
756
+ case 0:
757
+ startOffset = model.getOffsetAt(range.getStartPosition());
758
+ endOffset = model.getOffsetAt(range.getEndPosition()); // We want to show the quick fix option only if we have markers in our selected range
759
+ showQuickFix = context.markers.length > 0;
760
+ _context.next = 5;
761
+ return _this.getMonacoCodeActions(model, startOffset, endOffset, showQuickFix);
762
+ case 5:
763
+ actions = _context.sent;
764
+ return _context.abrupt("return", {
765
+ actions: actions,
766
+ dispose: function dispose() {}
767
+ });
768
+ case 7:
769
+ case "end":
770
+ return _context.stop();
771
+ }
772
+ }, _callee);
773
+ }));
774
+ function provideCodeActions(_x, _x2, _x3, _x4) {
775
+ return _provideCodeActions.apply(this, arguments);
776
+ }
777
+ return provideCodeActions;
778
+ }()
779
+ }));
780
+ }
781
+ this._disposables.push(this._monacoInstance.editor.onDidCreateEditor(onEditorAdd));
782
+ this._disposables.push(this._monacoInstance.editor.onDidCreateModel(onModelAdd));
783
+ this._disposables.push(this._monacoInstance.editor.onWillDisposeModel(onModelRemoved));
784
+ this._disposables.push(this._monacoInstance.editor.onDidChangeModelLanguage(function (event) {
785
+ onModelRemoved(event.model);
786
+ onModelAdd(event.model);
787
+ }));
788
+ this._disposables.push({
789
+ dispose: function dispose() {
790
+ for (var key in _this._contentListener) {
791
+ _this._contentListener[key].dispose();
792
+ }
793
+ for (var _key in _this._cursorListener) {
794
+ _this._cursorListener[_key].dispose();
795
+ }
796
+ for (var _key2 in _this._debouncedValidations) {
797
+ _this._debouncedValidations[_key2].cancel();
798
+ }
799
+ }
800
+ });
801
+ this._monacoInstance.editor.getModels().forEach(onModelAdd);
802
+ this._monacoInstance.editor.getEditors().forEach(onEditorAdd);
803
+ }
804
+ return _createClass$1(DiagnosticsAdapter, [{
805
+ key: "getMonacoCodeActions",
806
+ value: function () {
807
+ var _getMonacoCodeActions = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee2(model, startOffset, endOffset, enableQuickFix) {
808
+ var _this2 = this;
809
+ var actions, worker, resource, codeActions, _loop, _ret, i;
810
+ return _regeneratorRuntime$3().wrap(function _callee2$(_context3) {
811
+ while (1) switch (_context3.prev = _context3.next) {
812
+ case 0:
813
+ actions = [];
814
+ _context3.next = 3;
815
+ return this._worker(model.uri);
816
+ case 3:
817
+ worker = _context3.sent;
818
+ resource = model.uri;
819
+ _context3.next = 7;
820
+ return worker.getResultActions(resource.toString(), startOffset, endOffset);
821
+ case 7:
822
+ codeActions = _context3.sent;
823
+ _loop = /*#__PURE__*/_regeneratorRuntime$3().mark(function _loop() {
824
+ var _this2$defaults$langu;
825
+ var codeAction, codeActionKind, changes, edits;
826
+ return _regeneratorRuntime$3().wrap(function _loop$(_context2) {
827
+ while (1) switch (_context2.prev = _context2.next) {
828
+ case 0:
829
+ codeAction = codeActions[i];
830
+ if (!codeAction.kind.includes('Extract Function')) {
831
+ _context2.next = 3;
832
+ break;
833
+ }
834
+ return _context2.abrupt("return", 0);
835
+ case 3:
836
+ codeActionKind = (_this2$defaults$langu = _this2.defaults.languageSettings.quickFixCodeActions) !== null && _this2$defaults$langu !== void 0 && _this2$defaults$langu.find(function (actionKind) {
837
+ return codeAction.kind.includes(actionKind);
838
+ }) ? 'quickfix' : 'custom';
839
+ if (!(codeActionKind === 'quickfix' && !enableQuickFix)) {
840
+ _context2.next = 6;
841
+ break;
842
+ }
843
+ return _context2.abrupt("return", {
844
+ v: void 0
845
+ });
846
+ case 6:
847
+ changes = codeAction.changes;
848
+ edits = changes.map(function (change) {
849
+ var _change$insertText;
850
+ var startPosition = model.getPositionAt(change.start);
851
+ var endPosition = model.getPositionAt(change.start + change.deleteLength);
852
+ return {
853
+ resource: model.uri,
854
+ textEdit: {
855
+ range: {
856
+ startLineNumber: startPosition.lineNumber,
857
+ startColumn: startPosition.column,
858
+ endLineNumber: endPosition.lineNumber,
859
+ endColumn: endPosition.column
860
+ },
861
+ text: (_change$insertText = change.insertText) !== null && _change$insertText !== void 0 ? _change$insertText : ''
862
+ }
863
+ };
864
+ });
865
+ actions.push({
866
+ title: codeAction.title,
867
+ diagnostics: [],
868
+ kind: codeActionKind,
869
+ edit: {
870
+ edits: _toConsumableArray$1(edits)
871
+ }
872
+ });
873
+ case 9:
874
+ case "end":
875
+ return _context2.stop();
876
+ }
877
+ }, _loop);
878
+ });
879
+ i = 0;
880
+ case 10:
881
+ if (!(i < codeActions.length)) {
882
+ _context3.next = 20;
883
+ break;
884
+ }
885
+ return _context3.delegateYield(_loop(), "t0", 12);
886
+ case 12:
887
+ _ret = _context3.t0;
888
+ if (!(_ret === 0)) {
889
+ _context3.next = 15;
890
+ break;
891
+ }
892
+ return _context3.abrupt("continue", 17);
893
+ case 15:
894
+ if (!_ret) {
895
+ _context3.next = 17;
896
+ break;
897
+ }
898
+ return _context3.abrupt("return", _ret.v);
899
+ case 17:
900
+ i++;
901
+ _context3.next = 10;
902
+ break;
903
+ case 20:
904
+ return _context3.abrupt("return", actions);
905
+ case 21:
906
+ case "end":
907
+ return _context3.stop();
908
+ }
909
+ }, _callee2, this);
910
+ }));
911
+ function getMonacoCodeActions(_x5, _x6, _x7, _x8) {
912
+ return _getMonacoCodeActions.apply(this, arguments);
913
+ }
914
+ return getMonacoCodeActions;
915
+ }()
916
+ }, {
917
+ key: "getOrCreateDebouncedValidation",
918
+ value: function getOrCreateDebouncedValidation(model, languageId) {
919
+ var _this3 = this;
920
+ var modelUri = model.uri.toString();
921
+ if (!this._debouncedValidations[modelUri]) {
922
+ this._debouncedValidations[modelUri] = debounce(function (intervals) {
923
+ return _this3._doValidate(model, languageId, intervals);
924
+ }, 500);
925
+ }
926
+ return this._debouncedValidations[modelUri];
927
+ }
928
+ }, {
929
+ key: "dispose",
930
+ value: function dispose() {
931
+ this._disposables.forEach(function (d) {
932
+ return d && d.dispose();
933
+ });
934
+ this._disposables = [];
935
+ }
936
+ }, {
937
+ key: "_doValidate",
938
+ value: function _doValidate(model, languageId, intervals) {
939
+ var _this4 = this;
940
+ if (model.isDisposed()) {
941
+ return;
942
+ }
943
+ var resource = model.uri;
944
+ var versionNumberBefore = model.getVersionId();
945
+ this._worker(resource).then(function (worker) {
946
+ return worker.doValidation(resource.toString(), intervals);
947
+ }).then(function (diagnostics) {
948
+ var newModel = _this4._monacoInstance.editor.getModel(resource);
949
+ var versionId = newModel.getVersionId();
950
+ if (versionId !== versionNumberBefore) {
951
+ return;
952
+ }
953
+ var markers = diagnostics.map(function (d) {
954
+ return toDiagnostics(resource, d);
955
+ });
956
+ var model = _this4._monacoInstance.editor.getModel(resource);
957
+ var oldDecorations = model.getAllDecorations().filter(function (decoration) {
958
+ return decoration.options.className == 'squiggly-error';
959
+ }).map(function (decoration) {
960
+ return decoration.id;
961
+ });
962
+ if (model && model.getLanguageId() === languageId) {
963
+ var syntaxErrorAsMarkDown = _this4.defaults.languageSettings.syntaxErrorAsMarkDown;
964
+ if (!syntaxErrorAsMarkDown || !syntaxErrorAsMarkDown.enableSyntaxErrorAsMarkDown) {
965
+ // Remove previous syntax error decorations and set the new markers (for example, when disabling syntaxErrorAsMarkDown after it was enabled)
966
+ model.deltaDecorations(oldDecorations, []);
967
+ _this4._monacoInstance.editor.setModelMarkers(model, languageId, markers);
968
+ } else {
969
+ // Add custom popup for syntax error: icon, header and message as markdown
970
+ var header = syntaxErrorAsMarkDown.header ? "**".concat(syntaxErrorAsMarkDown.header, "** \n\n") : '';
971
+ var icon = syntaxErrorAsMarkDown.icon ? "![](".concat(syntaxErrorAsMarkDown.icon, ")") : '';
972
+ var popupErrorHoverHeaderMessage = "".concat(icon, " ").concat(header);
973
+ var newDecorations = markers.map(function (marker) {
974
+ return {
975
+ range: {
976
+ startLineNumber: marker.startLineNumber,
977
+ startColumn: marker.startColumn,
978
+ endLineNumber: marker.endLineNumber,
979
+ endColumn: marker.endColumn
980
+ },
981
+ options: {
982
+ hoverMessage: {
983
+ value: popupErrorHoverHeaderMessage + marker.message
984
+ },
985
+ className: 'squiggly-error',
986
+ // monaco syntax error style (red underline)
987
+ zIndex: 100,
988
+ // This message will be the upper most mesage in the popup
989
+ overviewRuler: {
990
+ // The color indication on the right ruler
991
+ color: 'rgb(255, 18, 18, 0.7)',
992
+ position: monaco__namespace.editor.OverviewRulerLane.Right
993
+ },
994
+ minimap: {
995
+ color: 'rgb(255, 18, 18, 0.7)',
996
+ position: monaco__namespace.editor.MinimapPosition.Inline
997
+ }
998
+ }
999
+ };
1000
+ });
1001
+ var oldMarkers = monaco__namespace.editor.getModelMarkers({
1002
+ owner: languageId,
1003
+ resource: resource
1004
+ });
1005
+ if (oldMarkers && oldMarkers.length > 0) {
1006
+ // In case there were previous markers, remove their decorations (for example, when enabling syntaxErrorAsMarkDown after it was disabled)
1007
+ oldDecorations = [];
1008
+ // Remove previous markers
1009
+ _this4._monacoInstance.editor.setModelMarkers(model, languageId, []);
1010
+ }
1011
+
1012
+ // Remove previous syntax error decorations and set the new decorations
1013
+ model.deltaDecorations(oldDecorations, newDecorations);
1014
+ }
1015
+ }
1016
+ }).then(undefined, function (err) {
1017
+ console.error(err);
1018
+ });
1019
+ }
1020
+ }]);
1021
+ }();
1022
+ function changeEventToIntervals(e) {
1023
+ return e.changes.map(function (change) {
1024
+ return {
1025
+ start: change.rangeOffset,
1026
+ end: change.rangeOffset + change.text.length
1027
+ };
1028
+ });
1029
+ }
1030
+ function toSeverity(lsSeverity) {
1031
+ switch (lsSeverity) {
1032
+ case main.DiagnosticSeverity.Error:
1033
+ return monaco__namespace.MarkerSeverity.Error;
1034
+ case main.DiagnosticSeverity.Warning:
1035
+ return monaco__namespace.MarkerSeverity.Warning;
1036
+ case main.DiagnosticSeverity.Information:
1037
+ return monaco__namespace.MarkerSeverity.Info;
1038
+ case main.DiagnosticSeverity.Hint:
1039
+ return monaco__namespace.MarkerSeverity.Hint;
1040
+ default:
1041
+ return monaco__namespace.MarkerSeverity.Info;
1042
+ }
1043
+ }
1044
+ function toDiagnostics(resource, diag) {
1045
+ var code = typeof diag.code === 'number' ? String(diag.code) : diag.code;
1046
+ return {
1047
+ severity: toSeverity(diag.severity),
1048
+ startLineNumber: diag.range.start.line + 1,
1049
+ startColumn: diag.range.start.character + 1,
1050
+ endLineNumber: diag.range.end.line + 1,
1051
+ endColumn: diag.range.end.character + 1,
1052
+ message: diag.message,
1053
+ code: code,
1054
+ source: diag.source
1055
+ };
1056
+ }
1057
+
1058
+ // --- completion ------
1059
+
1060
+ function fromPosition(position) {
1061
+ if (!position) {
1062
+ return void 0;
1063
+ }
1064
+ return {
1065
+ character: position.column - 1,
1066
+ line: position.lineNumber - 1
1067
+ };
1068
+ }
1069
+ function fromRange(range) {
1070
+ if (!range) {
1071
+ return void 0;
1072
+ }
1073
+ return {
1074
+ start: fromPosition(range.getStartPosition()),
1075
+ end: fromPosition(range.getEndPosition())
1076
+ };
1077
+ }
1078
+ function toRange(range) {
1079
+ if (!range) {
1080
+ return void 0;
1081
+ }
1082
+ return new monaco__namespace.Range(range.start.line + 1, range.start.character + 1, range.end.line + 1, range.end.character + 1);
1083
+ }
1084
+ function toCompletionItemKind(kind) {
1085
+ var mItemKind = monaco__namespace.languages.CompletionItemKind;
1086
+ switch (kind) {
1087
+ case main.CompletionItemKind.Text:
1088
+ return mItemKind.Text;
1089
+ case main.CompletionItemKind.Method:
1090
+ return mItemKind.Method;
1091
+ case main.CompletionItemKind.Function:
1092
+ return mItemKind.Function;
1093
+ case main.CompletionItemKind.Constructor:
1094
+ return mItemKind.Constructor;
1095
+ case main.CompletionItemKind.Field:
1096
+ return mItemKind.Field;
1097
+ case main.CompletionItemKind.Variable:
1098
+ return mItemKind.Variable;
1099
+ case main.CompletionItemKind.Class:
1100
+ return mItemKind.Class;
1101
+ case main.CompletionItemKind.Interface:
1102
+ return mItemKind.Interface;
1103
+ case main.CompletionItemKind.Module:
1104
+ return mItemKind.Module;
1105
+ case main.CompletionItemKind.Property:
1106
+ return mItemKind.Property;
1107
+ case main.CompletionItemKind.Unit:
1108
+ return mItemKind.Unit;
1109
+ case main.CompletionItemKind.Value:
1110
+ return mItemKind.Value;
1111
+ case main.CompletionItemKind.Enum:
1112
+ return mItemKind.Enum;
1113
+ case main.CompletionItemKind.Keyword:
1114
+ return mItemKind.Keyword;
1115
+ case main.CompletionItemKind.Snippet:
1116
+ return mItemKind.Snippet;
1117
+ case main.CompletionItemKind.Color:
1118
+ return mItemKind.Color;
1119
+ case main.CompletionItemKind.File:
1120
+ return mItemKind.File;
1121
+ case main.CompletionItemKind.Reference:
1122
+ return mItemKind.Reference;
1123
+ }
1124
+ return mItemKind.Property;
1125
+ }
1126
+ function toTextEdit(textEdit) {
1127
+ if (!textEdit) {
1128
+ return void 0;
1129
+ }
1130
+ return {
1131
+ range: toRange(textEdit.range),
1132
+ text: textEdit.newText
1133
+ };
1134
+ }
1135
+ var DEFAULT_DOCS_BASE_URL = 'https://learn.microsoft.com/azure/data-explorer/kusto/query';
1136
+ var CompletionAdapter = /*#__PURE__*/function () {
1137
+ function CompletionAdapter(workerAccessor, languageSettings) {
1138
+ _classCallCheck$1(this, CompletionAdapter);
1139
+ this.languageSettings = languageSettings;
1140
+ var getFromLanguageService = /*#__PURE__*/function () {
1141
+ var _ref = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee3(resource, position) {
1142
+ var worker;
1143
+ return _regeneratorRuntime$3().wrap(function _callee3$(_context4) {
1144
+ while (1) switch (_context4.prev = _context4.next) {
1145
+ case 0:
1146
+ _context4.next = 2;
1147
+ return workerAccessor(resource);
1148
+ case 2:
1149
+ worker = _context4.sent;
1150
+ return _context4.abrupt("return", worker.doComplete(resource.toString(), position));
1151
+ case 4:
1152
+ case "end":
1153
+ return _context4.stop();
1154
+ }
1155
+ }, _callee3);
1156
+ }));
1157
+ return function getFromLanguageService(_x9, _x10) {
1158
+ return _ref.apply(this, arguments);
1159
+ };
1160
+ }();
1161
+ this.completionCacheManager = createCompletionCacheManager(getFromLanguageService);
1162
+ }
1163
+ return _createClass$1(CompletionAdapter, [{
1164
+ key: "triggerCharacters",
1165
+ get: function get() {
1166
+ return [' ', '.', '('];
1167
+ }
1168
+ }, {
1169
+ key: "provideCompletionItems",
1170
+ value: function provideCompletionItems(model, position, context, token) {
1171
+ var _model$getWordAtPosit,
1172
+ _this5 = this;
1173
+ var wordInfo = model.getWordUntilPosition(position);
1174
+ var wordRange = new monaco__namespace.Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
1175
+ var resource = model.uri;
1176
+ var userInput = model === null || model === void 0 || (_model$getWordAtPosit = model.getWordAtPosition(position)) === null || _model$getWordAtPosit === void 0 ? void 0 : _model$getWordAtPosit.word;
1177
+ var onDidProvideCompletionItems = this.languageSettings.onDidProvideCompletionItems;
1178
+ return this.completionCacheManager.getCompletionItems(userInput, resource, fromPosition(position)).then(function (info) {
1179
+ return onDidProvideCompletionItems ? onDidProvideCompletionItems(info) : info;
1180
+ }).then(function (info) {
1181
+ if (!info) return;
1182
+ var selectedItem = getFocusedItem(info.items, userInput);
1183
+ var items = info.items.map(function (entry, index) {
1184
+ var _entry$documentation;
1185
+ var item = {
1186
+ label: entry.label,
1187
+ insertText: entry.insertText,
1188
+ sortText: entry.sortText,
1189
+ filterText: createCompletionFilteredText(userInput, entry),
1190
+ // TODO: Is this cast safe?
1191
+ documentation: _this5.formatDocLink((_entry$documentation = entry.documentation) === null || _entry$documentation === void 0 ? void 0 : _entry$documentation.value),
1192
+ detail: entry.detail,
1193
+ range: wordRange,
1194
+ kind: toCompletionItemKind(entry.kind),
1195
+ preselect: selectedItem.filterText === entry.filterText
1196
+ };
1197
+ if (entry.textEdit) {
1198
+ // TODO: Where is the "range" property coming from?
1199
+ item.range = toRange(entry.textEdit.range);
1200
+ item.insertText = entry.textEdit.newText;
1201
+ }
1202
+ if (entry.insertTextFormat === main.InsertTextFormat.Snippet) {
1203
+ item.insertTextRules = monaco__namespace.languages.CompletionItemInsertTextRule.InsertAsSnippet;
1204
+ }
1205
+ return item;
1206
+ });
1207
+ return {
1208
+ incomplete: true,
1209
+ suggestions: items
1210
+ };
1211
+ });
1212
+ }
1213
+ }, {
1214
+ key: "formatDocLink",
1215
+ value: function formatDocLink(docString) {
1216
+ // If the docString is empty, we want to return undefined to prevent an empty documentation popup.
1217
+ if (!docString) {
1218
+ return undefined;
1219
+ }
1220
+ var _this$languageSetting = this.languageSettings,
1221
+ _this$languageSetting2 = _this$languageSetting.documentationBaseUrl,
1222
+ documentationBaseUrl = _this$languageSetting2 === void 0 ? DEFAULT_DOCS_BASE_URL : _this$languageSetting2,
1223
+ documentationSuffix = _this$languageSetting.documentationSuffix;
1224
+ var urisProxy = new Proxy({}, {
1225
+ get: function get(_target, prop, _receiver) {
1226
+ // The link comes with a postfix of ".md" that we want to remove
1227
+ var url = prop.toString().replace('.md', '');
1228
+ // Sometimes we get the link as a full URL. For example in the main doc link of the item
1229
+ if (!url.startsWith('https')) {
1230
+ url = "".concat(documentationBaseUrl, "/").concat(url);
1231
+ }
1232
+ var monacoUri = monaco__namespace.Uri.parse(url);
1233
+ if (documentationSuffix) {
1234
+ // We need to override the toString method to add the suffix, otherwise it gets encoded and page doesn't open
1235
+ monacoUri.toString = function () {
1236
+ return url + documentationSuffix;
1237
+ };
1238
+ }
1239
+ return monacoUri;
1240
+ }
1241
+ });
1242
+ return {
1243
+ value: docString,
1244
+ isTrusted: true,
1245
+ uris: urisProxy
1246
+ };
1247
+ }
1248
+ }]);
1249
+ }();
1250
+ function isMarkupContent(thing) {
1251
+ return thing && _typeof$3(thing) === 'object' && typeof thing.kind === 'string';
1252
+ }
1253
+ function toMarkdownString(entry) {
1254
+ if (typeof entry === 'string') {
1255
+ return {
1256
+ value: entry
1257
+ };
1258
+ }
1259
+ if (isMarkupContent(entry)) {
1260
+ if (entry.kind === 'plaintext') {
1261
+ return {
1262
+ value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
1263
+ };
1264
+ }
1265
+ return {
1266
+ value: entry.value
1267
+ };
1268
+ }
1269
+ return {
1270
+ value: '```' + entry.value + '\n' + entry.value + '\n```\n'
1271
+ };
1272
+ }
1273
+ function toMarkedStringArray(contents) {
1274
+ if (!contents) {
1275
+ return void 0;
1276
+ }
1277
+ if (Array.isArray(contents)) {
1278
+ return contents.map(toMarkdownString);
1279
+ }
1280
+ return [toMarkdownString(contents)];
1281
+ }
1282
+
1283
+ // --- definition ------
1284
+
1285
+ function toLocation(location) {
1286
+ return {
1287
+ uri: monaco__namespace.Uri.parse(location.uri),
1288
+ range: toRange(location.range)
1289
+ };
1290
+ }
1291
+ var DefinitionAdapter = /*#__PURE__*/function () {
1292
+ function DefinitionAdapter(_worker) {
1293
+ _classCallCheck$1(this, DefinitionAdapter);
1294
+ this._worker = _worker;
1295
+ }
1296
+ return _createClass$1(DefinitionAdapter, [{
1297
+ key: "provideDefinition",
1298
+ value: function provideDefinition(model, position, token) {
1299
+ var resource = model.uri;
1300
+ return this._worker(resource).then(function (worker) {
1301
+ return worker.findDefinition(resource.toString(), fromPosition(position));
1302
+ }).then(function (definition) {
1303
+ if (!definition || definition.length == 0) {
1304
+ return;
1305
+ }
1306
+ return [toLocation(definition[0])];
1307
+ });
1308
+ }
1309
+ }]);
1310
+ }();
1311
+
1312
+ // --- references ------
1313
+
1314
+ var ReferenceAdapter = /*#__PURE__*/function () {
1315
+ function ReferenceAdapter(_worker) {
1316
+ _classCallCheck$1(this, ReferenceAdapter);
1317
+ this._worker = _worker;
1318
+ }
1319
+ return _createClass$1(ReferenceAdapter, [{
1320
+ key: "provideReferences",
1321
+ value: function provideReferences(model, position, context, token) {
1322
+ var resource = model.uri;
1323
+ return this._worker(resource).then(function (worker) {
1324
+ return worker.findReferences(resource.toString(), fromPosition(position));
1325
+ }).then(function (entries) {
1326
+ if (!entries) {
1327
+ return;
1328
+ }
1329
+ return entries.map(toLocation);
1330
+ });
1331
+ }
1332
+ }]);
1333
+ }();
1334
+
1335
+ // --- rename ------
1336
+
1337
+ function toWorkspaceEdit(edit) {
1338
+ if (!edit || !edit.changes) {
1339
+ return void 0;
1340
+ }
1341
+ var resourceEdits = [];
1342
+ for (var uri in edit.changes) {
1343
+ var _uri = monaco__namespace.Uri.parse(uri);
1344
+ var _iterator = _createForOfIteratorHelper(edit.changes[uri]),
1345
+ _step;
1346
+ try {
1347
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1348
+ var _e = _step.value;
1349
+ resourceEdits.push({
1350
+ resource: _uri,
1351
+ textEdit: {
1352
+ range: toRange(_e.range),
1353
+ text: _e.newText
1354
+ },
1355
+ versionId: undefined
1356
+ });
1357
+ }
1358
+ } catch (err) {
1359
+ _iterator.e(err);
1360
+ } finally {
1361
+ _iterator.f();
1362
+ }
1363
+ }
1364
+ return {
1365
+ edits: resourceEdits
1366
+ };
1367
+ }
1368
+ var RenameAdapter = /*#__PURE__*/function () {
1369
+ function RenameAdapter(_worker) {
1370
+ _classCallCheck$1(this, RenameAdapter);
1371
+ this._worker = _worker;
1372
+ }
1373
+ return _createClass$1(RenameAdapter, [{
1374
+ key: "provideRenameEdits",
1375
+ value: function provideRenameEdits(model, position, newName, token) {
1376
+ var resource = model.uri;
1377
+ return this._worker(resource).then(function (worker) {
1378
+ return worker.doRename(resource.toString(), fromPosition(position), newName);
1379
+ }).then(function (edit) {
1380
+ return toWorkspaceEdit(edit);
1381
+ });
1382
+ }
1383
+ }]);
1384
+ }();
1385
+
1386
+ // --- formatting -----
1387
+
1388
+ var DocumentFormatAdapter = /*#__PURE__*/function () {
1389
+ function DocumentFormatAdapter(_worker) {
1390
+ _classCallCheck$1(this, DocumentFormatAdapter);
1391
+ this._worker = _worker;
1392
+ }
1393
+ return _createClass$1(DocumentFormatAdapter, [{
1394
+ key: "provideDocumentFormattingEdits",
1395
+ value: function provideDocumentFormattingEdits(model, options, token) {
1396
+ var resource = model.uri;
1397
+ return this._worker(resource).then(function (worker) {
1398
+ return worker.doDocumentFormat(resource.toString()).then(function (edits) {
1399
+ return edits.map(function (edit) {
1400
+ return toTextEdit(edit);
1401
+ });
1402
+ });
1403
+ });
1404
+ }
1405
+ }]);
1406
+ }();
1407
+ var FormatAdapter = /*#__PURE__*/function () {
1408
+ function FormatAdapter(_worker) {
1409
+ _classCallCheck$1(this, FormatAdapter);
1410
+ this._worker = _worker;
1411
+ }
1412
+ return _createClass$1(FormatAdapter, [{
1413
+ key: "provideDocumentRangeFormattingEdits",
1414
+ value: function provideDocumentRangeFormattingEdits(model, range, options, token) {
1415
+ var resource = model.uri;
1416
+ return this._worker(resource).then(function (worker) {
1417
+ return worker.doRangeFormat(resource.toString(), fromRange(range)).then(function (edits) {
1418
+ return edits.map(function (edit) {
1419
+ return toTextEdit(edit);
1420
+ });
1421
+ });
1422
+ });
1423
+ }
1424
+ }]);
1425
+ }();
1426
+
1427
+ // --- Folding ---
1428
+ var FoldingAdapter = /*#__PURE__*/function () {
1429
+ function FoldingAdapter(_worker) {
1430
+ _classCallCheck$1(this, FoldingAdapter);
1431
+ this._worker = _worker;
1432
+ }
1433
+ return _createClass$1(FoldingAdapter, [{
1434
+ key: "provideFoldingRanges",
1435
+ value: function provideFoldingRanges(model, context, token) {
1436
+ var resource = model.uri;
1437
+ return this._worker(resource).then(function (worker) {
1438
+ return worker.doFolding(resource.toString()).then(function (foldingRanges) {
1439
+ return foldingRanges.map(function (range) {
1440
+ return toFoldingRange(range);
1441
+ });
1442
+ });
1443
+ });
1444
+ }
1445
+ }]);
1446
+ }();
1447
+ function toFoldingRange(range) {
1448
+ return {
1449
+ start: range.startLine + 1,
1450
+ end: range.endLine + 1,
1451
+ kind: monaco__namespace.languages.FoldingRangeKind.Region
1452
+ };
1453
+ }
1454
+
1455
+ // --- hover ------
1456
+
1457
+ var HoverAdapter = /*#__PURE__*/function () {
1458
+ function HoverAdapter(_worker) {
1459
+ _classCallCheck$1(this, HoverAdapter);
1460
+ this._worker = _worker;
1461
+ }
1462
+ return _createClass$1(HoverAdapter, [{
1463
+ key: "provideHover",
1464
+ value: function provideHover(model, position, token) {
1465
+ var resource = model.uri;
1466
+ return this._worker(resource).then(function (worker) {
1467
+ return worker.doHover(resource.toString(), fromPosition(position));
1468
+ }).then(function (info) {
1469
+ if (!info) {
1470
+ return;
1471
+ }
1472
+ return {
1473
+ range: toRange(info.range),
1474
+ contents: toMarkedStringArray(info.contents)
1475
+ };
1476
+ });
1477
+ }
1478
+ }]);
1479
+ }();
1480
+
1481
+ var 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'];
1482
+ var queryParameters = ['kind'];
1483
+ var types = ['bool', 'datetime', 'decimal', 'double', 'dynamic', 'guid', 'int', 'long', 'real', 'string', 'timespan'];
1484
+ var 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'];
1485
+ var 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'];
1486
+ var 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'];
1487
+ var kustoLanguageDefinition = {
1488
+ name: types$1.LANGUAGE_ID,
1489
+ mimeTypes: ['text/kusto'],
1490
+ displayName: 'Kusto',
1491
+ defaultToken: 'invalid',
1492
+ queryOperators: queryOperators,
1493
+ queryParameters: queryParameters,
1494
+ types: types,
1495
+ commands: commands,
1496
+ functions: functions,
1497
+ keywords: keywords,
1498
+ tokenizer: {
1499
+ root: [[/(\/\/.*$)/, types$1.Token.Comment], [/[\(\)\{\}\|\[\]\:\=\,\<|\.\..]/, types$1.Token.Punctuation], [/[\+\-\*\/\%\!\<\<=\>\>=\=\==\!=\<>\:\;\,\=~\@\?\=>\!~]/, types$1.Token.MathOperator], [/"([^"\\]*(\\.[^"\\]*)*)"/, types$1.Token.StringLiteral], [/'([^"\\]*(\\.[^"\\]*)*)'/, types$1.Token.StringLiteral], [/[\w@#\-$\.]+/, {
1500
+ cases: {
1501
+ '@queryOperators': types$1.Token.QueryOperator,
1502
+ '@queryParameters': types$1.Token.QueryParameter,
1503
+ '@types': types$1.Token.Type,
1504
+ '@commands': types$1.Token.Command,
1505
+ '@functions': types$1.Token.Function,
1506
+ '@keywords': types$1.Token.Keyword,
1507
+ '@default': 'identifier'
1508
+ }
1509
+ }]]
1510
+ }
1511
+ };
1512
+
1513
+ function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$2(o); }
1514
+ function _regeneratorRuntime$2() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime$2 = function _regeneratorRuntime() { 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", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof$2(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(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, maybeInvokeDelegate(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 = tryCatch(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 pushTryEntry(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 resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(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 next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof$2(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "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 next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(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(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(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 complete(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 finish(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), resetTryEntry(r), y; } }, catch: function _catch(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; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
1515
+ function asyncGeneratorStep$2(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
1516
+ function _asyncToGenerator$2(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep$2(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep$2(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
1517
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
1518
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o); } }
1519
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
1520
+ function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$2(i) ? i : i + ""; }
1521
+ function _toPrimitive$1(t, r) { if ("object" != _typeof$2(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$2(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1522
+ var SemanticTokensProvider = /*#__PURE__*/function () {
1523
+ function SemanticTokensProvider(classificationsGetter) {
1524
+ _classCallCheck(this, SemanticTokensProvider);
1525
+ this.classificationsGetter = classificationsGetter;
1526
+ }
1527
+ return _createClass(SemanticTokensProvider, [{
1528
+ key: "getLegend",
1529
+ value: function getLegend() {
1530
+ return {
1531
+ tokenTypes: types$1.tokenTypes,
1532
+ tokenModifiers: []
1533
+ };
1534
+ }
1535
+ }, {
1536
+ key: "provideDocumentSemanticTokens",
1537
+ value: function () {
1538
+ var _provideDocumentSemanticTokens = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee(model) {
1539
+ var resource, classifications, semanticTokens;
1540
+ return _regeneratorRuntime$2().wrap(function _callee$(_context) {
1541
+ while (1) switch (_context.prev = _context.next) {
1542
+ case 0:
1543
+ resource = model.uri;
1544
+ _context.next = 3;
1545
+ return this.classificationsGetter(resource);
1546
+ case 3:
1547
+ classifications = _context.sent;
1548
+ semanticTokens = classifications.map(function (classification, index) {
1549
+ var previousClassification = classifications[index - 1];
1550
+ return semanticTokenMaker(classification, previousClassification);
1551
+ });
1552
+ return _context.abrupt("return", {
1553
+ data: new Uint32Array(semanticTokens.flat()),
1554
+ resultId: model.getVersionId().toString()
1555
+ });
1556
+ case 6:
1557
+ case "end":
1558
+ return _context.stop();
1559
+ }
1560
+ }, _callee, this);
1561
+ }));
1562
+ function provideDocumentSemanticTokens(_x) {
1563
+ return _provideDocumentSemanticTokens.apply(this, arguments);
1564
+ }
1565
+ return provideDocumentSemanticTokens;
1566
+ }()
1567
+ }, {
1568
+ key: "releaseDocumentSemanticTokens",
1569
+ value: function releaseDocumentSemanticTokens() {}
1570
+ }]);
1571
+ }();
1572
+ var emptyClassification = {
1573
+ line: 0,
1574
+ character: 0,
1575
+ length: 0,
1576
+ kind: 0
1577
+ };
1578
+ function semanticTokenMaker(classification) {
1579
+ var previousClassification = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : emptyClassification;
1580
+ var line = classification.line,
1581
+ character = classification.character,
1582
+ length = classification.length,
1583
+ kind = classification.kind;
1584
+ var deltaLine = line - previousClassification.line;
1585
+ var deltaStart = deltaLine ? character : character - previousClassification.character;
1586
+ return [deltaLine, deltaStart, length, kind, 0];
1587
+ }
1588
+
1589
+ function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); }
1590
+ function _regeneratorRuntime$1() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime$1 = function _regeneratorRuntime() { 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", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof$1(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(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, maybeInvokeDelegate(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 = tryCatch(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 pushTryEntry(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 resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(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 next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof$1(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "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 next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(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(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(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 complete(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 finish(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), resetTryEntry(r), y; } }, catch: function _catch(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; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
1591
+ function asyncGeneratorStep$1(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
1592
+ function _asyncToGenerator$1(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
1593
+ // Registers semantic token provider that utilizes the language service
1594
+ // for more context-relevant syntax highlighting.
1595
+ function semanticTokensProviderRegistrarCreator() {
1596
+ var semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreatorForTest();
1597
+ return function (monacoInstance, workerAccessor) {
1598
+ var semanticTokensProvider = semanticTokensProviderMaker(workerAccessor);
1599
+ semanticTokensProviderRegistrar(monacoInstance, semanticTokensProvider);
1600
+ };
1601
+ }
1602
+ function semanticTokensProviderRegistrarCreatorForTest() {
1603
+ var semanticTokensDisposable;
1604
+ return function (monacoInstance, semanticTokensProvider) {
1605
+ if (semanticTokensDisposable) {
1606
+ semanticTokensDisposable.dispose();
1607
+ }
1608
+ semanticTokensDisposable = monacoInstance.languages.registerDocumentSemanticTokensProvider(types$1.LANGUAGE_ID, semanticTokensProvider);
1609
+ };
1610
+ }
1611
+ function semanticTokensProviderMaker(workerAccessor) {
1612
+ var classificationsGetter = /*#__PURE__*/function () {
1613
+ var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(resource) {
1614
+ var worker;
1615
+ return _regeneratorRuntime$1().wrap(function _callee$(_context) {
1616
+ while (1) switch (_context.prev = _context.next) {
1617
+ case 0:
1618
+ _context.next = 2;
1619
+ return workerAccessor(resource);
1620
+ case 2:
1621
+ worker = _context.sent;
1622
+ return _context.abrupt("return", worker.getClassifications(resource.toString()));
1623
+ case 4:
1624
+ case "end":
1625
+ return _context.stop();
1626
+ }
1627
+ }, _callee);
1628
+ }));
1629
+ return function classificationsGetter(_x) {
1630
+ return _ref.apply(this, arguments);
1631
+ };
1632
+ }();
1633
+ return new SemanticTokensProvider(classificationsGetter);
1634
+ }
1635
+
1636
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1637
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1638
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1639
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
1640
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
1641
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1642
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
1643
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1644
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1645
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
1646
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
1647
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1648
+ function _regeneratorRuntime() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { 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", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(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, maybeInvokeDelegate(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 = tryCatch(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 pushTryEntry(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 resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(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 next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "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 next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(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(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(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 complete(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 finish(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), resetTryEntry(r), y; } }, catch: function _catch(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; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
1649
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
1650
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
1651
+ var kustoWorker;
1652
+ var resolveWorker;
1653
+ var workerPromise = new Promise(function (resolve, reject) {
1654
+ resolveWorker = resolve;
1655
+ });
1656
+
1657
+ /**
1658
+ * Called when Kusto language is first needed (a model has the language set)
1659
+ * @param defaults
1660
+ */
1661
+ function setupMode(defaults, monacoInstance) {
1662
+ var onSchemaChange = new monaco__namespace.Emitter();
1663
+ // TODO: when should we dispose of these? seems like monaco-css and monaco-typescript don't dispose of these.
1664
+ var disposables = [];
1665
+ var semanticTokensProviderRegistrar = semanticTokensProviderRegistrarCreator();
1666
+ var client = new WorkerManager(monacoInstance, defaults);
1667
+ disposables.push(client);
1668
+ var workerAccessor = function workerAccessor(first) {
1669
+ var augmentedSetSchema = /*#__PURE__*/function () {
1670
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema, worker) {
1671
+ var workerPromise;
1672
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1673
+ while (1) switch (_context.prev = _context.next) {
1674
+ case 0:
1675
+ workerPromise = worker.setSchema(schema);
1676
+ _context.next = 3;
1677
+ return workerPromise.then(function () {
1678
+ onSchemaChange.fire(schema);
1679
+ });
1680
+ case 3:
1681
+ semanticTokensProviderRegistrar(monacoInstance, workerAccessor);
1682
+ case 4:
1683
+ case "end":
1684
+ return _context.stop();
1685
+ }
1686
+ }, _callee);
1687
+ }));
1688
+ return function augmentedSetSchema(_x, _x2) {
1689
+ return _ref.apply(this, arguments);
1690
+ };
1691
+ }();
1692
+ for (var _len = arguments.length, more = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1693
+ more[_key - 1] = arguments[_key];
1694
+ }
1695
+ var worker = client.getLanguageServiceWorker.apply(client, _toConsumableArray([first].concat(more)));
1696
+ return worker.then(function (worker) {
1697
+ return _objectSpread(_objectSpread({}, worker), {}, {
1698
+ setSchema: function setSchema(schema) {
1699
+ return augmentedSetSchema(schema, worker);
1700
+ },
1701
+ setSchemaFromShowSchema: function setSchemaFromShowSchema(schema, connection, database, globalScalarParameters, globalTabularParameters) {
1702
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1703
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1704
+ while (1) switch (_context2.prev = _context2.next) {
1705
+ case 0:
1706
+ _context2.next = 2;
1707
+ return worker.normalizeSchema(schema, connection, database).then(function (schema) {
1708
+ if (globalScalarParameters || globalTabularParameters) {
1709
+ schema = _objectSpread(_objectSpread({}, schema), {}, {
1710
+ globalScalarParameters: globalScalarParameters,
1711
+ globalTabularParameters: globalTabularParameters
1712
+ });
1713
+ }
1714
+ augmentedSetSchema(schema, worker);
1715
+ });
1716
+ case 2:
1717
+ case "end":
1718
+ return _context2.stop();
1719
+ }
1720
+ }, _callee2);
1721
+ }))();
1722
+ }
1723
+ });
1724
+ });
1725
+ };
1726
+ disposables.push(monacoInstance.languages.registerCompletionItemProvider(types$1.LANGUAGE_ID, new CompletionAdapter(workerAccessor, defaults.languageSettings)));
1727
+ monacoInstance.languages.setMonarchTokensProvider(types$1.LANGUAGE_ID, kustoLanguageDefinition);
1728
+ disposables.push(new DiagnosticsAdapter(monacoInstance, types$1.LANGUAGE_ID, workerAccessor, defaults, onSchemaChange.event));
1729
+ disposables.push(monacoInstance.languages.registerDocumentRangeFormattingEditProvider(types$1.LANGUAGE_ID, new FormatAdapter(workerAccessor)));
1730
+ disposables.push(monacoInstance.languages.registerFoldingRangeProvider(types$1.LANGUAGE_ID, new FoldingAdapter(workerAccessor)));
1731
+ disposables.push(monacoInstance.languages.registerDefinitionProvider(types$1.LANGUAGE_ID, new DefinitionAdapter(workerAccessor)));
1732
+ disposables.push(monacoInstance.languages.registerRenameProvider(types$1.LANGUAGE_ID, new RenameAdapter(workerAccessor)));
1733
+ disposables.push(monacoInstance.languages.registerReferenceProvider(types$1.LANGUAGE_ID, new ReferenceAdapter(workerAccessor)));
1734
+ if (defaults.languageSettings.enableHover) {
1735
+ disposables.push(monacoInstance.languages.registerHoverProvider(types$1.LANGUAGE_ID, new HoverAdapter(workerAccessor)));
1736
+ }
1737
+ monacoInstance.languages.registerDocumentFormattingEditProvider(types$1.LANGUAGE_ID, new DocumentFormatAdapter(workerAccessor));
1738
+ kustoWorker = workerAccessor;
1739
+ resolveWorker(workerAccessor);
1740
+ monacoInstance.languages.setLanguageConfiguration(types$1.LANGUAGE_ID, {
1741
+ folding: {
1742
+ offSide: false,
1743
+ markers: {
1744
+ start: /^\s*[\r\n]/gm,
1745
+ end: /^\s*[\r\n]/gm
1746
+ }
1747
+ },
1748
+ comments: {
1749
+ lineComment: '//',
1750
+ blockComment: null
1751
+ },
1752
+ autoClosingPairs: [{
1753
+ open: '{',
1754
+ close: '}'
1755
+ }, {
1756
+ open: '[',
1757
+ close: ']'
1758
+ }, {
1759
+ open: '(',
1760
+ close: ')'
1761
+ }, {
1762
+ open: "'",
1763
+ close: "'",
1764
+ notIn: ['string', 'comment']
1765
+ }, {
1766
+ open: '"',
1767
+ close: '"',
1768
+ notIn: ['string', 'comment']
1769
+ }]
1770
+ });
1771
+ return kustoWorker;
1772
+ }
1773
+ function getKustoWorker() {
1774
+ return workerPromise.then(function () {
1775
+ return kustoWorker;
1776
+ });
1777
+ }
1778
+
1779
+ exports.getKustoWorker = getKustoWorker;
1780
+ exports.setupMode = setupMode;
14
1781
 
15
1782
  }));