@kusto/monaco-kusto 6.1.1 → 6.2.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.
Files changed (45) hide show
  1. package/README.md +7 -2
  2. package/package.json +1 -1
  3. package/release/dev/kustoMode.js +45 -31
  4. package/release/dev/kustoWorker.js +6 -4
  5. package/release/dev/{main-068f3954.js → main-81df16b2.js} +2 -2
  6. package/release/dev/monaco.contribution.js +252 -241
  7. package/release/esm/kusto.worker.js +6 -4
  8. package/release/esm/kustoMode.d.ts +3 -3
  9. package/release/esm/kustoMode.js +10 -15
  10. package/release/esm/languageFeatures.d.ts +15 -19
  11. package/release/esm/monaco.contribution.d.ts +9 -8
  12. package/release/esm/monaco.contribution.js +229 -238
  13. package/release/esm/workerManager.d.ts +1 -2
  14. package/release/min/kustoMode.js +2 -2
  15. package/release/min/kustoWorker.js +3 -3
  16. package/release/min/{main-f5378257.js → main-bf0e83c5.js} +2 -2
  17. package/release/min/monaco.contribution.js +2 -2
  18. package/release/monaco.d.ts +1 -8
  19. package/release/dev/commandFormatter.d.ts +0 -6
  20. package/release/dev/commandHighlighter.d.ts +0 -20
  21. package/release/dev/extendedEditor.d.ts +0 -7
  22. package/release/dev/kustoMode.d.ts +0 -10
  23. package/release/dev/kustoWorker.d.ts +0 -89
  24. package/release/dev/languageFeatures.d.ts +0 -91
  25. package/release/dev/languageService/kustoLanguageService.d.ts +0 -144
  26. package/release/dev/languageService/kustoMonarchLanguageDefinition.d.ts +0 -2
  27. package/release/dev/languageService/renderInfo.d.ts +0 -31
  28. package/release/dev/languageService/schema.d.ts +0 -144
  29. package/release/dev/languageService/settings.d.ts +0 -30
  30. package/release/dev/monaco.contribution.d.ts +0 -15
  31. package/release/dev/workerManager.d.ts +0 -23
  32. package/release/min/commandFormatter.d.ts +0 -6
  33. package/release/min/commandHighlighter.d.ts +0 -20
  34. package/release/min/extendedEditor.d.ts +0 -7
  35. package/release/min/kustoMode.d.ts +0 -10
  36. package/release/min/kustoWorker.d.ts +0 -89
  37. package/release/min/languageFeatures.d.ts +0 -91
  38. package/release/min/languageService/kustoLanguageService.d.ts +0 -144
  39. package/release/min/languageService/kustoMonarchLanguageDefinition.d.ts +0 -2
  40. package/release/min/languageService/renderInfo.d.ts +0 -31
  41. package/release/min/languageService/schema.d.ts +0 -144
  42. package/release/min/languageService/settings.d.ts +0 -30
  43. package/release/min/monaco.contribution.d.ts +0 -15
  44. package/release/min/monaco.d.ts +0 -1
  45. package/release/min/workerManager.d.ts +0 -23
@@ -1,11 +1,30 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.1.1(678731e78268dbe877b517e302fa7db86fd96b3c)
3
+ * monaco-kusto version: 6.2.0(8e26147bc7c3b5a7a3bc6ee55311dfa0b612c10c)
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$1) { '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$1);
9
28
 
10
29
  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
30
  function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -92,7 +111,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
92
111
  return;
93
112
  }
94
113
  // 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
114
+ // Turns out that onDidCreateEditor is fired before the IStandaloneEditor is completely created (it is emitted by
96
115
  // the super ctor before the child ctor was able to fully run).
97
116
  // Thus we don't have a key binding provided yet when onDidCreateEditor is run, which is essential to call addAction.
98
117
  // By adding the action here in onDidChangeCursorSelection we're making sure that the editor has a key binding provider,
@@ -165,13 +184,14 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
165
184
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
166
185
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
167
186
  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
-
169
187
  // --- Kusto configuration and defaults ---------
170
188
 
171
189
  var LanguageServiceDefaultsImpl = /*#__PURE__*/function () {
190
+ // in milliseconds. For example - this is 2 minutes 2 * 60 * 1000
191
+
172
192
  function LanguageServiceDefaultsImpl(languageSettings) {
173
193
  _classCallCheck(this, LanguageServiceDefaultsImpl);
174
- _defineProperty(this, "_onDidChange", new monaco.Emitter());
194
+ _defineProperty(this, "_onDidChange", new monaco__namespace.Emitter());
175
195
  this.setLanguageSettings(languageSettings);
176
196
  // default to never kill worker when idle.
177
197
  // reason: when killing worker - schema gets lost. We transmit the schema back to main process when killing
@@ -243,251 +263,242 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
243
263
  function withMode(callback) {
244
264
  new Promise(function (resolve, reject) { require(['./kustoMode'], resolve, reject); }).then(callback);
245
265
  }
246
- function setupMonacoKusto(monacoInstance) {
247
- var kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
248
- function createAPI() {
249
- return {
250
- kustoDefaults: kustoDefaults,
251
- getKustoWorker: getKustoWorker
252
- };
253
- }
254
- monacoInstance.languages.kusto = createAPI();
255
- monacoInstance.languages.onLanguage('kusto', function () {
256
- withMode(function (mode) {
257
- return mode.setupMode(kustoDefaults, monacoInstance);
258
- });
259
- });
260
- monacoInstance.languages.register({
261
- id: 'kusto',
262
- extensions: ['.csl', '.kql']
263
- });
264
- monacoInstance.editor.defineTheme('kusto-light', {
265
- base: 'vs',
266
- inherit: true,
267
- rules: [{
268
- token: 'comment',
269
- foreground: '008000'
270
- },
271
- // CommentToken Green
272
- {
273
- token: 'variable.predefined',
274
- foreground: '800080'
275
- },
276
- // CalculatedColumnToken Purple
277
- {
278
- token: 'function',
279
- foreground: '0000FF'
280
- },
281
- // FunctionNameToken Blue
282
- {
283
- token: 'operator.sql',
284
- foreground: 'CC3700'
285
- },
286
- // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
287
- {
288
- token: 'string',
289
- foreground: 'B22222'
290
- },
291
- // StringLiteralToken Firebrick
292
- {
293
- token: 'operator.scss',
294
- foreground: '0000FF'
295
- },
296
- // SubOperatorToken Blue
297
- {
298
- token: 'variable',
299
- foreground: 'C71585'
300
- },
301
- // TableColumnToken MediumVioletRed
302
- {
303
- token: 'variable.parameter',
304
- foreground: '9932CC'
305
- },
306
- // TableToken DarkOrchid
307
- {
308
- token: '',
309
- foreground: '000000'
310
- },
311
- // UnknownToken, PlainTextToken Black
312
- {
313
- token: 'type',
314
- foreground: '0000FF'
315
- },
316
- // DataTypeToken Blue
317
- {
318
- token: 'tag',
319
- foreground: '0000FF'
320
- },
321
- // ControlCommandToken Blue
322
- {
323
- token: 'annotation',
324
- foreground: '2B91AF'
325
- },
326
- // QueryParametersToken FF2B91AF
327
- {
328
- token: 'keyword',
329
- foreground: '0000FF'
330
- },
331
- // CslCommandToken, PluginToken Blue
332
- {
333
- token: 'number',
334
- foreground: '191970'
335
- },
336
- // LetVariablesToken MidnightBlue
337
- {
338
- token: 'annotation',
339
- foreground: '9400D3'
340
- },
341
- // ClientDirectiveToken DarkViolet
342
- {
343
- token: 'invalid',
344
- background: 'cd3131'
345
- }],
346
- colors: {}
347
- });
348
- monacoInstance.editor.defineTheme('kusto-dark', {
349
- base: 'vs-dark',
350
- inherit: true,
351
- rules: [{
352
- token: 'comment',
353
- foreground: '608B4E'
354
- },
355
- // CommentToken Green
356
- {
357
- token: 'variable.predefined',
358
- foreground: '4ec9b0'
359
- },
360
- // CalculatedColumnToken Purple
361
- {
362
- token: 'function',
363
- foreground: 'dcdcaa'
364
- },
365
- // FunctionNameToken Blue
366
- {
367
- token: 'operator.sql',
368
- foreground: '9cdcfe'
369
- },
370
- // OperatorToken OrangeRed
371
- {
372
- token: 'string',
373
- foreground: 'ce9178'
374
- },
375
- // StringLiteralToken Firebrick
376
- {
377
- token: 'operator.scss',
378
- foreground: '569cd6'
379
- },
380
- // SubOperatorToken Blue
381
- {
382
- token: 'variable',
383
- foreground: '4ec9b0'
384
- },
385
- // TableColumnToken MediumVioletRed
386
- {
387
- token: 'variable.parameter',
388
- foreground: 'c586c0'
389
- },
390
- // TableToken DarkOrchid
391
- {
392
- token: '',
393
- foreground: 'd4d4d4'
394
- },
395
- // UnknownToken, PlainTextToken Black
396
- {
397
- token: 'type',
398
- foreground: '569cd6'
399
- },
400
- // DataTypeToken Blue
401
- {
402
- token: 'tag',
403
- foreground: '569cd6'
404
- },
405
- // ControlCommandToken Blue
406
- {
407
- token: 'annotation',
408
- foreground: '9cdcfe'
409
- },
410
- // QueryParametersToken FF2B91AF
411
- {
412
- token: 'keyword',
413
- foreground: '569cd6'
414
- },
415
- // CslCommandToken, PluginToken Blue
416
- {
417
- token: 'number',
418
- foreground: 'd7ba7d'
419
- },
420
- // LetVariablesToken MidnightBlue
421
- {
422
- token: 'annotation',
423
- foreground: 'b5cea8'
424
- },
425
- // ClientDirectiveToken DarkViolet
426
- {
427
- token: 'invalid',
428
- background: 'cd3131'
429
- }],
430
- colors: {
431
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
432
- }
433
- });
434
- monacoInstance.editor.defineTheme('kusto-dark2', {
435
- base: 'vs-dark',
436
- inherit: true,
437
- rules: [],
438
- colors: {
439
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
440
- 'editor.background': '#1B1A19',
441
- // gray 200
442
- 'editorSuggestWidget.selectedBackground': '#004E8C'
443
- }
266
+ var kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
267
+ monaco__namespace.languages.onLanguage('kusto', function () {
268
+ withMode(function (mode) {
269
+ return mode.setupMode(kustoDefaults, monaco__namespace);
444
270
  });
271
+ });
272
+ monaco__namespace.languages.register({
273
+ id: 'kusto',
274
+ extensions: ['.csl', '.kql']
275
+ });
276
+ monaco__namespace.editor.defineTheme('kusto-light', {
277
+ base: 'vs',
278
+ inherit: true,
279
+ rules: [{
280
+ token: 'comment',
281
+ foreground: '008000'
282
+ },
283
+ // CommentToken Green
284
+ {
285
+ token: 'variable.predefined',
286
+ foreground: '800080'
287
+ },
288
+ // CalculatedColumnToken Purple
289
+ {
290
+ token: 'function',
291
+ foreground: '0000FF'
292
+ },
293
+ // FunctionNameToken Blue
294
+ {
295
+ token: 'operator.sql',
296
+ foreground: 'CC3700'
297
+ },
298
+ // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
299
+ {
300
+ token: 'string',
301
+ foreground: 'B22222'
302
+ },
303
+ // StringLiteralToken Firebrick
304
+ {
305
+ token: 'operator.scss',
306
+ foreground: '0000FF'
307
+ },
308
+ // SubOperatorToken Blue
309
+ {
310
+ token: 'variable',
311
+ foreground: 'C71585'
312
+ },
313
+ // TableColumnToken MediumVioletRed
314
+ {
315
+ token: 'variable.parameter',
316
+ foreground: '9932CC'
317
+ },
318
+ // TableToken DarkOrchid
319
+ {
320
+ token: '',
321
+ foreground: '000000'
322
+ },
323
+ // UnknownToken, PlainTextToken Black
324
+ {
325
+ token: 'type',
326
+ foreground: '0000FF'
327
+ },
328
+ // DataTypeToken Blue
329
+ {
330
+ token: 'tag',
331
+ foreground: '0000FF'
332
+ },
333
+ // ControlCommandToken Blue
334
+ {
335
+ token: 'annotation',
336
+ foreground: '2B91AF'
337
+ },
338
+ // QueryParametersToken FF2B91AF
339
+ {
340
+ token: 'keyword',
341
+ foreground: '0000FF'
342
+ },
343
+ // CslCommandToken, PluginToken Blue
344
+ {
345
+ token: 'number',
346
+ foreground: '191970'
347
+ },
348
+ // LetVariablesToken MidnightBlue
349
+ {
350
+ token: 'annotation',
351
+ foreground: '9400D3'
352
+ },
353
+ // ClientDirectiveToken DarkViolet
354
+ {
355
+ token: 'invalid',
356
+ background: 'cd3131'
357
+ }],
358
+ colors: {}
359
+ });
360
+ monaco__namespace.editor.defineTheme('kusto-dark', {
361
+ base: 'vs-dark',
362
+ inherit: true,
363
+ rules: [{
364
+ token: 'comment',
365
+ foreground: '608B4E'
366
+ },
367
+ // CommentToken Green
368
+ {
369
+ token: 'variable.predefined',
370
+ foreground: '4ec9b0'
371
+ },
372
+ // CalculatedColumnToken Purple
373
+ {
374
+ token: 'function',
375
+ foreground: 'dcdcaa'
376
+ },
377
+ // FunctionNameToken Blue
378
+ {
379
+ token: 'operator.sql',
380
+ foreground: '9cdcfe'
381
+ },
382
+ // OperatorToken OrangeRed
383
+ {
384
+ token: 'string',
385
+ foreground: 'ce9178'
386
+ },
387
+ // StringLiteralToken Firebrick
388
+ {
389
+ token: 'operator.scss',
390
+ foreground: '569cd6'
391
+ },
392
+ // SubOperatorToken Blue
393
+ {
394
+ token: 'variable',
395
+ foreground: '4ec9b0'
396
+ },
397
+ // TableColumnToken MediumVioletRed
398
+ {
399
+ token: 'variable.parameter',
400
+ foreground: 'c586c0'
401
+ },
402
+ // TableToken DarkOrchid
403
+ {
404
+ token: '',
405
+ foreground: 'd4d4d4'
406
+ },
407
+ // UnknownToken, PlainTextToken Black
408
+ {
409
+ token: 'type',
410
+ foreground: '569cd6'
411
+ },
412
+ // DataTypeToken Blue
413
+ {
414
+ token: 'tag',
415
+ foreground: '569cd6'
416
+ },
417
+ // ControlCommandToken Blue
418
+ {
419
+ token: 'annotation',
420
+ foreground: '9cdcfe'
421
+ },
422
+ // QueryParametersToken FF2B91AF
423
+ {
424
+ token: 'keyword',
425
+ foreground: '569cd6'
426
+ },
427
+ // CslCommandToken, PluginToken Blue
428
+ {
429
+ token: 'number',
430
+ foreground: 'd7ba7d'
431
+ },
432
+ // LetVariablesToken MidnightBlue
433
+ {
434
+ token: 'annotation',
435
+ foreground: 'b5cea8'
436
+ },
437
+ // ClientDirectiveToken DarkViolet
438
+ {
439
+ token: 'invalid',
440
+ background: 'cd3131'
441
+ }],
442
+ colors: {
443
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
444
+ }
445
+ });
446
+ monaco__namespace.editor.defineTheme('kusto-dark2', {
447
+ base: 'vs-dark',
448
+ inherit: true,
449
+ rules: [],
450
+ colors: {
451
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
452
+ 'editor.background': '#1B1A19',
453
+ // gray 200
454
+ 'editorSuggestWidget.selectedBackground': '#004E8C'
455
+ }
456
+ });
445
457
 
446
- // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
447
- // Most other language features are initialized in kustoMode.ts
448
- monacoInstance.editor.onDidCreateEditor(function (editor) {
449
- // hook up extension methods to editor.
450
- extend(editor);
451
- new KustoCommandHighlighter(editor);
452
- if (isStandaloneCodeEditor(editor)) {
453
- new KustoCommandFormatter(editor);
458
+ // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
459
+ // Most other language features are initialized in kustoMode.ts
460
+ monaco__namespace.editor.onDidCreateEditor(function (editor) {
461
+ // hook up extension methods to editor.
462
+ extend(editor);
463
+ new KustoCommandHighlighter(editor);
464
+ if (isStandaloneCodeEditor(editor)) {
465
+ new KustoCommandFormatter(editor);
466
+ }
467
+ triggerSuggestDialogWhenCompletionItemSelected(editor);
468
+ });
469
+ function triggerSuggestDialogWhenCompletionItemSelected(editor) {
470
+ editor.onDidChangeCursorSelection(function (event) {
471
+ // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
472
+ if (kustoDefaults && kustoDefaults.languageSettings && kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
473
+ var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco__namespace.editor.CursorChangeReason.NotSet;
474
+ // If the word at the current position is not null - meaning we did not add a space after completion.
475
+ // In this case we don't want to activate the eager mode, since it will display the current selected word..
476
+ if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
477
+ return;
478
+ }
479
+ event.selection;
480
+ // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
481
+ // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
482
+ // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
483
+ // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
484
+ // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
485
+ // this is the best we have.
486
+ setTimeout(function () {
487
+ return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {});
488
+ }, 10);
454
489
  }
455
- triggerSuggestDialogWhenCompletionItemSelected(editor);
456
490
  });
457
- function triggerSuggestDialogWhenCompletionItemSelected(editor) {
458
- editor.onDidChangeCursorSelection(function (event) {
459
- // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
460
- if (kustoDefaults && kustoDefaults.languageSettings && kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
461
- var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
462
- // If the word at the current position is not null - meaning we did not add a space after completion.
463
- // In this case we don't want to activate the eager mode, since it will display the current selected word..
464
- if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
465
- return;
466
- }
467
- event.selection;
468
- // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
469
- // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
470
- // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
471
- // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
472
- // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
473
- // this is the best we have.
474
- setTimeout(function () {
475
- return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {});
476
- }, 10);
477
- }
478
- });
479
- }
480
491
  }
481
492
  function isStandaloneCodeEditor(editor) {
482
493
  return editor.addAction !== undefined;
483
494
  }
484
-
485
- // --- Registration to monaco editor ---
486
- if (monaco.editor) {
487
- setupMonacoKusto(monaco);
488
- }
495
+ monaco__namespace.languages.kusto = {
496
+ kustoDefaults: kustoDefaults,
497
+ getKustoWorker: getKustoWorker
498
+ };
489
499
 
490
500
  exports.LanguageServiceDefaultsImpl = LanguageServiceDefaultsImpl;
491
- exports.setupMonacoKusto = setupMonacoKusto;
501
+ exports.getKustoWorker = getKustoWorker;
502
+ exports.kustoDefaults = kustoDefaults;
492
503
 
493
504
  }));
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.1.1(678731e78268dbe877b517e302fa7db86fd96b3c)
3
+ * monaco-kusto version: 6.2.0(8e26147bc7c3b5a7a3bc6ee55311dfa0b612c10c)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
@@ -17,14 +17,12 @@ import '@kusto/language-service-next/Kusto.Language.Bridge.min';
17
17
 
18
18
  // an input parameter either be a scalar in which case it has a name, type and cslType, or it can be columnar, in which case
19
19
  // it will have a name, and a list of scalar types which are the column types.
20
-
21
20
  /**
22
21
  * Schema types:
23
22
  * Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
24
23
  * Cluster Manager – Internal only. A schema for clusters that manages other clusters.
25
24
  * Data Management – Internal only. A schema for ingestion point operations.
26
25
  */
27
-
28
26
  const dotnetTypeToKustoType = {
29
27
  'System.SByte': 'bool',
30
28
  'System.Byte': 'uint8',
@@ -364,7 +362,11 @@ class KustoLanguageService {
364
362
  const lsItem = ls.CompletionItem.create(kItem.DisplayText);
365
363
 
366
364
  // Adding to columns a prefix to their sortText so they will appear first in the list
367
- const sortTextPrefix = lsItem.kind === ls.CompletionItemKind.Field ? 0 : itemsAsArray.length;
365
+ let sortTextPrefix = lsItem.kind === ls.CompletionItemKind.Field ? 0 : itemsAsArray.length;
366
+ const countOfWords = lsItem.label.split('_').length;
367
+ // We always want results with multiple words to show after shorter options.
368
+ // For example: to show "count_distinct" after "count"
369
+ sortTextPrefix = sortTextPrefix * countOfWords;
368
370
  const startPosition = document.positionAt(completionItems.EditStart);
369
371
  const endPosition = document.positionAt(completionItems.EditStart + completionItems.EditLength);
370
372
  lsItem.textEdit = ls.TextEdit.replace(ls.Range.create(startPosition, endPosition), textToInsert);
@@ -1,10 +1,10 @@
1
1
  /// <reference types="../monaco" />
2
2
  /// <reference types="monaco-editor/monaco" />
3
3
  import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
4
- import { WorkerAccessor } from './languageFeatures';
4
+ import * as languageFeatures from './languageFeatures';
5
5
  /**
6
6
  * Called when Kusto language is first needed (a model has the language set)
7
7
  * @param defaults
8
8
  */
9
- export declare function setupMode(defaults: LanguageServiceDefaultsImpl, monacoInstance: typeof monaco): WorkerAccessor;
10
- export declare function getKustoWorker(): Promise<WorkerAccessor>;
9
+ export declare function setupMode(defaults: LanguageServiceDefaultsImpl, monacoInstance: typeof globalThis.monaco): languageFeatures.WorkerAccessor;
10
+ export declare function getKustoWorker(): Promise<languageFeatures.WorkerAccessor>;
@@ -1,10 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.1.1(678731e78268dbe877b517e302fa7db86fd96b3c)
3
+ * monaco-kusto version: 6.2.0(8e26147bc7c3b5a7a3bc6ee55311dfa0b612c10c)
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
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
8
9
  import * as ls from 'vscode-languageserver-types';
9
10
  import debounce from 'lodash-es/debounce';
10
11
 
@@ -174,12 +175,8 @@ const KustoLanguageDefinition = {
174
175
  }
175
176
  };
176
177
 
177
- var Uri = monaco.Uri;
178
- monaco.Position;
179
- var Range = monaco.Range;
180
- monaco.Thenable;
181
- monaco.CancellationToken;
182
- monaco.IDisposable;
178
+ // --- diagnostics ---
179
+
183
180
  class DiagnosticsAdapter {
184
181
  _disposables = [];
185
182
  _contentListener = Object.create(null);
@@ -635,7 +632,7 @@ class ColorizationAdapter {
635
632
 
636
633
  /**
637
634
  * Return true if the range doesn't intersect any of the line ranges.
638
- * @param range Range
635
+ * @param range monaco.Range
639
636
  * @param impactedLineRanges an array of line ranges
640
637
  */
641
638
  _rangeDoesNotIntersectAny(range, impactedLineRanges) {
@@ -731,7 +728,7 @@ function injectCss() {
731
728
  function toDecoration(model, classification) {
732
729
  const start = model.getPositionAt(classification.start);
733
730
  const end = model.getPositionAt(classification.start + classification.length);
734
- const range = new Range(start.lineNumber, start.column, end.lineNumber, end.column);
731
+ const range = new monaco.Range(start.lineNumber, start.column, end.lineNumber, end.column);
735
732
  const inlineClassName = ClassificationKindNames[classification.kind];
736
733
  return {
737
734
  range,
@@ -765,7 +762,7 @@ function toRange(range) {
765
762
  if (!range) {
766
763
  return void 0;
767
764
  }
768
- return new Range(range.start.line + 1, range.start.character + 1, range.end.line + 1, range.end.character + 1);
765
+ return new monaco.Range(range.start.line + 1, range.start.character + 1, range.end.line + 1, range.end.character + 1);
769
766
  }
770
767
  function toCompletionItemKind(kind) {
771
768
  let mItemKind = monaco.languages.CompletionItemKind;
@@ -850,7 +847,7 @@ class CompletionAdapter {
850
847
  }
851
848
  provideCompletionItems(model, position, context, token) {
852
849
  const wordInfo = model.getWordUntilPosition(position);
853
- const wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
850
+ const wordRange = new monaco.Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
854
851
  const resource = model.uri;
855
852
  const onDidProvideCompletionItems = this.languageSettings.onDidProvideCompletionItems;
856
853
  return this._worker(resource).then(worker => {
@@ -923,7 +920,7 @@ function toMarkedStringArray(contents) {
923
920
 
924
921
  function toLocation(location) {
925
922
  return {
926
- uri: Uri.parse(location.uri),
923
+ uri: monaco.Uri.parse(location.uri),
927
924
  range: toRange(location.range)
928
925
  };
929
926
  }
@@ -971,7 +968,7 @@ function toWorkspaceEdit(edit) {
971
968
  }
972
969
  let resourceEdits = [];
973
970
  for (let uri in edit.changes) {
974
- const _uri = Uri.parse(uri);
971
+ const _uri = monaco.Uri.parse(uri);
975
972
  for (let e of edit.changes[uri]) {
976
973
  resourceEdits.push({
977
974
  resource: _uri,
@@ -1068,8 +1065,6 @@ class HoverAdapter {
1068
1065
  }
1069
1066
  }
1070
1067
 
1071
- monaco.Uri;
1072
- monaco.IDisposable;
1073
1068
  let kustoWorker;
1074
1069
  let resolveWorker;
1075
1070
  let workerPromise = new Promise((resolve, reject) => {