@kusto/monaco-kusto 4.1.7 → 5.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.
@@ -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
  }
@@ -196,6 +202,9 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
196
202
  syntaxErrorAsMarkDown: {
197
203
  enableSyntaxErrorAsMarkDown: false,
198
204
  },
205
+ enableQueryWarnings: false,
206
+ enableQuerySuggestions: false,
207
+ disabledDiagnoticCodes: [],
199
208
  };
200
209
  function getKustoWorker() {
201
210
  return new Promise(function (resolve, reject) {
@@ -248,11 +257,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
248
257
  { token: 'annotation', foreground: '9400D3' },
249
258
  { token: 'invalid', background: 'cd3131' },
250
259
  ],
251
- colors: {
252
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
253
- 'editorSuggestWidget.selectedBackground': '#93CFFB',
254
- 'editorSuggestWidget.background': '#FAF9F8',
255
- },
260
+ colors: {},
256
261
  });
257
262
  monacoInstance.editor.defineTheme('kusto-dark', {
258
263
  base: 'vs-dark',
@@ -276,9 +281,7 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
276
281
  { token: 'invalid', background: 'cd3131' },
277
282
  ],
278
283
  colors: {
279
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
280
- 'editor.background': '#1B1A19',
281
- 'editorSuggestWidget.selectedBackground': '#004E8C',
284
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
282
285
  },
283
286
  });
284
287
  monacoInstance.editor.defineTheme('kusto-dark2', {
@@ -308,22 +311,18 @@ define('vs/language/kusto/monaco.contribution',["require", "exports", "./command
308
311
  if (kustoDefaults &&
309
312
  kustoDefaults.languageSettings &&
310
313
  kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
311
- var didAcceptSuggestion = event.source === 'modelChange' &&
312
- event.reason === monaco.editor.CursorChangeReason.RecoverFromMarkers;
314
+ var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
313
315
  if (!didAcceptSuggestion) {
314
316
  return;
315
317
  }
316
318
  event.selection;
317
- var completionText = editor.getModel().getValueInRange(event.selection);
318
- if (completionText[completionText.length - 1] === ' ') {
319
- // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
320
- // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
321
- // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
322
- // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
323
- // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
324
- // this is the best we have.
325
- setTimeout(function () { return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}); }, 10);
326
- }
319
+ // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
320
+ // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
321
+ // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
322
+ // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
323
+ // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
324
+ // this is the best we have.
325
+ setTimeout(function () { return editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}); }, 10);
327
326
  }
328
327
  });
329
328
  }