@kusto/monaco-kusto 4.1.6 → 5.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.
@@ -17,7 +17,7 @@ define('vs/language/kusto/commandHighlighter',["require", "exports"], function (
17
17
  // Note that selection update is triggered not only for selection changes, but also just when no text selection is occuring and cursor just moves around.
18
18
  // This case is counted as a 0-length selection starting and ending on the cursor position.
19
19
  this.editor.onDidChangeCursorSelection(function (changeEvent) {
20
- if (_this.editor.getModel().getModeId() !== 'kusto') {
20
+ if (_this.editor.getModel().getLanguageId() !== 'kusto') {
21
21
  return;
22
22
  }
23
23
  _this.highlightCommandUnderCursor(changeEvent);
@@ -37,14 +37,18 @@ define('vs/language/kusto/commandHighlighter',["require", "exports"], function (
37
37
  return;
38
38
  }
39
39
  var commandRange = this.editor.getCurrentCommandRange(changeEvent.selection.getStartPosition());
40
- var decorations = [{
40
+ var decorations = [
41
+ {
41
42
  range: commandRange,
42
- options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT
43
- }];
43
+ options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT,
44
+ },
45
+ ];
44
46
  this.decorations = this.editor.deltaDecorations(this.decorations, decorations);
45
47
  };
46
48
  KustoCommandHighlighter.ID = 'editor.contrib.kustoCommandHighliter';
47
- KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT = { className: 'selectionHighlight' };
49
+ KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT = {
50
+ className: 'selectionHighlight',
51
+ };
48
52
  return KustoCommandHighlighter;
49
53
  }());
50
54
  exports.default = KustoCommandHighlighter;
@@ -61,7 +65,7 @@ define('vs/language/kusto/commandFormatter',["require", "exports"], function (re
61
65
  // selection also represents no selection - for example the event gets triggered when moving cursor from point
62
66
  // a to point b. in the case start position will equal end position.
63
67
  editor.onDidChangeCursorSelection(function (changeEvent) {
64
- if (_this.editor.getModel().getModeId() !== 'kusto') {
68
+ if (_this.editor.getModel().getLanguageId() !== 'kusto') {
65
69
  return;
66
70
  }
67
71
  // Theoretically you would expect this code to run only once in onDidCreateEditor.
@@ -74,11 +78,13 @@ define('vs/language/kusto/commandFormatter',["require", "exports"], function (re
74
78
  editor.addAction({
75
79
  id: 'editor.action.kusto.formatCurrentCommand',
76
80
  label: 'Format Command Under Cursor',
77
- keybindings: [monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_K, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_F)],
81
+ keybindings: [
82
+ monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyF),
83
+ ],
78
84
  run: function (ed) {
79
85
  editor.trigger('KustoCommandFormatter', 'editor.action.formatSelection', null);
80
86
  },
81
- contextMenuGroupId: '1_modification'
87
+ contextMenuGroupId: '1_modification',
82
88
  });
83
89
  _this.actionAdded = true;
84
90
  }
@@ -248,11 +254,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
248
254
  { token: 'annotation', foreground: '9400D3' },
249
255
  { token: 'invalid', background: 'cd3131' },
250
256
  ],
251
- colors: {
252
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
253
- 'editorSuggestWidget.selectedBackground': '#93CFFB',
254
- 'editorSuggestWidget.background': '#FAF9F8',
255
- },
257
+ colors: {},
256
258
  });
257
259
  monacoInstance.editor.defineTheme('kusto-dark', {
258
260
  base: 'vs-dark',
@@ -276,9 +278,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
276
278
  { token: 'invalid', background: 'cd3131' },
277
279
  ],
278
280
  colors: {
279
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
280
- 'editorSuggestWidget.selectedBackground': '#001191',
281
- 'editorSuggestWidget.background': '#000000',
281
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
282
282
  },
283
283
  });
284
284
  monacoInstance.editor.defineTheme('kusto-dark2', {
@@ -286,10 +286,9 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
286
286
  inherit: true,
287
287
  rules: [],
288
288
  colors: {
289
- 'editor.background': '#1B1A19',
290
289
  // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
291
- 'editorSuggestWidget.selectedBackground': '#001191',
292
- 'editorSuggestWidget.background': '#000000',
290
+ 'editor.background': '#1B1A19',
291
+ 'editorSuggestWidget.selectedBackground': '#004E8C',
293
292
  },
294
293
  });
295
294
  // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
@@ -309,22 +308,18 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
309
308
  if (kustoDefaults &&
310
309
  kustoDefaults.languageSettings &&
311
310
  kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
312
- var didAcceptSuggestion = event.source === 'modelChange' &&
313
- event.reason === monaco.editor.CursorChangeReason.RecoverFromMarkers;
311
+ var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
314
312
  if (!didAcceptSuggestion) {
315
313
  return;
316
314
  }
317
315
  event.selection;
318
- var completionText = editor.getModel().getValueInRange(event.selection);
319
- if (completionText[completionText.length - 1] === ' ') {
320
- // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
321
- // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
322
- // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
323
- // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
324
- // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
325
- // this is the best we have.
326
- setTimeout(function () { return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}); }, 10);
327
- }
316
+ // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
317
+ // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
318
+ // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
319
+ // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
320
+ // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
321
+ // this is the best we have.
322
+ setTimeout(function () { return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}); }, 10);
328
323
  }
329
324
  });
330
325
  }