@kusto/monaco-kusto 6.1.2 → 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.
@@ -1,15 +1,11 @@
1
- /// <reference types="monaco-editor/monaco" />
2
1
  /// <reference types="../monaco" />
2
+ /// <reference types="monaco-editor/monaco" />
3
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
3
4
  import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
4
5
  import type { KustoWorker } from './kustoWorker';
5
- import Uri = monaco.Uri;
6
- import Position = monaco.Position;
7
- import Range = monaco.Range;
8
- import Thenable = monaco.Thenable;
9
- import CancellationToken = monaco.CancellationToken;
10
6
  import type { Schema } from './languageService/schema';
11
7
  export interface WorkerAccessor {
12
- (first: Uri, ...more: Uri[]): Promise<KustoWorker>;
8
+ (first: monaco.Uri, ...more: monaco.Uri[]): Promise<KustoWorker>;
13
9
  }
14
10
  export declare class DiagnosticsAdapter {
15
11
  private _monacoInstance;
@@ -22,7 +18,7 @@ export declare class DiagnosticsAdapter {
22
18
  private _schemaListener;
23
19
  private _cursorListener;
24
20
  private _debouncedValidations;
25
- constructor(_monacoInstance: typeof monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaultsImpl, onSchemaChange: monaco.IEvent<Schema>);
21
+ constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaultsImpl, onSchemaChange: monaco.IEvent<Schema>);
26
22
  private getMonacoCodeActions;
27
23
  private getOrCreateDebouncedValidation;
28
24
  dispose(): void;
@@ -37,11 +33,11 @@ export declare class ColorizationAdapter {
37
33
  private _configurationListener;
38
34
  private _schemaListener;
39
35
  private decorations;
40
- constructor(_monacoInstance: typeof monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaultsImpl, onSchemaChange: monaco.IEvent<Schema>);
36
+ constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaultsImpl, onSchemaChange: monaco.IEvent<Schema>);
41
37
  dispose(): void;
42
38
  /**
43
39
  * Return true if the range doesn't intersect any of the line ranges.
44
- * @param range Range
40
+ * @param range monaco.Range
45
41
  * @param impactedLineRanges an array of line ranges
46
42
  */
47
43
  private _rangeDoesNotIntersectAny;
@@ -50,42 +46,42 @@ export declare class ColorizationAdapter {
50
46
  export declare class CompletionAdapter implements monaco.languages.CompletionItemProvider {
51
47
  private _worker;
52
48
  private languageSettings;
53
- constructor(_worker: WorkerAccessor, languageSettings: monaco.languages.kusto.LanguageSettings);
49
+ constructor(_worker: WorkerAccessor, languageSettings: globalThis.monaco.languages.kusto.LanguageSettings);
54
50
  get triggerCharacters(): string[];
55
- provideCompletionItems(model: monaco.editor.IReadOnlyModel, position: Position, context: monaco.languages.CompletionContext, token: CancellationToken): Thenable<monaco.languages.CompletionList>;
51
+ provideCompletionItems(model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.CompletionContext, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.CompletionList>;
56
52
  }
57
53
  export declare class DefinitionAdapter {
58
54
  private _worker;
59
55
  constructor(_worker: WorkerAccessor);
60
- provideDefinition(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.Definition>;
56
+ provideDefinition(model: monaco.editor.IReadOnlyModel, position: monaco.Position, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.Definition>;
61
57
  }
62
58
  export declare class ReferenceAdapter implements monaco.languages.ReferenceProvider {
63
59
  private _worker;
64
60
  constructor(_worker: WorkerAccessor);
65
- provideReferences(model: monaco.editor.IReadOnlyModel, position: Position, context: monaco.languages.ReferenceContext, token: CancellationToken): Thenable<monaco.languages.Location[]>;
61
+ provideReferences(model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.ReferenceContext, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.Location[]>;
66
62
  }
67
63
  export declare class RenameAdapter implements monaco.languages.RenameProvider {
68
64
  private _worker;
69
65
  constructor(_worker: WorkerAccessor);
70
- provideRenameEdits(model: monaco.editor.IReadOnlyModel, position: Position, newName: string, token: CancellationToken): Thenable<monaco.languages.WorkspaceEdit>;
66
+ provideRenameEdits(model: monaco.editor.IReadOnlyModel, position: monaco.Position, newName: string, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.WorkspaceEdit>;
71
67
  }
72
68
  export declare class DocumentFormatAdapter implements monaco.languages.DocumentFormattingEditProvider {
73
69
  private _worker;
74
70
  constructor(_worker: WorkerAccessor);
75
- provideDocumentFormattingEdits(model: monaco.editor.IReadOnlyModel, options: monaco.languages.FormattingOptions, token: CancellationToken): monaco.languages.TextEdit[] | Thenable<monaco.languages.TextEdit[]>;
71
+ provideDocumentFormattingEdits(model: monaco.editor.IReadOnlyModel, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken): monaco.languages.TextEdit[] | monaco.Thenable<monaco.languages.TextEdit[]>;
76
72
  }
77
73
  export declare class FormatAdapter implements monaco.languages.DocumentRangeFormattingEditProvider {
78
74
  private _worker;
79
75
  constructor(_worker: WorkerAccessor);
80
- provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: Range, options: monaco.languages.FormattingOptions, token: CancellationToken): monaco.languages.TextEdit[] | Thenable<monaco.languages.TextEdit[]>;
76
+ provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: monaco.Range, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken): monaco.languages.TextEdit[] | monaco.Thenable<monaco.languages.TextEdit[]>;
81
77
  }
82
78
  export declare class FoldingAdapter implements monaco.languages.FoldingRangeProvider {
83
79
  private _worker;
84
80
  constructor(_worker: WorkerAccessor);
85
- provideFoldingRanges(model: monaco.editor.ITextModel, context: monaco.languages.FoldingContext, token: CancellationToken): monaco.languages.FoldingRange[] | PromiseLike<monaco.languages.FoldingRange[]>;
81
+ provideFoldingRanges(model: monaco.editor.ITextModel, context: monaco.languages.FoldingContext, token: monaco.CancellationToken): monaco.languages.FoldingRange[] | PromiseLike<monaco.languages.FoldingRange[]>;
86
82
  }
87
83
  export declare class HoverAdapter implements monaco.languages.HoverProvider {
88
84
  private _worker;
89
85
  constructor(_worker: WorkerAccessor);
90
- provideHover(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.Hover>;
86
+ provideHover(model: monaco.editor.IReadOnlyModel, position: monaco.Position, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.Hover>;
91
87
  }
@@ -1,15 +1,16 @@
1
1
  /// <reference types="../monaco" />
2
- /// <reference types="monaco-editor/monaco" />
3
- import 'monaco-editor';
4
- export declare class LanguageServiceDefaultsImpl implements monaco.languages.kusto.LanguageServiceDefaults {
2
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
3
+ import type { KustoWorker } from './kustoWorker';
4
+ export declare class LanguageServiceDefaultsImpl implements globalThis.globalThis.monaco.languages.kusto.LanguageServiceDefaults {
5
5
  private _onDidChange;
6
6
  private _languageSettings;
7
7
  private _workerMaxIdleTime;
8
- constructor(languageSettings: monaco.languages.kusto.LanguageSettings);
9
- get onDidChange(): monaco.IEvent<monaco.languages.kusto.LanguageServiceDefaults>;
10
- get languageSettings(): monaco.languages.kusto.LanguageSettings;
11
- setLanguageSettings(options: monaco.languages.kusto.LanguageSettings): void;
8
+ constructor(languageSettings: globalThis.monaco.languages.kusto.LanguageSettings);
9
+ get onDidChange(): monaco.IEvent<globalThis.monaco.languages.kusto.LanguageServiceDefaults>;
10
+ get languageSettings(): globalThis.monaco.languages.kusto.LanguageSettings;
11
+ setLanguageSettings(options: globalThis.monaco.languages.kusto.LanguageSettings): void;
12
12
  setMaximumWorkerIdleTime(value: number): void;
13
13
  getWorkerMaxIdleTime(): number;
14
14
  }
15
- export declare function setupMonacoKusto(monacoInstance: typeof monaco): void;
15
+ export declare function getKustoWorker(): Promise<(first: monaco.Uri, ...more: monaco.Uri[]) => Promise<KustoWorker>>;
16
+ export declare const kustoDefaults: LanguageServiceDefaultsImpl;
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 6.1.2(4c9ec21ad04b49f9f8e8a8f7fe773fe9a8b47334)
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 'monaco-editor';
8
+ import * as monaco$1 from 'monaco-editor/esm/vs/editor/editor.api';
9
9
 
10
10
  /**
11
11
  * Highlights the command that surround cursor location
@@ -66,7 +66,7 @@ class KustoCommandFormatter {
66
66
  return;
67
67
  }
68
68
  // Theoretically you would expect this code to run only once in onDidCreateEditor.
69
- // Turns out that onDidCreateEditor is fired before the IStandaloneEditor is completely created (it is emmited by
69
+ // Turns out that onDidCreateEditor is fired before the IStandaloneEditor is completely created (it is emitted by
70
70
  // the super ctor before the child ctor was able to fully run).
71
71
  // Thus we don't have a key binding provided yet when onDidCreateEditor is run, which is essential to call addAction.
72
72
  // By adding the action here in onDidChangeCursorSelection we're making sure that the editor has a key binding provider,
@@ -131,12 +131,10 @@ function extend(editor) {
131
131
  };
132
132
  }
133
133
 
134
- // Import monaco-editor to ensure "monaco" global is available before any other
135
-
136
134
  // --- Kusto configuration and defaults ---------
137
135
 
138
136
  class LanguageServiceDefaultsImpl {
139
- _onDidChange = new monaco.Emitter();
137
+ _onDidChange = new monaco$1.Emitter();
140
138
 
141
139
  // in milliseconds. For example - this is 2 minutes 2 * 60 * 1000
142
140
 
@@ -200,244 +198,234 @@ function getKustoWorker() {
200
198
  function withMode(callback) {
201
199
  import('./kustoMode.js').then(callback);
202
200
  }
203
- function setupMonacoKusto(monacoInstance) {
204
- const kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
205
- function createAPI() {
206
- return {
207
- kustoDefaults,
208
- getKustoWorker
209
- };
201
+ const kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
202
+ monaco$1.languages.onLanguage('kusto', () => {
203
+ withMode(mode => mode.setupMode(kustoDefaults, monaco$1));
204
+ });
205
+ monaco$1.languages.register({
206
+ id: 'kusto',
207
+ extensions: ['.csl', '.kql']
208
+ });
209
+ monaco$1.editor.defineTheme('kusto-light', {
210
+ base: 'vs',
211
+ inherit: true,
212
+ rules: [{
213
+ token: 'comment',
214
+ foreground: '008000'
215
+ },
216
+ // CommentToken Green
217
+ {
218
+ token: 'variable.predefined',
219
+ foreground: '800080'
220
+ },
221
+ // CalculatedColumnToken Purple
222
+ {
223
+ token: 'function',
224
+ foreground: '0000FF'
225
+ },
226
+ // FunctionNameToken Blue
227
+ {
228
+ token: 'operator.sql',
229
+ foreground: 'CC3700'
230
+ },
231
+ // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
232
+ {
233
+ token: 'string',
234
+ foreground: 'B22222'
235
+ },
236
+ // StringLiteralToken Firebrick
237
+ {
238
+ token: 'operator.scss',
239
+ foreground: '0000FF'
240
+ },
241
+ // SubOperatorToken Blue
242
+ {
243
+ token: 'variable',
244
+ foreground: 'C71585'
245
+ },
246
+ // TableColumnToken MediumVioletRed
247
+ {
248
+ token: 'variable.parameter',
249
+ foreground: '9932CC'
250
+ },
251
+ // TableToken DarkOrchid
252
+ {
253
+ token: '',
254
+ foreground: '000000'
255
+ },
256
+ // UnknownToken, PlainTextToken Black
257
+ {
258
+ token: 'type',
259
+ foreground: '0000FF'
260
+ },
261
+ // DataTypeToken Blue
262
+ {
263
+ token: 'tag',
264
+ foreground: '0000FF'
265
+ },
266
+ // ControlCommandToken Blue
267
+ {
268
+ token: 'annotation',
269
+ foreground: '2B91AF'
270
+ },
271
+ // QueryParametersToken FF2B91AF
272
+ {
273
+ token: 'keyword',
274
+ foreground: '0000FF'
275
+ },
276
+ // CslCommandToken, PluginToken Blue
277
+ {
278
+ token: 'number',
279
+ foreground: '191970'
280
+ },
281
+ // LetVariablesToken MidnightBlue
282
+ {
283
+ token: 'annotation',
284
+ foreground: '9400D3'
285
+ },
286
+ // ClientDirectiveToken DarkViolet
287
+ {
288
+ token: 'invalid',
289
+ background: 'cd3131'
290
+ }],
291
+ colors: {}
292
+ });
293
+ monaco$1.editor.defineTheme('kusto-dark', {
294
+ base: 'vs-dark',
295
+ inherit: true,
296
+ rules: [{
297
+ token: 'comment',
298
+ foreground: '608B4E'
299
+ },
300
+ // CommentToken Green
301
+ {
302
+ token: 'variable.predefined',
303
+ foreground: '4ec9b0'
304
+ },
305
+ // CalculatedColumnToken Purple
306
+ {
307
+ token: 'function',
308
+ foreground: 'dcdcaa'
309
+ },
310
+ // FunctionNameToken Blue
311
+ {
312
+ token: 'operator.sql',
313
+ foreground: '9cdcfe'
314
+ },
315
+ // OperatorToken OrangeRed
316
+ {
317
+ token: 'string',
318
+ foreground: 'ce9178'
319
+ },
320
+ // StringLiteralToken Firebrick
321
+ {
322
+ token: 'operator.scss',
323
+ foreground: '569cd6'
324
+ },
325
+ // SubOperatorToken Blue
326
+ {
327
+ token: 'variable',
328
+ foreground: '4ec9b0'
329
+ },
330
+ // TableColumnToken MediumVioletRed
331
+ {
332
+ token: 'variable.parameter',
333
+ foreground: 'c586c0'
334
+ },
335
+ // TableToken DarkOrchid
336
+ {
337
+ token: '',
338
+ foreground: 'd4d4d4'
339
+ },
340
+ // UnknownToken, PlainTextToken Black
341
+ {
342
+ token: 'type',
343
+ foreground: '569cd6'
344
+ },
345
+ // DataTypeToken Blue
346
+ {
347
+ token: 'tag',
348
+ foreground: '569cd6'
349
+ },
350
+ // ControlCommandToken Blue
351
+ {
352
+ token: 'annotation',
353
+ foreground: '9cdcfe'
354
+ },
355
+ // QueryParametersToken FF2B91AF
356
+ {
357
+ token: 'keyword',
358
+ foreground: '569cd6'
359
+ },
360
+ // CslCommandToken, PluginToken Blue
361
+ {
362
+ token: 'number',
363
+ foreground: 'd7ba7d'
364
+ },
365
+ // LetVariablesToken MidnightBlue
366
+ {
367
+ token: 'annotation',
368
+ foreground: 'b5cea8'
369
+ },
370
+ // ClientDirectiveToken DarkViolet
371
+ {
372
+ token: 'invalid',
373
+ background: 'cd3131'
374
+ }],
375
+ colors: {
376
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
210
377
  }
211
- monacoInstance.languages.kusto = createAPI();
212
- monacoInstance.languages.onLanguage('kusto', () => {
213
- withMode(mode => mode.setupMode(kustoDefaults, monacoInstance));
214
- });
215
- monacoInstance.languages.register({
216
- id: 'kusto',
217
- extensions: ['.csl', '.kql']
218
- });
219
- monacoInstance.editor.defineTheme('kusto-light', {
220
- base: 'vs',
221
- inherit: true,
222
- rules: [{
223
- token: 'comment',
224
- foreground: '008000'
225
- },
226
- // CommentToken Green
227
- {
228
- token: 'variable.predefined',
229
- foreground: '800080'
230
- },
231
- // CalculatedColumnToken Purple
232
- {
233
- token: 'function',
234
- foreground: '0000FF'
235
- },
236
- // FunctionNameToken Blue
237
- {
238
- token: 'operator.sql',
239
- foreground: 'CC3700'
240
- },
241
- // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
242
- {
243
- token: 'string',
244
- foreground: 'B22222'
245
- },
246
- // StringLiteralToken Firebrick
247
- {
248
- token: 'operator.scss',
249
- foreground: '0000FF'
250
- },
251
- // SubOperatorToken Blue
252
- {
253
- token: 'variable',
254
- foreground: 'C71585'
255
- },
256
- // TableColumnToken MediumVioletRed
257
- {
258
- token: 'variable.parameter',
259
- foreground: '9932CC'
260
- },
261
- // TableToken DarkOrchid
262
- {
263
- token: '',
264
- foreground: '000000'
265
- },
266
- // UnknownToken, PlainTextToken Black
267
- {
268
- token: 'type',
269
- foreground: '0000FF'
270
- },
271
- // DataTypeToken Blue
272
- {
273
- token: 'tag',
274
- foreground: '0000FF'
275
- },
276
- // ControlCommandToken Blue
277
- {
278
- token: 'annotation',
279
- foreground: '2B91AF'
280
- },
281
- // QueryParametersToken FF2B91AF
282
- {
283
- token: 'keyword',
284
- foreground: '0000FF'
285
- },
286
- // CslCommandToken, PluginToken Blue
287
- {
288
- token: 'number',
289
- foreground: '191970'
290
- },
291
- // LetVariablesToken MidnightBlue
292
- {
293
- token: 'annotation',
294
- foreground: '9400D3'
295
- },
296
- // ClientDirectiveToken DarkViolet
297
- {
298
- token: 'invalid',
299
- background: 'cd3131'
300
- }],
301
- colors: {}
302
- });
303
- monacoInstance.editor.defineTheme('kusto-dark', {
304
- base: 'vs-dark',
305
- inherit: true,
306
- rules: [{
307
- token: 'comment',
308
- foreground: '608B4E'
309
- },
310
- // CommentToken Green
311
- {
312
- token: 'variable.predefined',
313
- foreground: '4ec9b0'
314
- },
315
- // CalculatedColumnToken Purple
316
- {
317
- token: 'function',
318
- foreground: 'dcdcaa'
319
- },
320
- // FunctionNameToken Blue
321
- {
322
- token: 'operator.sql',
323
- foreground: '9cdcfe'
324
- },
325
- // OperatorToken OrangeRed
326
- {
327
- token: 'string',
328
- foreground: 'ce9178'
329
- },
330
- // StringLiteralToken Firebrick
331
- {
332
- token: 'operator.scss',
333
- foreground: '569cd6'
334
- },
335
- // SubOperatorToken Blue
336
- {
337
- token: 'variable',
338
- foreground: '4ec9b0'
339
- },
340
- // TableColumnToken MediumVioletRed
341
- {
342
- token: 'variable.parameter',
343
- foreground: 'c586c0'
344
- },
345
- // TableToken DarkOrchid
346
- {
347
- token: '',
348
- foreground: 'd4d4d4'
349
- },
350
- // UnknownToken, PlainTextToken Black
351
- {
352
- token: 'type',
353
- foreground: '569cd6'
354
- },
355
- // DataTypeToken Blue
356
- {
357
- token: 'tag',
358
- foreground: '569cd6'
359
- },
360
- // ControlCommandToken Blue
361
- {
362
- token: 'annotation',
363
- foreground: '9cdcfe'
364
- },
365
- // QueryParametersToken FF2B91AF
366
- {
367
- token: 'keyword',
368
- foreground: '569cd6'
369
- },
370
- // CslCommandToken, PluginToken Blue
371
- {
372
- token: 'number',
373
- foreground: 'd7ba7d'
374
- },
375
- // LetVariablesToken MidnightBlue
376
- {
377
- token: 'annotation',
378
- foreground: 'b5cea8'
379
- },
380
- // ClientDirectiveToken DarkViolet
381
- {
382
- token: 'invalid',
383
- background: 'cd3131'
384
- }],
385
- colors: {
386
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
387
- }
388
- });
389
- monacoInstance.editor.defineTheme('kusto-dark2', {
390
- base: 'vs-dark',
391
- inherit: true,
392
- rules: [],
393
- colors: {
394
- // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
395
- 'editor.background': '#1B1A19',
396
- // gray 200
397
- 'editorSuggestWidget.selectedBackground': '#004E8C'
398
- }
399
- });
378
+ });
379
+ monaco$1.editor.defineTheme('kusto-dark2', {
380
+ base: 'vs-dark',
381
+ inherit: true,
382
+ rules: [],
383
+ colors: {
384
+ // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
385
+ 'editor.background': '#1B1A19',
386
+ // gray 200
387
+ 'editorSuggestWidget.selectedBackground': '#004E8C'
388
+ }
389
+ });
400
390
 
401
- // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
402
- // Most other language features are initialized in kustoMode.ts
403
- monacoInstance.editor.onDidCreateEditor(editor => {
404
- // hook up extension methods to editor.
405
- extend(editor);
406
- new KustoCommandHighlighter(editor);
407
- if (isStandaloneCodeEditor(editor)) {
408
- new KustoCommandFormatter(editor);
391
+ // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
392
+ // Most other language features are initialized in kustoMode.ts
393
+ monaco$1.editor.onDidCreateEditor(editor => {
394
+ // hook up extension methods to editor.
395
+ extend(editor);
396
+ new KustoCommandHighlighter(editor);
397
+ if (isStandaloneCodeEditor(editor)) {
398
+ new KustoCommandFormatter(editor);
399
+ }
400
+ triggerSuggestDialogWhenCompletionItemSelected(editor);
401
+ });
402
+ function triggerSuggestDialogWhenCompletionItemSelected(editor) {
403
+ editor.onDidChangeCursorSelection(event => {
404
+ // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
405
+ if (kustoDefaults && kustoDefaults.languageSettings && kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
406
+ var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco$1.editor.CursorChangeReason.NotSet;
407
+ // If the word at the current position is not null - meaning we did not add a space after completion.
408
+ // In this case we don't want to activate the eager mode, since it will display the current selected word..
409
+ if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
410
+ return;
411
+ }
412
+ event.selection;
413
+ // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
414
+ // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
415
+ // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
416
+ // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
417
+ // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
418
+ // this is the best we have.
419
+ setTimeout(() => editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}), 10);
409
420
  }
410
- triggerSuggestDialogWhenCompletionItemSelected(editor);
411
421
  });
412
- function triggerSuggestDialogWhenCompletionItemSelected(editor) {
413
- editor.onDidChangeCursorSelection(event => {
414
- // checking the condition inside the event makes sure we will stay up to date when kusto configuration changes at runtime.
415
- if (kustoDefaults && kustoDefaults.languageSettings && kustoDefaults.languageSettings.openSuggestionDialogAfterPreviousSuggestionAccepted) {
416
- var didAcceptSuggestion = event.source === 'snippet' && event.reason === monaco.editor.CursorChangeReason.NotSet;
417
- // If the word at the current position is not null - meaning we did not add a space after completion.
418
- // In this case we don't want to activate the eager mode, since it will display the current selected word..
419
- if (!didAcceptSuggestion || editor.getModel().getWordAtPosition(event.selection.getPosition()) !== null) {
420
- return;
421
- }
422
- event.selection;
423
- // OK so now we in a situation where we know a suggestion was selected and we want to trigger another one.
424
- // the only problem is that the suggestion widget itself listens to this same event in order to know it needs to close.
425
- // The only problem is that we're ahead in line, so we're triggering a suggest operation that will be shut down once
426
- // the next callback is called. This is why we're waiting here - to let all the callbacks run synchronously and be
427
- // the 'last' subscriber to run. Granted this is hacky, but until monaco provides a specific event for suggestions,
428
- // this is the best we have.
429
- setTimeout(() => editor.trigger('monaco-kusto', 'editor.action.triggerSuggest', {}), 10);
430
- }
431
- });
432
- }
433
422
  }
434
423
  function isStandaloneCodeEditor(editor) {
435
424
  return editor.addAction !== undefined;
436
425
  }
426
+ monaco$1.languages.kusto = {
427
+ kustoDefaults,
428
+ getKustoWorker
429
+ };
437
430
 
438
- // --- Registration to monaco editor ---
439
- if (monaco.editor) {
440
- setupMonacoKusto(monaco);
441
- }
442
-
443
- export { LanguageServiceDefaultsImpl, setupMonacoKusto };
431
+ export { LanguageServiceDefaultsImpl, getKustoWorker, kustoDefaults };
@@ -1,8 +1,8 @@
1
1
  /// <reference types="../monaco" />
2
2
  /// <reference types="monaco-editor/monaco" />
3
+ import type { Uri } from 'monaco-editor/esm/vs/editor/editor.api';
3
4
  import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
4
5
  import type { KustoWorker } from './kustoWorker';
5
- type Uri = monaco.Uri;
6
6
  export declare class WorkerManager {
7
7
  private _monacoInstance;
8
8
  private _storedState;
@@ -20,4 +20,3 @@ export declare class WorkerManager {
20
20
  private _getClient;
21
21
  getLanguageServiceWorker(...resources: Uri[]): Promise<KustoWorker>;
22
22
  }
23
- export {};