@kusto/monaco-kusto 13.0.1 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/package.json +1 -1
- package/release/dev/kustoMode.js +2 -2
- package/release/dev/kustoWorker.js +2 -2
- package/release/dev/{main-04597f81.js → main-d3d6236d.js} +2 -2
- package/release/dev/monaco.contribution.js +108 -54
- package/release/dev/{schema-9c3b6c78.js → schema-d61457d1.js} +2 -2
- package/release/dev/{types-ffd2d452.js → types-ecba52f0.js} +2 -2
- package/release/esm/editorExtensions/{KustoIntelliSenseCloser.d.ts → CaseInvertor.d.ts} +6 -4
- package/release/esm/editorExtensions/CaseInvertor.js +71 -0
- package/release/esm/editorExtensions/dateStringWrapper.d.ts +3 -0
- package/release/esm/editorExtensions/dateStringWrapper.js +28 -0
- package/release/esm/{globals-a0d2077f.js → globals-7cadf160.js} +1 -1
- package/release/esm/kusto.worker.js +2 -2
- package/release/esm/kustoMode.js +2 -2
- package/release/esm/monaco.contribution.js +94 -39
- package/release/esm/{schema-4f17a725.js → schema-36aecac4.js} +1 -1
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +2 -2
- package/release/min/{main-c88e79ea.js → main-83804022.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-7f7acd36.js → schema-e27c1e4a.js} +2 -2
- package/release/min/{types-edb6ea80.js → types-1a3dbd57.js} +2 -2
- package/release/esm/editorExtensions/KustoIntelliSenseCloser.js +0 -42
package/README.md
CHANGED
|
@@ -91,9 +91,21 @@ Every PR should come with a test that checks it.
|
|
|
91
91
|
|
|
92
92
|
## Changelog
|
|
93
93
|
|
|
94
|
+
## 13.1.0
|
|
95
|
+
|
|
96
|
+
- feat: Add keyboard shortcuts for changing case:
|
|
97
|
+
- `Ctrl+Shift+U`: Converts current selection to **uppercase**
|
|
98
|
+
- `Ctrl+Shift+L`: Converts current selection to **lowercase**
|
|
99
|
+
- feat: Wrap pasted bare ISO **date** and **datetime** strings with `datetime()`
|
|
100
|
+
|
|
101
|
+
## 13.0.2
|
|
102
|
+
|
|
103
|
+
- fix: revert the behaviour that closed the IntelliSense/completion menu when pressing `Shift+Enter` (introduced in 13.0.1).
|
|
104
|
+
|
|
94
105
|
## 13.0.1
|
|
95
106
|
|
|
96
107
|
- feat: Close IntelliSense automatically when running a query with `Shift+Enter`.
|
|
108
|
+
- chore: upgrade **language‑service‑next** to **v12.0.0**.
|
|
97
109
|
|
|
98
110
|
## 13.0.0
|
|
99
111
|
|
package/package.json
CHANGED
package/release/dev/kustoMode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
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', './main-
|
|
8
|
+
define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-d3d6236d', './types-ecba52f0'], (function (exports, monaco, main, types$1) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
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/kustoWorker', ['exports', './main-
|
|
8
|
+
define('vs/language/kusto/kustoWorker', ['exports', './main-d3d6236d', './schema-d61457d1'], (function (exports, main, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$2(); }
|
|
11
11
|
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
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/main-
|
|
8
|
+
define('vs/language/kusto/main-d3d6236d', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
/* --------------------------------------------------------------------------------------------
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
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/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './types-
|
|
8
|
+
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './types-ecba52f0', './schema-d61457d1'], (function (require, exports, monaco, types, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -181,57 +181,30 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
function
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (((_this$editor$getModel = _this.editor.getModel()) === null || _this$editor$getModel === void 0 ? void 0 : _this$editor$getModel.getLanguageId()) !== 'kusto') {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (!_this.actionRegistered) {
|
|
212
|
-
_this.registerAction();
|
|
213
|
-
_this.actionRegistered = true;
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return _createClass$1(KustoIntelliSenseCloser, [{
|
|
218
|
-
key: "registerAction",
|
|
219
|
-
value: function registerAction() {
|
|
220
|
-
var _this2 = this;
|
|
221
|
-
this.editor.addAction({
|
|
222
|
-
id: 'kusto.closeIntelliSense',
|
|
223
|
-
label: 'Close IntelliSense',
|
|
224
|
-
keybindings: [monaco__namespace.KeyMod.Shift | monaco__namespace.KeyCode.Enter],
|
|
225
|
-
run: function run(editor) {
|
|
226
|
-
return closeIntelliSense(_this2.editor);
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}]);
|
|
231
|
-
}();
|
|
232
|
-
function closeIntelliSense(editor) {
|
|
233
|
-
var controller = editor.getContribution('editor.contrib.suggestController');
|
|
234
|
-
controller === null || controller === void 0 || controller.cancelSuggestWidget();
|
|
184
|
+
function dateStringWrapper(editor) {
|
|
185
|
+
editor.onDidPaste(function (event) {
|
|
186
|
+
var range = event.range;
|
|
187
|
+
if (!range) return;
|
|
188
|
+
var model = editor.getModel();
|
|
189
|
+
var pasted = model.getValueInRange(range);
|
|
190
|
+
if (!isBareIsoDate(pasted)) return;
|
|
191
|
+
var wrapped = "datetime(".concat(pasted, ")");
|
|
192
|
+
var edit = {
|
|
193
|
+
range: range,
|
|
194
|
+
text: wrapped,
|
|
195
|
+
forceMoveMarkers: true
|
|
196
|
+
};
|
|
197
|
+
var cursorStateComputer = function cursorStateComputer() {
|
|
198
|
+
var startOffset = model.getOffsetAt(range.getStartPosition());
|
|
199
|
+
var endPos = model.getPositionAt(startOffset + wrapped.length);
|
|
200
|
+
return [new monaco__namespace.Selection(endPos.lineNumber, endPos.column, endPos.lineNumber, endPos.column)];
|
|
201
|
+
};
|
|
202
|
+
editor.executeEdits('paste-date', [edit], cursorStateComputer);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function isBareIsoDate(text) {
|
|
206
|
+
var s = text.trim();
|
|
207
|
+
return /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}Z)?$/.test(s);
|
|
235
208
|
}
|
|
236
209
|
|
|
237
210
|
var ThemeName = /*#__PURE__*/function (ThemeName) {
|
|
@@ -456,6 +429,86 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
456
429
|
return colorizedLines.join('<br/>');
|
|
457
430
|
}
|
|
458
431
|
|
|
432
|
+
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); }
|
|
433
|
+
function _classCallCheck$1(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
434
|
+
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$1(o.key), o); } }
|
|
435
|
+
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; }
|
|
436
|
+
function _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
437
|
+
function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; }
|
|
438
|
+
function _toPrimitive$1(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
439
|
+
/**
|
|
440
|
+
* Registers a Kusto-specific action to close the IntelliSense suggestions popup.
|
|
441
|
+
*
|
|
442
|
+
* Note:
|
|
443
|
+
* We register the action on the first cursor movement, not on editor creation,
|
|
444
|
+
* because Monaco fires 'onDidCreateEditor' before the keybinding service is fully initialized.
|
|
445
|
+
* Waiting for a cursor event guarantees that the editor is fully ready
|
|
446
|
+
* and allows safe registration of actions with keybindings.
|
|
447
|
+
*/
|
|
448
|
+
var CaseInvertor = /*#__PURE__*/function () {
|
|
449
|
+
function CaseInvertor(editor) {
|
|
450
|
+
var _this = this;
|
|
451
|
+
_classCallCheck$1(this, CaseInvertor);
|
|
452
|
+
_defineProperty$1(this, "actionsRegistered", false);
|
|
453
|
+
this.editor = editor;
|
|
454
|
+
this.ctrlKeyMod = this.isMac() ? monaco__namespace.KeyMod.WinCtrl : monaco__namespace.KeyMod.CtrlCmd;
|
|
455
|
+
this.editor.onDidChangeCursorSelection(function () {
|
|
456
|
+
var _this$editor$getModel;
|
|
457
|
+
if (((_this$editor$getModel = _this.editor.getModel()) === null || _this$editor$getModel === void 0 ? void 0 : _this$editor$getModel.getLanguageId()) !== 'kusto') {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (!_this.actionsRegistered) {
|
|
461
|
+
_this.registerUpperCaseHandler();
|
|
462
|
+
_this.registerLowerCaseHandler();
|
|
463
|
+
_this.actionsRegistered = true;
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
return _createClass$1(CaseInvertor, [{
|
|
468
|
+
key: "registerUpperCaseHandler",
|
|
469
|
+
value: function registerUpperCaseHandler() {
|
|
470
|
+
this.editor.addAction({
|
|
471
|
+
id: 'kusto.toUpperCase',
|
|
472
|
+
label: 'To Upper Case',
|
|
473
|
+
keybindings: [this.ctrlKeyMod | monaco__namespace.KeyMod.Shift | monaco__namespace.KeyCode.KeyU],
|
|
474
|
+
run: function run(editor) {
|
|
475
|
+
var selectedRange = editor.getSelection();
|
|
476
|
+
var selectedText = editor.getModel().getValueInRange(selectedRange);
|
|
477
|
+
var upperCaseText = selectedText.toUpperCase();
|
|
478
|
+
editor.executeEdits('toUpperCase', [{
|
|
479
|
+
range: selectedRange,
|
|
480
|
+
text: upperCaseText
|
|
481
|
+
}]);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}, {
|
|
486
|
+
key: "registerLowerCaseHandler",
|
|
487
|
+
value: function registerLowerCaseHandler() {
|
|
488
|
+
this.editor.addAction({
|
|
489
|
+
id: 'kusto.toLowerCase',
|
|
490
|
+
label: 'To Lower Case',
|
|
491
|
+
keybindings: [this.ctrlKeyMod | monaco__namespace.KeyMod.Shift | monaco__namespace.KeyCode.KeyL],
|
|
492
|
+
run: function run(editor) {
|
|
493
|
+
var selectedRange = editor.getSelection();
|
|
494
|
+
var selectedText = editor.getModel().getValueInRange(selectedRange);
|
|
495
|
+
var lowerCaseText = selectedText.toLowerCase();
|
|
496
|
+
editor.executeEdits('toLowerCase', [{
|
|
497
|
+
range: selectedRange,
|
|
498
|
+
text: lowerCaseText
|
|
499
|
+
}]);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
}, {
|
|
504
|
+
key: "isMac",
|
|
505
|
+
value: function isMac() {
|
|
506
|
+
var uaData = navigator.userAgentData;
|
|
507
|
+
return uaData ? uaData.platform === 'macOS' : /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
508
|
+
}
|
|
509
|
+
}]);
|
|
510
|
+
}();
|
|
511
|
+
|
|
459
512
|
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); }
|
|
460
513
|
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; }
|
|
461
514
|
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); }
|
|
@@ -583,9 +636,10 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
583
636
|
new KustoCommandHighlighter(editor);
|
|
584
637
|
if (isStandaloneCodeEditor(editor)) {
|
|
585
638
|
new KustoCommandFormatter(editor);
|
|
586
|
-
new
|
|
639
|
+
new CaseInvertor(editor);
|
|
587
640
|
}
|
|
588
641
|
triggerSuggestDialogWhenCompletionItemSelected(editor);
|
|
642
|
+
dateStringWrapper(editor);
|
|
589
643
|
});
|
|
590
644
|
function triggerSuggestDialogWhenCompletionItemSelected(editor) {
|
|
591
645
|
editor.onDidChangeCursorSelection(function (event) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
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/schema-
|
|
8
|
+
define('vs/language/kusto/schema-d61457d1', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
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/types-
|
|
8
|
+
define('vs/language/kusto/types-ecba52f0', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
var LANGUAGE_ID = 'kusto';
|
|
11
11
|
|
|
@@ -8,10 +8,12 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
|
8
8
|
* Waiting for a cursor event guarantees that the editor is fully ready
|
|
9
9
|
* and allows safe registration of actions with keybindings.
|
|
10
10
|
*/
|
|
11
|
-
export default class
|
|
11
|
+
export default class CaseInvertor {
|
|
12
12
|
private editor;
|
|
13
|
-
private
|
|
13
|
+
private actionsRegistered;
|
|
14
|
+
private readonly ctrlKeyMod;
|
|
14
15
|
constructor(editor: monaco.editor.IStandaloneCodeEditor);
|
|
15
|
-
private
|
|
16
|
+
private registerUpperCaseHandler;
|
|
17
|
+
private registerLowerCaseHandler;
|
|
18
|
+
private isMac;
|
|
16
19
|
}
|
|
17
|
-
export declare function closeIntelliSense(editor: monaco.editor.IStandaloneCodeEditor): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
/**
|
|
3
|
+
* Registers a Kusto-specific action to close the IntelliSense suggestions popup.
|
|
4
|
+
*
|
|
5
|
+
* Note:
|
|
6
|
+
* We register the action on the first cursor movement, not on editor creation,
|
|
7
|
+
* because Monaco fires 'onDidCreateEditor' before the keybinding service is fully initialized.
|
|
8
|
+
* Waiting for a cursor event guarantees that the editor is fully ready
|
|
9
|
+
* and allows safe registration of actions with keybindings.
|
|
10
|
+
*/
|
|
11
|
+
var CaseInvertor = /** @class */ (function () {
|
|
12
|
+
function CaseInvertor(editor) {
|
|
13
|
+
var _this = this;
|
|
14
|
+
this.editor = editor;
|
|
15
|
+
this.actionsRegistered = false;
|
|
16
|
+
this.ctrlKeyMod = this.isMac() ? monaco.KeyMod.WinCtrl : monaco.KeyMod.CtrlCmd;
|
|
17
|
+
this.editor.onDidChangeCursorSelection(function () {
|
|
18
|
+
var _a;
|
|
19
|
+
if (((_a = _this.editor.getModel()) === null || _a === void 0 ? void 0 : _a.getLanguageId()) !== 'kusto') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!_this.actionsRegistered) {
|
|
23
|
+
_this.registerUpperCaseHandler();
|
|
24
|
+
_this.registerLowerCaseHandler();
|
|
25
|
+
_this.actionsRegistered = true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
CaseInvertor.prototype.registerUpperCaseHandler = function () {
|
|
30
|
+
this.editor.addAction({
|
|
31
|
+
id: 'kusto.toUpperCase',
|
|
32
|
+
label: 'To Upper Case',
|
|
33
|
+
keybindings: [this.ctrlKeyMod | monaco.KeyMod.Shift | monaco.KeyCode.KeyU],
|
|
34
|
+
run: function (editor) {
|
|
35
|
+
var selectedRange = editor.getSelection();
|
|
36
|
+
var selectedText = editor.getModel().getValueInRange(selectedRange);
|
|
37
|
+
var upperCaseText = selectedText.toUpperCase();
|
|
38
|
+
editor.executeEdits('toUpperCase', [
|
|
39
|
+
{
|
|
40
|
+
range: selectedRange,
|
|
41
|
+
text: upperCaseText,
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
CaseInvertor.prototype.registerLowerCaseHandler = function () {
|
|
48
|
+
this.editor.addAction({
|
|
49
|
+
id: 'kusto.toLowerCase',
|
|
50
|
+
label: 'To Lower Case',
|
|
51
|
+
keybindings: [this.ctrlKeyMod | monaco.KeyMod.Shift | monaco.KeyCode.KeyL],
|
|
52
|
+
run: function (editor) {
|
|
53
|
+
var selectedRange = editor.getSelection();
|
|
54
|
+
var selectedText = editor.getModel().getValueInRange(selectedRange);
|
|
55
|
+
var lowerCaseText = selectedText.toLowerCase();
|
|
56
|
+
editor.executeEdits('toLowerCase', [
|
|
57
|
+
{
|
|
58
|
+
range: selectedRange,
|
|
59
|
+
text: lowerCaseText,
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
CaseInvertor.prototype.isMac = function () {
|
|
66
|
+
var uaData = navigator.userAgentData;
|
|
67
|
+
return uaData ? uaData.platform === 'macOS' : /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
68
|
+
};
|
|
69
|
+
return CaseInvertor;
|
|
70
|
+
}());
|
|
71
|
+
export default CaseInvertor;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
export function dateStringWrapper(editor) {
|
|
3
|
+
editor.onDidPaste(function (event) {
|
|
4
|
+
var range = event.range;
|
|
5
|
+
if (!range)
|
|
6
|
+
return;
|
|
7
|
+
var model = editor.getModel();
|
|
8
|
+
var pasted = model.getValueInRange(range);
|
|
9
|
+
if (!isBareIsoDate(pasted))
|
|
10
|
+
return;
|
|
11
|
+
var wrapped = "datetime(".concat(pasted, ")");
|
|
12
|
+
var edit = {
|
|
13
|
+
range: range,
|
|
14
|
+
text: wrapped,
|
|
15
|
+
forceMoveMarkers: true,
|
|
16
|
+
};
|
|
17
|
+
var cursorStateComputer = function () {
|
|
18
|
+
var startOffset = model.getOffsetAt(range.getStartPosition());
|
|
19
|
+
var endPos = model.getPositionAt(startOffset + wrapped.length);
|
|
20
|
+
return [new monaco.Selection(endPos.lineNumber, endPos.column, endPos.lineNumber, endPos.column)];
|
|
21
|
+
};
|
|
22
|
+
editor.executeEdits('paste-date', [edit], cursorStateComputer);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function isBareIsoDate(text) {
|
|
26
|
+
var s = text.trim();
|
|
27
|
+
return /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}Z)?$/.test(s);
|
|
28
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as worker from 'monaco-editor/esm/vs/editor/editor.worker';
|
|
9
9
|
import * as ls from 'vscode-languageserver-types';
|
|
10
10
|
import XRegExp from 'xregexp';
|
|
11
|
-
import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-
|
|
11
|
+
import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-36aecac4.js';
|
|
12
12
|
import '@kusto/language-service/bridge.min';
|
|
13
13
|
import '@kusto/language-service/Kusto.JavaScript.Client.min';
|
|
14
14
|
import '@kusto/language-service/newtonsoft.json.min';
|
package/release/esm/kustoMode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 13.0
|
|
3
|
+
* monaco-kusto version: 13.1.0(e13e2f4e51f8298799cd0893607366337e0bfa53)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -9,7 +9,7 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
|
9
9
|
import { languages } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
10
10
|
import * as ls from 'vscode-languageserver-types';
|
|
11
11
|
import debounce from 'lodash-es/debounce';
|
|
12
|
-
import { L as LANGUAGE_ID, T as Token, t as tokenTypes } from './globals-
|
|
12
|
+
import { L as LANGUAGE_ID, T as Token, t as tokenTypes } from './globals-7cadf160.js';
|
|
13
13
|
|
|
14
14
|
class WorkerManager {
|
|
15
15
|
constructor(_monacoInstance, defaults) {
|