@kusto/monaco-kusto 5.6.6 → 6.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.
Files changed (65) hide show
  1. package/package.json +26 -16
  2. package/release/dev/commandFormatter.d.ts +6 -0
  3. package/release/dev/commandHighlighter.d.ts +20 -0
  4. package/release/dev/extendedEditor.d.ts +7 -0
  5. package/release/dev/kustoMode.d.ts +8 -0
  6. package/release/dev/kustoMode.js +1730 -3278
  7. package/release/dev/kustoWorker.d.ts +92 -0
  8. package/release/dev/kustoWorker.js +5687 -8534
  9. package/release/dev/languageFeatures.d.ts +91 -0
  10. package/release/dev/languageService/kustoLanguageService.d.ts +143 -0
  11. package/release/dev/languageService/kustoMonarchLanguageDefinition.d.ts +1 -0
  12. package/release/dev/languageService/renderInfo.d.ts +31 -0
  13. package/release/dev/languageService/schema.d.ts +144 -0
  14. package/release/dev/languageService/settings.d.ts +30 -0
  15. package/release/dev/main-ac12725e.js +1958 -0
  16. package/release/dev/monaco.contribution.d.ts +15 -0
  17. package/release/dev/monaco.contribution.js +462 -309
  18. package/release/dev/workerManager.d.ts +23 -0
  19. package/release/esm/commandFormatter.d.ts +6 -0
  20. package/release/esm/commandHighlighter.d.ts +20 -0
  21. package/release/esm/extendedEditor.d.ts +7 -0
  22. package/release/esm/kusto.worker.js +2246 -5
  23. package/release/esm/kustoMode.d.ts +8 -0
  24. package/release/esm/kustoMode.js +1120 -88
  25. package/release/esm/kustoWorker.d.ts +92 -0
  26. package/release/esm/languageFeatures.d.ts +91 -0
  27. package/release/esm/languageService/kustoLanguageService.d.ts +143 -0
  28. package/release/esm/languageService/kustoMonarchLanguageDefinition.d.ts +1 -0
  29. package/release/esm/languageService/renderInfo.d.ts +31 -0
  30. package/release/esm/languageService/schema.d.ts +144 -0
  31. package/release/esm/languageService/settings.d.ts +30 -0
  32. package/release/esm/monaco.contribution.d.ts +1 -0
  33. package/release/esm/monaco.contribution.js +424 -181
  34. package/release/esm/workerManager.d.ts +23 -0
  35. package/release/min/commandFormatter.d.ts +6 -0
  36. package/release/min/commandHighlighter.d.ts +20 -0
  37. package/release/min/extendedEditor.d.ts +7 -0
  38. package/release/min/kustoMode.d.ts +8 -0
  39. package/release/min/kustoMode.js +2 -11
  40. package/release/min/kustoWorker.d.ts +92 -0
  41. package/release/min/kustoWorker.js +10 -53
  42. package/release/min/languageFeatures.d.ts +91 -0
  43. package/release/min/languageService/kustoLanguageService.d.ts +143 -0
  44. package/release/min/languageService/kustoMonarchLanguageDefinition.d.ts +1 -0
  45. package/release/min/languageService/renderInfo.d.ts +31 -0
  46. package/release/min/languageService/schema.d.ts +144 -0
  47. package/release/min/languageService/settings.d.ts +30 -0
  48. package/release/min/main-5b1cc297.js +7 -0
  49. package/release/min/monaco.contribution.d.ts +1 -0
  50. package/release/min/monaco.contribution.js +2 -2
  51. package/release/min/monaco.d.ts +1 -319
  52. package/release/min/workerManager.d.ts +23 -0
  53. package/release/{esm/monaco.d.ts → monaco.d.ts} +1 -1
  54. package/release/esm/_deps/lodash/lodash.js +0 -17209
  55. package/release/esm/_deps/vscode-languageserver-types/main.js +0 -1908
  56. package/release/esm/_deps/xregexp/xregexp-all.js +0 -4652
  57. package/release/esm/commandFormatter.js +0 -36
  58. package/release/esm/commandHighlighter.js +0 -51
  59. package/release/esm/extendedEditor.js +0 -38
  60. package/release/esm/kustoWorker.js +0 -245
  61. package/release/esm/languageFeatures.js +0 -1032
  62. package/release/esm/languageService/kustoLanguageService.js +0 -1912
  63. package/release/esm/languageService/kustoMonarchLanguageDefinition.js +0 -127
  64. package/release/esm/languageService/schema.js +0 -64
  65. package/release/esm/workerManager.js +0 -102
@@ -1,319 +1 @@
1
- // This file gets bundled as is with monaco-kusto.
2
- // Everything that needs to be exposed to consumers should be typed here.
3
- // This means that all declarations here are duplicated from the actual definitions around the code.
4
- // TODO: think about turning this around - have all other code dependent on this file thus not needing the duplication.
5
- // this was done like this because that's the standard way all other monaco extensions work for some reason.
6
-
7
- declare module monaco.editor {
8
- export interface ICodeEditor {
9
- getCurrentCommandRange(cursorPosition: monaco.Position): monaco.Range;
10
- }
11
- }
12
-
13
- declare module monaco.languages.kusto {
14
- export interface LanguageSettings {
15
- includeControlCommands?: boolean;
16
- newlineAfterPipe?: boolean;
17
- syntaxErrorAsMarkDown?: SyntaxErrorAsMarkDownOptions;
18
- openSuggestionDialogAfterPreviousSuggestionAccepted?: boolean;
19
- useIntellisenseV2?: boolean;
20
- useSemanticColorization?: boolean;
21
- useTokenColorization?: boolean;
22
- disabledCompletionItems?: string[];
23
- onDidProvideCompletionItems?: monaco.languages.kusto.OnDidProvideCompletionItems;
24
- enableHover?: boolean;
25
- formatter?: FormatterOptions;
26
- enableQueryWarnings?: boolean;
27
- enableQuerySuggestions?: boolean;
28
- disabledDiagnosticCodes?: string[];
29
- quickFixCodeActions?: QuickFixCodeActionOptions[];
30
- enableQuickFixes?: boolean;
31
- }
32
-
33
- export interface SyntaxErrorAsMarkDownOptions {
34
- header?: string;
35
- icon?: string;
36
- enableSyntaxErrorAsMarkDown?: boolean;
37
- }
38
-
39
- export type QuickFixCodeActionOptions = 'Extract Expression' | 'Extract Function' | 'Change to';
40
-
41
- export interface FormatterOptions {
42
- indentationSize?: number;
43
- pipeOperatorStyle?: FormatterPlacementStyle;
44
- }
45
-
46
- export type FormatterPlacementStyle = 'None' | 'NewLine' | 'Smart';
47
-
48
- export interface LanguageServiceDefaults {
49
- readonly onDidChange: IEvent<LanguageServiceDefaults>;
50
- readonly languageSettings: LanguageSettings;
51
- /**
52
- * Configure language service settings.
53
- */
54
- setLanguageSettings(options: LanguageSettings): void;
55
-
56
- /**
57
- * Configure when the worker shuts down. By default that is 2mins.
58
- *
59
- * @param value The maximum idle time in milliseconds. Values less than one
60
- * mean never shut down.
61
- */
62
- setMaximumWorkerIdleTime(value: number): void;
63
- }
64
-
65
- export var kustoDefaults: LanguageServiceDefaults;
66
-
67
- export interface KustoWorker {
68
- /**
69
- * Sets an array of ambient parameters to be known by the language service.
70
- * Language service assumes that these parameters will be provided externally when query gets executed and does
71
- * not error-out when they are being referenced in the query.
72
- * @param parameters the array of parameters
73
- */
74
- setParameter(parameters: ScalarParameter[]);
75
- setSchema(schema: Schema): Promise<void>;
76
- setSchemaFromShowSchema(
77
- schema: any,
78
- clusterConnectionString: string,
79
- databaseInContextName: string,
80
- globalScalarParameters: ScalarParameter[],
81
- globalTabularParameters: TabularParameter[]
82
- ): Promise<void>;
83
- normalizeSchema(
84
- schema: any,
85
- clusterConnectionString: string,
86
- databaseInContextName: string
87
- ): Promise<EngineSchema>;
88
- getCommandInContext(uri: string, cursorOffset: number): Promise<string | null>;
89
- getCommandAndLocationInContext(
90
- uri: string,
91
- offset: number
92
- ): Promise<{ text: string; range: monaco.Range } | null>;
93
- getCommandsInDocument(uri: string): Promise<{ absoluteStart: number; absoluteEnd: number; text: string }[]>;
94
- getClientDirective(
95
- text: string
96
- ): Promise<{ isClientDirective: boolean; directiveWithoutLeadingComments: string }>;
97
- getAdminCommand(text: string): Promise<{ isAdminCommand: boolean; adminCommandWithoutLeadingComments: string }>;
98
-
99
- /**
100
- * Get all declared query parameters declared in current block if any.
101
- */
102
- getQueryParams(uri: string, cursorOffset: number): Promise<{ name: string; type: string }[]>;
103
-
104
- /**
105
- * Get all the ambient parameters defined in global scope.
106
- * Ambient parameters are parameters that are not defined in the syntax such as in a query parameter declaration.
107
- * These are parameters that are injected from outside, usually by a UX application that would like to offer
108
- * the user intellisense for a symbol, without forcing them to write a query declaration statement.
109
- * Usually the same application injects the query declaration statement and the parameter values when
110
- * executing the query (so it will execute correctly)
111
- */
112
- getGlobalParams(uri: string): Promise<{ name: string; type: string }[]>;
113
- /**
114
- * Get the global parameters that are actually being referenced in query.
115
- * This is different from getQueryParams that will return the parameters declare using a query declaration
116
- * statement.
117
- * It is also different from getGlobalParams that will return all global parameters whether used or not.
118
- */
119
- getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<{ name: string; type: string }[]>;
120
-
121
- getReferencedSymbols(
122
- document: TextDocument,
123
- cursorOffset?: number
124
- ): Promise<{ name: string; kind: string; display: string }[]>;
125
- /**
126
- * Get visualization options in render command if present (null otherwise).
127
- */
128
- getRenderInfo(uri: string, cursorOffset: number): Promise<RenderInfo | null>;
129
- doDocumentFormat(uri: string): Promise<ls.TextEdit[]>;
130
- doRangeFormat(uri: string, range: ls.Range): Promise<ls.TextEdit[]>;
131
- doCurrentCommandFormat(uri: string, caretPosition: ls.Position): Promise<ls.TextEdit[]>;
132
- doValidation(
133
- uri: string,
134
- intervals: { start: number; end: number }[],
135
- includeWarnings?: boolean,
136
- includeSuggestions?: boolean
137
- ): Promise<ls.Diagnostic[]>;
138
- setParameters(
139
- scalarParameters: readonly ScalarParameter[],
140
- tabularParameters: readonly TabularParameter[]
141
- ): void;
142
- /**
143
- * Get all the database references from the current command.
144
- * If database's schema is already cached in previous calls to setSchema or addDatabaseToSchema it will not be returned.
145
- * This method should be used to get all the cross-databases in a command, then schema for the database should be fetched and added with addDatabaseToSchema.
146
- * @example
147
- * If the current command includes: cluster('help').database('Samples')
148
- * getDatabaseReferences will return [{ clusterName: 'help', databaseName 'Samples' }]
149
- */
150
- getDatabaseReferences(uri: string, cursorOffset: number): Promise<DatabaseReference[]>;
151
- /**
152
- * Get all the cluster references from the current command.
153
- * If cluster's schema is already cached it will not be returned.
154
- * This method should be used to get all the cross-clusters in a command, then schema for the cluster should be fetched and added with addClusterToSchema.
155
- * cluster name is returned exactly as written in the KQL `cluster(<cluster name>)` function.
156
- * @example
157
- * If the current command includes: cluster('help')
158
- * it returns [{ clusterName: 'help' }]
159
- * @example
160
- * If the current command includes: cluster('https://demo11.westus.kusto.windows.net')
161
- * getClusterReferences will return [{ clusterName: 'https://demo11.westus.kusto.windows.net' }]
162
- */
163
- getClusterReferences(uri: string, cursorOffset: number): Promise<ClusterReference[]>;
164
- /**
165
- * Adds a database's scheme. Useful with getDatabaseReferences to load schema for cross-cluster commands.
166
- * @param clusterName the name of the cluster as returned from getDatabaseReferences/getClusterReferences.
167
- * @example
168
- * - User enters cluster('help').database('Samples')
169
- * - hosting app calls getDatabaseReferences which returns [{ clusterName: 'help', databaseName: 'Samples' }].
170
- * - hosting app fetches the database Schema from https://help.kusto.windows.net
171
- * - hosting app calls 'addDatabaseToSchema' with the database's schema.
172
- * - now, when user types cluster('help').database('Samples') then the auto complete list will show all the tables.
173
- */
174
- addDatabaseToSchema(uri: string, clusterName: string, databaseSchema: Database): Promise<void>;
175
- /**
176
- * Adds a cluster's databases to the schema. Useful when used with getClusterReferences in cross-cluster commands.
177
- * @param clusterName the name of the cluster as returned in getClusterReferences.
178
- * @example
179
- * - User enters cluster('help')
180
- * - hosting app calls getClusterReferences which returns [{ clusterName: 'help' }].
181
- * - hosting app fetches the list of databases from https://help.kusto.windows.net
182
- * - hosting app calls addClusterToSchema with the list of databases.
183
- * - now, when user type `cluster('help').database(` then the auto complete list will show all the databases.
184
- */
185
- addClusterToSchema(uri: string, clusterName: string, databasesNames: readonly string[]): Promise<void>;
186
- }
187
-
188
- /**
189
- * A function that get a model Uri and returns a kusto worker that knows how to work
190
- * with that document.
191
- */
192
- export interface WorkerAccessor {
193
- (first: Uri, ...more: Uri[]): Promise<KustoWorker>;
194
- }
195
-
196
- export interface Column {
197
- name: string;
198
- type: string;
199
- docstring?: string;
200
- }
201
- export interface Table {
202
- name: string;
203
- columns: Column[];
204
- docstring?: string;
205
- }
206
- export interface ScalarParameter {
207
- name: string;
208
- type?: string;
209
- cslType?: string;
210
- cslDefaultValue?: string;
211
- }
212
-
213
- export interface TabularParameter {
214
- name: string;
215
- columns: Column[];
216
- docstring?: string;
217
- }
218
-
219
- // 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
220
- // it will have a name, and a list of scalar types which are the column types.
221
- export type InputParameter = ScalarParameter & { columns?: ScalarParameter[] };
222
-
223
- export interface Function {
224
- name: string;
225
- body: string;
226
- docstring?: string;
227
- inputParameters: InputParameter[];
228
- }
229
- export interface Database {
230
- name: string;
231
- tables: Table[];
232
- functions: Function[];
233
- majorVersion: number;
234
- minorVersion: number;
235
- }
236
-
237
- export interface EngineSchema {
238
- clusterType: 'Engine';
239
- cluster: {
240
- connectionString: string;
241
- databases: Database[];
242
- };
243
- database: Database | undefined; // a reference to the database that's in current context.
244
- }
245
-
246
- export interface ClusterMangerSchema {
247
- clusterType: 'ClusterManager';
248
- accounts: string[];
249
- services: string[];
250
- connectionString: string;
251
- }
252
-
253
- export interface DataManagementSchema {
254
- clusterType: 'DataManagement';
255
- }
256
-
257
- export type Schema = EngineSchema | ClusterMangerSchema | DataManagementSchema;
258
-
259
- export var getKustoWorker: () => Promise<WorkerAccessor>;
260
-
261
- export declare type VisualizationType =
262
- | 'anomalychart'
263
- | 'areachart'
264
- | 'barchart'
265
- | 'columnchart'
266
- | 'ladderchart'
267
- | 'linechart'
268
- | 'piechart'
269
- | 'pivotchart'
270
- | 'scatterchart'
271
- | 'stackedareachart'
272
- | 'timechart'
273
- | 'table'
274
- | 'timeline'
275
- | 'timepivot'
276
- | 'card';
277
-
278
- export declare type Scale = 'linear' | 'log';
279
- export declare type LegendVisibility = 'visible' | 'hidden';
280
- export declare type YSplit = 'none' | 'axes' | 'panels';
281
- export declare type Kind = 'default' | 'unstacked' | 'stacked' | 'stacked100' | 'map';
282
-
283
- export interface RenderOptions {
284
- visualization?: null | VisualizationType;
285
- title?: null | string;
286
- xcolumn?: null | string;
287
- series?: null | string[];
288
- ycolumns?: null | string[];
289
- xtitle?: null | string;
290
- ytitle?: null | string;
291
- xaxis?: null | Scale;
292
- yaxis?: null | Scale;
293
- legend?: null | LegendVisibility;
294
- ySplit?: null | YSplit;
295
- accumulate?: null | boolean;
296
- kind?: null | Kind;
297
- anomalycolumns?: null | string[];
298
- ymin?: null | number;
299
- ymax?: null | number;
300
- }
301
-
302
- export interface RenderInfo {
303
- options: RenderOptions;
304
- location: { startOffset: number; endOffset: number };
305
- }
306
-
307
- export interface DatabaseReference {
308
- databaseName: string;
309
- clusterName: string;
310
- }
311
-
312
- export interface ClusterReference {
313
- clusterName: string;
314
- }
315
-
316
- export type RenderOptionKeys = keyof RenderOptions;
317
-
318
- export type OnDidProvideCompletionItems = (list: ls.CompletionList) => Promise<ls.CompletionList>;
319
- }
1
+ /// <reference types="../monaco" />
@@ -0,0 +1,23 @@
1
+ /// <reference types="../monaco" />
2
+ /// <reference types="monaco-editor-core/monaco" />
3
+ import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
4
+ import type { KustoWorker } from './kustoWorker';
5
+ type Uri = monaco.Uri;
6
+ export declare class WorkerManager {
7
+ private _monacoInstance;
8
+ private _storedState;
9
+ private _defaults;
10
+ private _idleCheckInterval;
11
+ private _lastUsedTime;
12
+ private _configChangeListener;
13
+ private _worker;
14
+ private _client;
15
+ constructor(_monacoInstance: typeof monaco, defaults: LanguageServiceDefaultsImpl);
16
+ private _stopWorker;
17
+ private _saveStateAndStopWorker;
18
+ dispose(): void;
19
+ private _checkIfIdle;
20
+ private _getClient;
21
+ getLanguageServiceWorker(...resources: Uri[]): Promise<KustoWorker>;
22
+ }
23
+ export {};
@@ -36,7 +36,7 @@ declare module monaco.languages.kusto {
36
36
  enableSyntaxErrorAsMarkDown?: boolean;
37
37
  }
38
38
 
39
- export type QuickFixCodeActionOptions = 'Extract Expression' | 'Extract Function' | 'Change to';
39
+ export type QuickFixCodeActionOptions = 'Extract Expression' | 'Extract Function' | 'Change to' | 'FixAll';
40
40
 
41
41
  export interface FormatterOptions {
42
42
  indentationSize?: number;