@kusto/monaco-kusto 6.1.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,80 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.1.2(4c9ec21ad04b49f9f8e8a8f7fe773fe9a8b47334)
3
+ * monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
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'], (function (require, exports, editor_main) { 'use strict';
8
+ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main'], (function (require, exports, monaco) { 'use strict';
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
+ }
26
+
27
+ var monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
28
+
29
+ function getCurrentCommandRange(editor, cursorPosition) {
30
+ var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
31
+ var lines = editor.getModel().getLinesContent();
32
+ var commandOrdinal = 0;
33
+ var linesWithCommandOrdinal = [];
34
+ for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
35
+ var isEmptyLine = lines[lineNumber].trim() === '';
36
+ if (isEmptyLine) {
37
+ // increase commandCounter - we'll be starting a new command.
38
+ linesWithCommandOrdinal.push({
39
+ commandOrdinal: commandOrdinal++,
40
+ lineNumber: lineNumber
41
+ });
42
+ } else {
43
+ linesWithCommandOrdinal.push({
44
+ commandOrdinal: commandOrdinal,
45
+ lineNumber: lineNumber
46
+ });
47
+ }
48
+
49
+ // No need to keep scanning if we're past our line and we've seen an empty line.
50
+ if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
51
+ break;
52
+ }
53
+ }
54
+ var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
55
+ var currentCommandLines = linesWithCommandOrdinal.filter(function (line) {
56
+ return line.commandOrdinal === currentCommandOrdinal;
57
+ });
58
+ var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
59
+ var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
60
+
61
+ // End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
62
+ // Start-column of 1 and End column of 2 means 1st character is selected.
63
+ // Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
64
+ var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
65
+ return new monaco__namespace.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
66
+ }
67
+
68
+ /**
69
+ * Extending ICode editor to contain additional kusto-specific methods.
70
+ * note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
71
+ */
72
+ function extend(editor) {
73
+ var proto = Object.getPrototypeOf(editor);
74
+ proto.getCurrentCommandRange = function (cursorPosition) {
75
+ getCurrentCommandRange(this, cursorPosition);
76
+ };
77
+ }
9
78
 
10
79
  function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); }
11
80
  function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -14,6 +83,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
14
83
  function _defineProperty$2(obj, key, value) { key = _toPropertyKey$2(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
84
  function _toPropertyKey$2(arg) { var key = _toPrimitive$2(arg, "string"); return _typeof$2(key) === "symbol" ? key : String(key); }
16
85
  function _toPrimitive$2(input, hint) { if (_typeof$2(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof$2(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
86
+
17
87
  /**
18
88
  * Highlights the command that surround cursor location
19
89
  */
@@ -58,7 +128,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
58
128
  this.decorations = this.editor.deltaDecorations(this.decorations, []);
59
129
  return;
60
130
  }
61
- var commandRange = this.editor.getCurrentCommandRange(changeEvent.selection.getStartPosition());
131
+ var commandRange = getCurrentCommandRange(this.editor, changeEvent.selection.getStartPosition());
62
132
  var decorations = [{
63
133
  range: commandRange,
64
134
  options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT
@@ -92,7 +162,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
92
162
  return;
93
163
  }
94
164
  // Theoretically you would expect this code to run only once in onDidCreateEditor.
95
- // Turns out that onDidCreateEditor is fired before the IStandaloneEditor is completely created (it is emmited by
165
+ // Turns out that onDidCreateEditor is fired before the IStandaloneEditor is completely created (it is emitted by
96
166
  // the super ctor before the child ctor was able to fully run).
97
167
  // Thus we don't have a key binding provided yet when onDidCreateEditor is run, which is essential to call addAction.
98
168
  // By adding the action here in onDidChangeCursorSelection we're making sure that the editor has a key binding provider,
@@ -101,7 +171,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
101
171
  editor.addAction({
102
172
  id: 'editor.action.kusto.formatCurrentCommand',
103
173
  label: 'Format Command Under Cursor',
104
- keybindings: [monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyF)],
174
+ keybindings: [monaco__namespace.KeyMod.chord(monaco__namespace.KeyMod.CtrlCmd | monaco__namespace.KeyCode.KeyK, monaco__namespace.KeyMod.CtrlCmd | monaco__namespace.KeyCode.KeyF)],
105
175
  run: function run(ed) {
106
176
  editor.trigger('KustoCommandFormatter', 'editor.action.formatSelection', null);
107
177
  },
@@ -112,52 +182,6 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
112
182
  });
113
183
  });
114
184
 
115
- /**
116
- * Extending ICode editor to contain additional kusto-specific methods.
117
- * note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
118
- */
119
- function extend(editor) {
120
- var proto = Object.getPrototypeOf(editor);
121
- proto.getCurrentCommandRange = function (cursorPosition) {
122
- var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
123
- var lines = this.getModel().getLinesContent();
124
- var commandOrdinal = 0;
125
- var linesWithCommandOrdinal = [];
126
- for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
127
- var isEmptyLine = lines[lineNumber].trim() === '';
128
- if (isEmptyLine) {
129
- // increase commandCounter - we'll be starting a new command.
130
- linesWithCommandOrdinal.push({
131
- commandOrdinal: commandOrdinal++,
132
- lineNumber: lineNumber
133
- });
134
- } else {
135
- linesWithCommandOrdinal.push({
136
- commandOrdinal: commandOrdinal,
137
- lineNumber: lineNumber
138
- });
139
- }
140
-
141
- // No need to keep scanning if we're past our line and we've seen an empty line.
142
- if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
143
- break;
144
- }
145
- }
146
- var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
147
- var currentCommandLines = linesWithCommandOrdinal.filter(function (line) {
148
- return line.commandOrdinal === currentCommandOrdinal;
149
- });
150
- var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
151
- var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
152
-
153
- // End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
154
- // Start-column of 1 and End column of 2 means 1st character is selected.
155
- // Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
156
- var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
157
- return new monaco.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
158
- };
159
- }
160
-
161
185
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
162
186
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
163
187
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
@@ -167,13 +191,12 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
167
191
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
168
192
 
169
193
  // --- Kusto configuration and defaults ---------
170
-
171
194
  var LanguageServiceDefaultsImpl = /*#__PURE__*/function () {
172
195
  // in milliseconds. For example - this is 2 minutes 2 * 60 * 1000
173
196
 
174
197
  function LanguageServiceDefaultsImpl(languageSettings) {
175
198
  _classCallCheck(this, LanguageServiceDefaultsImpl);
176
- _defineProperty(this, "_onDidChange", new monaco.Emitter());
199
+ _defineProperty(this, "_onDidChange", new monaco__namespace.Emitter());
177
200
  this.setLanguageSettings(languageSettings);
178
201
  // default to never kill worker when idle.
179
202
  // reason: when killing worker - schema gets lost. We transmit the schema back to main process when killing
@@ -245,251 +268,244 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
245
268
  function withMode(callback) {
246
269
  new Promise(function (resolve, reject) { require(['./kustoMode'], resolve, reject); }).then(callback);
247
270
  }
248
- function setupMonacoKusto(monacoInstance) {
249
- var kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
250
- function createAPI() {
251
- return {
252
- kustoDefaults: kustoDefaults,
253
- getKustoWorker: getKustoWorker
254
- };
255
- }
256
- monacoInstance.languages.kusto = createAPI();
257
- monacoInstance.languages.onLanguage('kusto', function () {
258
- withMode(function (mode) {
259
- return mode.setupMode(kustoDefaults, monacoInstance);
260
- });
261
- });
262
- monacoInstance.languages.register({
263
- id: 'kusto',
264
- extensions: ['.csl', '.kql']
265
- });
266
- monacoInstance.editor.defineTheme('kusto-light', {
267
- base: 'vs',
268
- inherit: true,
269
- rules: [{
270
- token: 'comment',
271
- foreground: '008000'
272
- },
273
- // CommentToken Green
274
- {
275
- token: 'variable.predefined',
276
- foreground: '800080'
277
- },
278
- // CalculatedColumnToken Purple
279
- {
280
- token: 'function',
281
- foreground: '0000FF'
282
- },
283
- // FunctionNameToken Blue
284
- {
285
- token: 'operator.sql',
286
- foreground: 'CC3700'
287
- },
288
- // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
289
- {
290
- token: 'string',
291
- foreground: 'B22222'
292
- },
293
- // StringLiteralToken Firebrick
294
- {
295
- token: 'operator.scss',
296
- foreground: '0000FF'
297
- },
298
- // SubOperatorToken Blue
299
- {
300
- token: 'variable',
301
- foreground: 'C71585'
302
- },
303
- // TableColumnToken MediumVioletRed
304
- {
305
- token: 'variable.parameter',
306
- foreground: '9932CC'
307
- },
308
- // TableToken DarkOrchid
309
- {
310
- token: '',
311
- foreground: '000000'
312
- },
313
- // UnknownToken, PlainTextToken Black
314
- {
315
- token: 'type',
316
- foreground: '0000FF'
317
- },
318
- // DataTypeToken Blue
319
- {
320
- token: 'tag',
321
- foreground: '0000FF'
322
- },
323
- // ControlCommandToken Blue
324
- {
325
- token: 'annotation',
326
- foreground: '2B91AF'
327
- },
328
- // QueryParametersToken FF2B91AF
329
- {
330
- token: 'keyword',
331
- foreground: '0000FF'
332
- },
333
- // CslCommandToken, PluginToken Blue
334
- {
335
- token: 'number',
336
- foreground: '191970'
337
- },
338
- // LetVariablesToken MidnightBlue
339
- {
340
- token: 'annotation',
341
- foreground: '9400D3'
342
- },
343
- // ClientDirectiveToken DarkViolet
344
- {
345
- token: 'invalid',
346
- background: 'cd3131'
347
- }],
348
- colors: {}
349
- });
350
- monacoInstance.editor.defineTheme('kusto-dark', {
351
- base: 'vs-dark',
352
- inherit: true,
353
- rules: [{
354
- token: 'comment',
355
- foreground: '608B4E'
356
- },
357
- // CommentToken Green
358
- {
359
- token: 'variable.predefined',
360
- foreground: '4ec9b0'
361
- },
362
- // CalculatedColumnToken Purple
363
- {
364
- token: 'function',
365
- foreground: 'dcdcaa'
366
- },
367
- // FunctionNameToken Blue
368
- {
369
- token: 'operator.sql',
370
- foreground: '9cdcfe'
371
- },
372
- // OperatorToken OrangeRed
373
- {
374
- token: 'string',
375
- foreground: 'ce9178'
376
- },
377
- // StringLiteralToken Firebrick
378
- {
379
- token: 'operator.scss',
380
- foreground: '569cd6'
381
- },
382
- // SubOperatorToken Blue
383
- {
384
- token: 'variable',
385
- foreground: '4ec9b0'
386
- },
387
- // TableColumnToken MediumVioletRed
388
- {
389
- token: 'variable.parameter',
390
- foreground: 'c586c0'
391
- },
392
- // TableToken DarkOrchid
393
- {
394
- token: '',
395
- foreground: 'd4d4d4'
396
- },
397
- // UnknownToken, PlainTextToken Black
398
- {
399
- token: 'type',
400
- foreground: '569cd6'
401
- },
402
- // DataTypeToken Blue
403
- {
404
- token: 'tag',
405
- foreground: '569cd6'
406
- },
407
- // ControlCommandToken Blue
408
- {
409
- token: 'annotation',
410
- foreground: '9cdcfe'
411
- },
412
- // QueryParametersToken FF2B91AF
413
- {
414
- token: 'keyword',
415
- foreground: '569cd6'
416
- },
417
- // CslCommandToken, PluginToken Blue
418
- {
419
- token: 'number',
420
- foreground: 'd7ba7d'
421
- },
422
- // LetVariablesToken MidnightBlue
423
- {
424
- token: 'annotation',
425
- foreground: 'b5cea8'
426
- },
427
- // ClientDirectiveToken DarkViolet
428
- {
429
- token: 'invalid',
430
- background: 'cd3131'
431
- }],
432
- colors: {
433
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
434
- }
435
- });
436
- monacoInstance.editor.defineTheme('kusto-dark2', {
437
- base: 'vs-dark',
438
- inherit: true,
439
- rules: [],
440
- colors: {
441
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
442
- 'editor.background': '#1B1A19',
443
- // gray 200
444
- 'editorSuggestWidget.selectedBackground': '#004E8C'
445
- }
271
+ var kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
272
+ monaco__namespace.languages.onLanguage('kusto', function () {
273
+ withMode(function (mode) {
274
+ return mode.setupMode(kustoDefaults, monaco__namespace);
446
275
  });
276
+ });
277
+ monaco__namespace.languages.register({
278
+ id: 'kusto',
279
+ extensions: ['.csl', '.kql']
280
+ });
281
+ monaco__namespace.editor.defineTheme('kusto-light', {
282
+ base: 'vs',
283
+ inherit: true,
284
+ rules: [{
285
+ token: 'comment',
286
+ foreground: '008000'
287
+ },
288
+ // CommentToken Green
289
+ {
290
+ token: 'variable.predefined',
291
+ foreground: '800080'
292
+ },
293
+ // CalculatedColumnToken Purple
294
+ {
295
+ token: 'function',
296
+ foreground: '0000FF'
297
+ },
298
+ // FunctionNameToken Blue
299
+ {
300
+ token: 'operator.sql',
301
+ foreground: 'CC3700'
302
+ },
303
+ // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
304
+ {
305
+ token: 'string',
306
+ foreground: 'B22222'
307
+ },
308
+ // StringLiteralToken Firebrick
309
+ {
310
+ token: 'operator.scss',
311
+ foreground: '0000FF'
312
+ },
313
+ // SubOperatorToken Blue
314
+ {
315
+ token: 'variable',
316
+ foreground: 'C71585'
317
+ },
318
+ // TableColumnToken MediumVioletRed
319
+ {
320
+ token: 'variable.parameter',
321
+ foreground: '9932CC'
322
+ },
323
+ // TableToken DarkOrchid
324
+ {
325
+ token: '',
326
+ foreground: '000000'
327
+ },
328
+ // UnknownToken, PlainTextToken Black
329
+ {
330
+ token: 'type',
331
+ foreground: '0000FF'
332
+ },
333
+ // DataTypeToken Blue
334
+ {
335
+ token: 'tag',
336
+ foreground: '0000FF'
337
+ },
338
+ // ControlCommandToken Blue
339
+ {
340
+ token: 'annotation',
341
+ foreground: '2B91AF'
342
+ },
343
+ // QueryParametersToken FF2B91AF
344
+ {
345
+ token: 'keyword',
346
+ foreground: '0000FF'
347
+ },
348
+ // CslCommandToken, PluginToken Blue
349
+ {
350
+ token: 'number',
351
+ foreground: '191970'
352
+ },
353
+ // LetVariablesToken MidnightBlue
354
+ {
355
+ token: 'annotation',
356
+ foreground: '9400D3'
357
+ },
358
+ // ClientDirectiveToken DarkViolet
359
+ {
360
+ token: 'invalid',
361
+ background: 'cd3131'
362
+ }],
363
+ colors: {}
364
+ });
365
+ monaco__namespace.editor.defineTheme('kusto-dark', {
366
+ base: 'vs-dark',
367
+ inherit: true,
368
+ rules: [{
369
+ token: 'comment',
370
+ foreground: '608B4E'
371
+ },
372
+ // CommentToken Green
373
+ {
374
+ token: 'variable.predefined',
375
+ foreground: '4ec9b0'
376
+ },
377
+ // CalculatedColumnToken Purple
378
+ {
379
+ token: 'function',
380
+ foreground: 'dcdcaa'
381
+ },
382
+ // FunctionNameToken Blue
383
+ {
384
+ token: 'operator.sql',
385
+ foreground: '9cdcfe'
386
+ },
387
+ // OperatorToken OrangeRed
388
+ {
389
+ token: 'string',
390
+ foreground: 'ce9178'
391
+ },
392
+ // StringLiteralToken Firebrick
393
+ {
394
+ token: 'operator.scss',
395
+ foreground: '569cd6'
396
+ },
397
+ // SubOperatorToken Blue
398
+ {
399
+ token: 'variable',
400
+ foreground: '4ec9b0'
401
+ },
402
+ // TableColumnToken MediumVioletRed
403
+ {
404
+ token: 'variable.parameter',
405
+ foreground: 'c586c0'
406
+ },
407
+ // TableToken DarkOrchid
408
+ {
409
+ token: '',
410
+ foreground: 'd4d4d4'
411
+ },
412
+ // UnknownToken, PlainTextToken Black
413
+ {
414
+ token: 'type',
415
+ foreground: '569cd6'
416
+ },
417
+ // DataTypeToken Blue
418
+ {
419
+ token: 'tag',
420
+ foreground: '569cd6'
421
+ },
422
+ // ControlCommandToken Blue
423
+ {
424
+ token: 'annotation',
425
+ foreground: '9cdcfe'
426
+ },
427
+ // QueryParametersToken FF2B91AF
428
+ {
429
+ token: 'keyword',
430
+ foreground: '569cd6'
431
+ },
432
+ // CslCommandToken, PluginToken Blue
433
+ {
434
+ token: 'number',
435
+ foreground: 'd7ba7d'
436
+ },
437
+ // LetVariablesToken MidnightBlue
438
+ {
439
+ token: 'annotation',
440
+ foreground: 'b5cea8'
441
+ },
442
+ // ClientDirectiveToken DarkViolet
443
+ {
444
+ token: 'invalid',
445
+ background: 'cd3131'
446
+ }],
447
+ colors: {
448
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
449
+ }
450
+ });
451
+ monaco__namespace.editor.defineTheme('kusto-dark2', {
452
+ base: 'vs-dark',
453
+ inherit: true,
454
+ rules: [],
455
+ colors: {
456
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
457
+ 'editor.background': '#1B1A19',
458
+ // gray 200
459
+ 'editorSuggestWidget.selectedBackground': '#004E8C'
460
+ }
461
+ });
447
462
 
448
- // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
449
- // Most other language features are initialized in kustoMode.ts
450
- monacoInstance.editor.onDidCreateEditor(function (editor) {
451
- // hook up extension methods to editor.
452
- extend(editor);
453
- new KustoCommandHighlighter(editor);
454
- if (isStandaloneCodeEditor(editor)) {
455
- new KustoCommandFormatter(editor);
463
+ // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
464
+ // Most other language features are initialized in kustoMode.ts
465
+ monaco__namespace.editor.onDidCreateEditor(function (editor) {
466
+ // hook up extension methods to editor.
467
+ extend(editor);
468
+ new KustoCommandHighlighter(editor);
469
+ if (isStandaloneCodeEditor(editor)) {
470
+ new KustoCommandFormatter(editor);
471
+ }
472
+ triggerSuggestDialogWhenCompletionItemSelected(editor);
473
+ });
474
+ function triggerSuggestDialogWhenCompletionItemSelected(editor) {
475
+ editor.onDidChangeCursorSelection(function (event) {
476
+ // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
477
+ if (kustoDefaults && kustoDefaults.languageSettings && kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
478
+ var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco__namespace.editor.CursorChangeReason.NotSet;
479
+ // If the word at the current position is not null - meaning we did not add a space after completion.
480
+ // In this case we don't want to activate the eager mode, since it will display the current selected word..
481
+ if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
482
+ return;
483
+ }
484
+ event.selection;
485
+ // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
486
+ // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
487
+ // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
488
+ // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
489
+ // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
490
+ // this is the best we have.
491
+ setTimeout(function () {
492
+ return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {});
493
+ }, 10);
456
494
  }
457
- triggerSuggestDialogWhenCompletionItemSelected(editor);
458
495
  });
459
- function triggerSuggestDialogWhenCompletionItemSelected(editor) {
460
- editor.onDidChangeCursorSelection(function (event) {
461
- // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
462
- if (kustoDefaults && kustoDefaults.languageSettings && kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
463
- var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
464
- // If the word at the current position is not null - meaning we did not add a space after completion.
465
- // In this case we don't want to activate the eager mode, since it will display the current selected word..
466
- if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
467
- return;
468
- }
469
- event.selection;
470
- // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
471
- // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
472
- // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
473
- // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
474
- // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
475
- // this is the best we have.
476
- setTimeout(function () {
477
- return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {});
478
- }, 10);
479
- }
480
- });
481
- }
482
496
  }
483
497
  function isStandaloneCodeEditor(editor) {
484
498
  return editor.addAction !== undefined;
485
499
  }
500
+ var globalApi = {
501
+ kustoDefaults: kustoDefaults,
502
+ getKustoWorker: getKustoWorker,
503
+ getCurrentCommandRange: getCurrentCommandRange
504
+ };
505
+ monaco__namespace.languages.kusto = globalApi;
486
506
 
487
- // --- Registration to monaco editor ---
488
- if (monaco.editor) {
489
- setupMonacoKusto(monaco);
490
- }
491
-
492
- exports.LanguageServiceDefaultsImpl = LanguageServiceDefaultsImpl;
493
- exports.setupMonacoKusto = setupMonacoKusto;
507
+ exports.getCurrentCommandRange = getCurrentCommandRange;
508
+ exports.getKustoWorker = getKustoWorker;
509
+ exports.kustoDefaults = kustoDefaults;
494
510
 
495
511
  }));
@@ -1,4 +1,4 @@
1
- /// <reference types="monaco-editor/monaco" />
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
2
2
  export default class KustoCommandFormatter {
3
3
  private editor;
4
4
  private actionAdded;
@@ -1,5 +1,4 @@
1
- /// <reference types="../monaco" />
2
- /// <reference types="monaco-editor/monaco" />
1
+ import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
3
2
  /**
4
3
  * Highlights the command that surround cursor location
5
4
  */