@kusto/monaco-kusto 7.0.0 → 7.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.
@@ -0,0 +1,109 @@
1
+ /*!-----------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * monaco-kusto version: 7.2.0(ff25adc61b13954e5ec288fcdc16c92483943ef5)
4
+ * Released under the MIT license
5
+ * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
+ *-----------------------------------------------------------------------------*/
7
+
8
+ define('vs/language/kusto/schema-9cf94ce1', ['exports'], (function (exports) { 'use strict';
9
+
10
+ // Definition of schema object in the context of language services. This model is exposed to consumers of this library.
11
+
12
+ /**
13
+ * An input parameter either be a scalar in which case it has a name, type and
14
+ * cslType, or it can be columnar, in which case it will have a name, and a list
15
+ * of scalar types which are the column types.
16
+ */
17
+
18
+ /**
19
+ * Schema types:
20
+ * Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
21
+ * Cluster Manager – Internal only. A schema for clusters that manages other clusters.
22
+ * Data Management – Internal only. A schema for ingestion point operations.
23
+ */
24
+
25
+ var dotnetTypeToKustoType = {
26
+ 'System.SByte': 'bool',
27
+ 'System.Byte': 'uint8',
28
+ 'System.Int16': 'int16',
29
+ 'System.UInt16': 'uint16',
30
+ 'System.Int32': 'int',
31
+ 'System.UInt32': 'uint',
32
+ 'System.Int64': 'long',
33
+ 'System.UInt64': 'ulong',
34
+ 'System.String': 'string',
35
+ 'System.Single': 'float',
36
+ 'System.Double': 'real',
37
+ 'System.DateTime': 'datetime',
38
+ 'System.TimeSpan': 'timespan',
39
+ 'System.Guid': 'guid',
40
+ 'System.Boolean': 'bool',
41
+ 'Newtonsoft.Json.Linq.JArray': 'dynamic',
42
+ 'Newtonsoft.Json.Linq.JObject': 'dynamic',
43
+ 'Newtonsoft.Json.Linq.JToken': 'dynamic',
44
+ 'System.Object': 'dynamic',
45
+ 'System.Data.SqlTypes.SqlDecimal': 'decimal'
46
+ };
47
+ var getCslTypeNameFromClrType = function getCslTypeNameFromClrType(clrType) {
48
+ return dotnetTypeToKustoType[clrType] || clrType;
49
+ };
50
+ var kustoTypeToEntityDataType = {
51
+ object: 'Object',
52
+ bool: 'Boolean',
53
+ uint8: 'Byte',
54
+ int16: 'Int16',
55
+ uint16: 'UInt16',
56
+ int: 'Int32',
57
+ uint: 'UInt32',
58
+ long: 'Int64',
59
+ ulong: 'UInt64',
60
+ float: 'Single',
61
+ real: 'Double',
62
+ decimal: 'Decimal',
63
+ datetime: 'DateTime',
64
+ string: 'String',
65
+ dynamic: 'Dynamic',
66
+ timespan: 'TimeSpan'
67
+ };
68
+ var getEntityDataTypeFromCslType = function getEntityDataTypeFromCslType(cslType) {
69
+ return kustoTypeToEntityDataType[cslType] || cslType;
70
+ };
71
+ var getCallName = function getCallName(fn) {
72
+ return "".concat(fn.name, "(").concat(fn.inputParameters.map(function (p) {
73
+ return "{".concat(p.name, "}");
74
+ }).join(','), ")");
75
+ };
76
+ var getExpression = function getExpression(fn) {
77
+ return "let ".concat(fn.name, " = ").concat(getInputParametersAsCslString(fn.inputParameters), " ").concat(fn.body);
78
+ };
79
+ var getInputParametersAsCslString = function getInputParametersAsCslString(inputParameters) {
80
+ return "(".concat(inputParameters.map(function (inputParameter) {
81
+ return getInputParameterAsCslString(inputParameter);
82
+ }).join(','), ")");
83
+ };
84
+ var getInputParameterAsCslString = function getInputParameterAsCslString(inputParameter) {
85
+ // If this is a tabular parameter
86
+ if (inputParameter.columns && inputParameter.columns.length > 0) {
87
+ var attributesAsString = inputParameter.columns.map(function (col) {
88
+ return "".concat(col.name, ":").concat(col.cslType || getCslTypeNameFromClrType(col.type));
89
+ }).join(',');
90
+ return "".concat(inputParameter.name, ":").concat(attributesAsString === '' ? '*' : attributesAsString);
91
+ } else {
92
+ return "".concat(inputParameter.name, ":").concat(inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type));
93
+ }
94
+ };
95
+
96
+ /**
97
+ * This is the schema of the output of kusto command
98
+ * .show schema as json
99
+ */
100
+ exports.showSchema = void 0;
101
+ (function (_showSchema) {})(exports.showSchema || (exports.showSchema = {}));
102
+
103
+ exports.getCallName = getCallName;
104
+ exports.getCslTypeNameFromClrType = getCslTypeNameFromClrType;
105
+ exports.getEntityDataTypeFromCslType = getEntityDataTypeFromCslType;
106
+ exports.getExpression = getExpression;
107
+ exports.getInputParametersAsCslString = getInputParametersAsCslString;
108
+
109
+ }));
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
3
+ * monaco-kusto version: 7.2.0(ff25adc61b13954e5ec288fcdc16c92483943ef5)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
@@ -8,76 +8,12 @@
8
8
  import * as worker from 'monaco-editor/esm/vs/editor/editor.worker';
9
9
  import * as ls from 'vscode-languageserver-types';
10
10
  import XRegExp from 'xregexp';
11
+ import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-53127847.js';
11
12
  import '@kusto/language-service/bridge.min';
12
13
  import '@kusto/language-service/Kusto.JavaScript.Client.min';
13
14
  import '@kusto/language-service/newtonsoft.json.min';
14
15
  import '@kusto/language-service-next/Kusto.Language.Bridge.min';
15
16
 
16
- // Definition of schema object in the context of language services. This model is exposed to consumers of this library.
17
-
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
- // it will have a name, and a list of scalar types which are the column types.
20
- /**
21
- * Schema types:
22
- * Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
23
- * Cluster Manager – Internal only. A schema for clusters that manages other clusters.
24
- * Data Management – Internal only. A schema for ingestion point operations.
25
- */
26
- const dotnetTypeToKustoType = {
27
- 'System.SByte': 'bool',
28
- 'System.Byte': 'uint8',
29
- 'System.Int16': 'int16',
30
- 'System.UInt16': 'uint16',
31
- 'System.Int32': 'int',
32
- 'System.UInt32': 'uint',
33
- 'System.Int64': 'long',
34
- 'System.UInt64': 'ulong',
35
- 'System.String': 'string',
36
- 'System.Single': 'float',
37
- 'System.Double': 'real',
38
- 'System.DateTime': 'datetime',
39
- 'System.TimeSpan': 'timespan',
40
- 'System.Guid': 'guid',
41
- 'System.Boolean': 'bool',
42
- 'Newtonsoft.Json.Linq.JArray': 'dynamic',
43
- 'Newtonsoft.Json.Linq.JObject': 'dynamic',
44
- 'Newtonsoft.Json.Linq.JToken': 'dynamic',
45
- 'System.Object': 'dynamic',
46
- 'System.Data.SqlTypes.SqlDecimal': 'decimal'
47
- };
48
- const getCslTypeNameFromClrType = clrType => dotnetTypeToKustoType[clrType] || clrType;
49
- const kustoTypeToEntityDataType = {
50
- object: 'Object',
51
- bool: 'Boolean',
52
- uint8: 'Byte',
53
- int16: 'Int16',
54
- uint16: 'UInt16',
55
- int: 'Int32',
56
- uint: 'UInt32',
57
- long: 'Int64',
58
- ulong: 'UInt64',
59
- float: 'Single',
60
- real: 'Double',
61
- decimal: 'Decimal',
62
- datetime: 'DateTime',
63
- string: 'String',
64
- dynamic: 'Dynamic',
65
- timespan: 'TimeSpan'
66
- };
67
- const getEntityDataTypeFromCslType = cslType => kustoTypeToEntityDataType[cslType] || cslType;
68
- const getCallName = fn => `${fn.name}(${fn.inputParameters.map(p => `{${p.name}}`).join(',')})`;
69
- const getExpression = fn => `let ${fn.name} = ${getInputParametersAsCslString(fn.inputParameters)} ${fn.body}`;
70
- const getInputParametersAsCslString = inputParameters => `(${inputParameters.map(inputParameter => getInputParameterAsCslString(inputParameter)).join(',')})`;
71
- const getInputParameterAsCslString = inputParameter => {
72
- // If this is a tabular parameter
73
- if (inputParameter.columns && inputParameter.columns.length > 0) {
74
- const attributesAsString = inputParameter.columns.map(col => `${col.name}:${col.cslType || getCslTypeNameFromClrType(col.type)}`).join(',');
75
- return `${inputParameter.name}:${attributesAsString === '' ? '*' : attributesAsString}`;
76
- } else {
77
- return `${inputParameter.name}:${inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type)}`;
78
- }
79
- };
80
-
81
17
  var k = Kusto.Data.IntelliSense;
82
18
  var parsing = Kusto.Language.Parsing;
83
19
  var k2 = Kusto.Language.Editor;
@@ -604,7 +540,7 @@ class KustoLanguageService {
604
540
  const warningAndSuggestionDiagnostics = block.Service.GetAnalyzerDiagnostics(true);
605
541
  const filterredDiagnostics = this.toArray(warningAndSuggestionDiagnostics).filter(d => {
606
542
  const allowSeverity = enableWarnings && d.Severity === 'Warning' || enableSuggestions && d.Severity === 'Suggestion';
607
- const allowCode = !this._languageSettings.disabledDiagnoticCodes?.includes(d.Code);
543
+ const allowCode = !this._languageSettings.disabledDiagnosticCodes?.includes(d.Code);
608
544
  return allowSeverity && allowCode;
609
545
  });
610
546
  diagnostics = diagnostics.concat(filterredDiagnostics);
@@ -1975,7 +1911,13 @@ function getKustoLanguageService() {
1975
1911
  return languageService;
1976
1912
  }
1977
1913
 
1978
- class KustoWorker {
1914
+ /**
1915
+ * We're using this interface to send messages to a worker, so using
1916
+ * `InterfaceFor` to make it not nominal is more accurate. {@link KustoWorker}
1917
+ * is the public, more limited version of this interface.
1918
+ */
1919
+
1920
+ class KustoWorkerImpl {
1979
1921
  // --- model sync -----------------------
1980
1922
 
1981
1923
  constructor(ctx, createData) {
@@ -2235,6 +2177,6 @@ class KustoWorker {
2235
2177
  self.onmessage = () => {
2236
2178
  // ignore the first message
2237
2179
  worker.initialize((ctx, createData) => {
2238
- return new KustoWorker(ctx, createData);
2180
+ return new KustoWorkerImpl(ctx, createData);
2239
2181
  });
2240
2182
  };
@@ -1,8 +1,14 @@
1
- import type { LanguageServiceDefaults } from './monaco.contribution';
2
- import * as languageFeatures from './languageFeatures';
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
2
+ import type { KustoWorker, LanguageServiceDefaults } from './monaco.contribution';
3
+ import type { IKustoWorkerImpl } from './kustoWorker';
4
+ export interface AugmentedWorker extends KustoWorker, Omit<IKustoWorkerImpl, 'setSchemaFromShowSchema'> {
5
+ }
6
+ export interface AugmentedWorkerAccessor {
7
+ (first: monaco.Uri, ...more: monaco.Uri[]): Promise<AugmentedWorker>;
8
+ }
3
9
  /**
4
10
  * Called when Kusto language is first needed (a model has the language set)
5
11
  * @param defaults
6
12
  */
7
- export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): languageFeatures.WorkerAccessor;
8
- export declare function getKustoWorker(): Promise<languageFeatures.WorkerAccessor>;
13
+ export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): AugmentedWorkerAccessor;
14
+ export declare function getKustoWorker(): Promise<AugmentedWorkerAccessor>;
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
3
+ * monaco-kusto version: 7.2.0(ff25adc61b13954e5ec288fcdc16c92483943ef5)
4
4
  * Released under the MIT license
5
5
  * https://https://github.com/Azure/monaco-kusto/blob/master/README.md
6
6
  *-----------------------------------------------------------------------------*/
@@ -1085,9 +1085,9 @@ function setupMode(defaults, monacoInstance) {
1085
1085
  const client = new WorkerManager(monacoInstance, defaults);
1086
1086
  disposables.push(client);
1087
1087
  const workerAccessor = (first, ...more) => {
1088
- const augmentedSetSchema = (schema, worker, globalScalarParameters, globalTabularParameters) => {
1088
+ const augmentedSetSchema = async (schema, worker) => {
1089
1089
  const workerPromise = worker.setSchema(schema);
1090
- workerPromise.then(() => {
1090
+ await workerPromise.then(() => {
1091
1091
  onSchemaChange.fire(schema);
1092
1092
  });
1093
1093
  };
@@ -1095,12 +1095,17 @@ function setupMode(defaults, monacoInstance) {
1095
1095
  return worker.then(worker => ({
1096
1096
  ...worker,
1097
1097
  setSchema: schema => augmentedSetSchema(schema, worker),
1098
- setSchemaFromShowSchema: (schema, connection, database, globalScalarParameters, globalTabularParameters) => {
1099
- worker.normalizeSchema(schema, connection, database).then(schema => globalScalarParameters ? {
1100
- ...schema,
1101
- globalScalarParameters,
1102
- globalTabularParameters
1103
- } : schema).then(normalized => augmentedSetSchema(normalized, worker));
1098
+ async setSchemaFromShowSchema(schema, connection, database, globalScalarParameters, globalTabularParameters) {
1099
+ await worker.normalizeSchema(schema, connection, database).then(schema => {
1100
+ if (globalScalarParameters || globalTabularParameters) {
1101
+ schema = {
1102
+ ...schema,
1103
+ globalScalarParameters,
1104
+ globalTabularParameters
1105
+ };
1106
+ }
1107
+ augmentedSetSchema(schema, worker);
1108
+ });
1104
1109
  }
1105
1110
  }));
1106
1111
  };
@@ -1,18 +1,29 @@
1
1
  import * as ls from 'vscode-languageserver-types';
2
- import type * as monaco from 'monaco-editor/esm/vs/editor/editor.worker';
2
+ import type { worker } from 'monaco-editor/esm/vs/editor/editor.worker';
3
+ import type { IRange } from 'monaco-editor/esm/vs/editor/editor.api';
3
4
  import * as kustoService from './languageService/kustoLanguageService';
4
5
  import type { LanguageSettings } from './languageService/settings';
5
6
  import { Schema, showSchema, ScalarParameter, Database, TabularParameter } from './languageService/schema';
6
7
  import type { ColorizationRange } from './languageService/kustoLanguageService';
7
8
  import type { RenderInfo } from './languageService/renderInfo';
8
- export declare class KustoWorker {
9
+ import type { ClusterReference, DatabaseReference } from './types';
10
+ export type InterfaceFor<C> = {
11
+ [Member in keyof C]: C[Member];
12
+ };
13
+ /**
14
+ * We're using this interface to send messages to a worker, so using
15
+ * `InterfaceFor` to make it not nominal is more accurate. {@link KustoWorker}
16
+ * is the public, more limited version of this interface.
17
+ */
18
+ export type IKustoWorkerImpl = InterfaceFor<KustoWorkerImpl>;
19
+ export declare class KustoWorkerImpl {
9
20
  private _ctx;
10
21
  private _languageService;
11
22
  private _languageId;
12
23
  private _languageSettings;
13
- constructor(ctx: monaco.worker.IWorkerContext, createData: ICreateData);
24
+ constructor(ctx: worker.IWorkerContext, createData: ICreateData);
14
25
  setSchema(schema: Schema): Promise<void>;
15
- addClusterToSchema(uri: string, clusterName: string, databasesNames: string[]): Promise<void>;
26
+ addClusterToSchema(uri: string, clusterName: string, databasesNames: readonly string[]): Promise<void>;
16
27
  addDatabaseToSchema(uri: string, clusterName: string, databaseSchema: Database): Promise<void>;
17
28
  setSchemaFromShowSchema(schema: any, clusterConnectionString: string, databaseInContextName: string): Promise<void>;
18
29
  normalizeSchema(schema: showSchema.Result, clusterConnectionString: string, databaseInContextName: string): Promise<import("./languageService/schema").EngineSchema>;
@@ -44,7 +55,7 @@ export declare class KustoWorker {
44
55
  */
45
56
  getCommandAndLocationInContext(uri: string, cursorOffset: number): Promise<{
46
57
  text: string;
47
- range: monaco.IRange;
58
+ range: IRange;
48
59
  } | null>;
49
60
  getCommandsInDocument(uri: string): Promise<{
50
61
  absoluteStart: number;
@@ -78,12 +89,15 @@ export declare class KustoWorker {
78
89
  doRename(uri: string, position: ls.Position, newName: string): Promise<ls.WorkspaceEdit>;
79
90
  doHover(uri: string, position: ls.Position): Promise<ls.Hover>;
80
91
  setParameters(scalarParameters: readonly ScalarParameter[], tabularParameters: readonly TabularParameter[]): Promise<void>;
81
- getClusterReferences(uri: string, cursorOffset: number): Promise<kustoService.ClusterReference[]>;
82
- getDatabaseReferences(uri: string, cursorOffset: number): Promise<kustoService.DatabaseReference[]>;
92
+ getClusterReferences(uri: string, cursorOffset: number): Promise<ClusterReference[]>;
93
+ getDatabaseReferences(uri: string, cursorOffset: number): Promise<DatabaseReference[]>;
83
94
  private _getTextDocument;
84
95
  }
85
96
  export interface ICreateData {
86
97
  languageId: string;
87
98
  languageSettings: LanguageSettings;
88
99
  }
89
- export declare function create(ctx: monaco.worker.IWorkerContext, createData: ICreateData): KustoWorker;
100
+ /**
101
+ * Used when monaco-editor is resolved via amd modules
102
+ */
103
+ export declare function create(ctx: worker.IWorkerContext, createData: ICreateData): IKustoWorkerImpl;
@@ -1,10 +1,7 @@
1
1
  import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
2
2
  import type { LanguageServiceDefaults, LanguageSettings } from './monaco.contribution';
3
- import type { KustoWorker } from './kustoWorker';
4
3
  import type { Schema } from './languageService/schema';
5
- export interface WorkerAccessor {
6
- (first: monaco.Uri, ...more: monaco.Uri[]): Promise<KustoWorker>;
7
- }
4
+ import { AugmentedWorkerAccessor } from './kustoMode';
8
5
  export declare class DiagnosticsAdapter {
9
6
  private _monacoInstance;
10
7
  private _languageId;
@@ -16,7 +13,7 @@ export declare class DiagnosticsAdapter {
16
13
  private _schemaListener;
17
14
  private _cursorListener;
18
15
  private _debouncedValidations;
19
- constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
16
+ constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: AugmentedWorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
20
17
  private getMonacoCodeActions;
21
18
  private getOrCreateDebouncedValidation;
22
19
  dispose(): void;
@@ -31,7 +28,7 @@ export declare class ColorizationAdapter {
31
28
  private _configurationListener;
32
29
  private _schemaListener;
33
30
  private decorations;
34
- constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
31
+ constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: AugmentedWorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
35
32
  dispose(): void;
36
33
  /**
37
34
  * Return true if the range doesn't intersect any of the line ranges.
@@ -44,42 +41,42 @@ export declare class ColorizationAdapter {
44
41
  export declare class CompletionAdapter implements monaco.languages.CompletionItemProvider {
45
42
  private _worker;
46
43
  private languageSettings;
47
- constructor(_worker: WorkerAccessor, languageSettings: LanguageSettings);
44
+ constructor(_worker: AugmentedWorkerAccessor, languageSettings: LanguageSettings);
48
45
  get triggerCharacters(): string[];
49
46
  provideCompletionItems(model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.CompletionContext, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.CompletionList>;
50
47
  }
51
48
  export declare class DefinitionAdapter {
52
49
  private _worker;
53
- constructor(_worker: WorkerAccessor);
50
+ constructor(_worker: AugmentedWorkerAccessor);
54
51
  provideDefinition(model: monaco.editor.IReadOnlyModel, position: monaco.Position, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.Definition>;
55
52
  }
56
53
  export declare class ReferenceAdapter implements monaco.languages.ReferenceProvider {
57
54
  private _worker;
58
- constructor(_worker: WorkerAccessor);
55
+ constructor(_worker: AugmentedWorkerAccessor);
59
56
  provideReferences(model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.ReferenceContext, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.Location[]>;
60
57
  }
61
58
  export declare class RenameAdapter implements monaco.languages.RenameProvider {
62
59
  private _worker;
63
- constructor(_worker: WorkerAccessor);
60
+ constructor(_worker: AugmentedWorkerAccessor);
64
61
  provideRenameEdits(model: monaco.editor.IReadOnlyModel, position: monaco.Position, newName: string, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.WorkspaceEdit>;
65
62
  }
66
63
  export declare class DocumentFormatAdapter implements monaco.languages.DocumentFormattingEditProvider {
67
64
  private _worker;
68
- constructor(_worker: WorkerAccessor);
65
+ constructor(_worker: AugmentedWorkerAccessor);
69
66
  provideDocumentFormattingEdits(model: monaco.editor.IReadOnlyModel, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken): monaco.languages.TextEdit[] | monaco.Thenable<monaco.languages.TextEdit[]>;
70
67
  }
71
68
  export declare class FormatAdapter implements monaco.languages.DocumentRangeFormattingEditProvider {
72
69
  private _worker;
73
- constructor(_worker: WorkerAccessor);
70
+ constructor(_worker: AugmentedWorkerAccessor);
74
71
  provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: monaco.Range, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken): monaco.languages.TextEdit[] | monaco.Thenable<monaco.languages.TextEdit[]>;
75
72
  }
76
73
  export declare class FoldingAdapter implements monaco.languages.FoldingRangeProvider {
77
74
  private _worker;
78
- constructor(_worker: WorkerAccessor);
75
+ constructor(_worker: AugmentedWorkerAccessor);
79
76
  provideFoldingRanges(model: monaco.editor.ITextModel, context: monaco.languages.FoldingContext, token: monaco.CancellationToken): monaco.languages.FoldingRange[] | PromiseLike<monaco.languages.FoldingRange[]>;
80
77
  }
81
78
  export declare class HoverAdapter implements monaco.languages.HoverProvider {
82
79
  private _worker;
83
- constructor(_worker: WorkerAccessor);
80
+ constructor(_worker: AugmentedWorkerAccessor);
84
81
  provideHover(model: monaco.editor.IReadOnlyModel, position: monaco.Position, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.Hover>;
85
82
  }
@@ -10,6 +10,7 @@ import k = Kusto.Data.IntelliSense;
10
10
  import k2 = Kusto.Language.Editor;
11
11
  import { Database } from './schema';
12
12
  import type { RenderInfo } from './renderInfo';
13
+ import type { ClusterReference, DatabaseReference } from '../types';
13
14
  export declare enum TokenKind {
14
15
  TableToken = 2,
15
16
  TableColumnToken = 4,
@@ -124,20 +125,13 @@ export interface LanguageService {
124
125
  getDatabaseReferences(document: TextDocument, cursorOffset: number): Promise<DatabaseReference[]>;
125
126
  getClusterReferences(document: TextDocument, cursorOffset: number): Promise<ClusterReference[]>;
126
127
  addDatabaseToSchema(document: TextDocument, clusterName: string, databaseSchema: Database): Promise<void>;
127
- addClusterToSchema(document: TextDocument, clusterName: string, databaseNames: string[]): Promise<void>;
128
+ addClusterToSchema(document: TextDocument, clusterName: string, databaseNames: readonly string[]): Promise<void>;
128
129
  }
129
130
  export type CmSchema = {
130
131
  accounts: k.KustoIntelliSenseAccountEntity[];
131
132
  services: k.KustoIntelliSenseServiceEntity[];
132
133
  connectionString: string;
133
134
  };
134
- export interface DatabaseReference {
135
- databaseName: string;
136
- clusterName: string;
137
- }
138
- export interface ClusterReference {
139
- clusterName: string;
140
- }
141
135
  /**
142
136
  * Obtain an instance of the kusto language service.
143
137
  */
@@ -27,9 +27,14 @@ export interface TabularParameter {
27
27
  columns: Column[];
28
28
  docstring?: string;
29
29
  }
30
- export type InputParameter = ScalarParameter & {
30
+ /**
31
+ * An input parameter either be a scalar in which case it has a name, type and
32
+ * cslType, or it can be columnar, in which case it will have a name, and a list
33
+ * of scalar types which are the column types.
34
+ */
35
+ export interface InputParameter extends ScalarParameter {
31
36
  columns?: ScalarParameter[];
32
- };
37
+ }
33
38
  export interface Function {
34
39
  name: string;
35
40
  body: string;
@@ -13,7 +13,7 @@ export interface LanguageSettings {
13
13
  syntaxErrorAsMarkDown?: SyntaxErrorAsMarkDownOptions;
14
14
  enableQueryWarnings?: boolean;
15
15
  enableQuerySuggestions?: boolean;
16
- disabledDiagnoticCodes?: string[];
16
+ disabledDiagnosticCodes?: string[];
17
17
  quickFixCodeActions?: QuickFixCodeActionOptions[];
18
18
  enableQuickFixes?: boolean;
19
19
  }
@@ -26,5 +26,5 @@ export interface SyntaxErrorAsMarkDownOptions {
26
26
  icon?: string;
27
27
  enableSyntaxErrorAsMarkDown?: boolean;
28
28
  }
29
- export type QuickFixCodeActionOptions = 'Extract Expression' | 'Extract Function' | 'Change to';
29
+ export type QuickFixCodeActionOptions = 'Extract Expression' | 'Extract Function' | 'Change to' | 'FixAll';
30
30
  export type FormatterPlacementStyle = 'None' | 'NewLine' | 'Smart';
@@ -1,6 +1,9 @@
1
1
  import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
2
- import type { KustoWorker } from './kustoWorker';
3
- import type { LanguageServiceDefaults, LanguageSettings } from './types';
2
+ import type { LanguageServiceDefaults, WorkerAccessor } from './types';
3
+ import type { LanguageSettings } from './languageService/settings';
4
+ export * from './languageService/schema';
5
+ export * from './languageService/renderInfo';
6
+ export * from './languageService/settings';
4
7
  export * from './types';
5
8
  export { getCurrentCommandRange } from './extendedEditor';
6
9
  declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
@@ -14,5 +17,10 @@ declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
14
17
  setMaximumWorkerIdleTime(value: number): void;
15
18
  getWorkerMaxIdleTime(): number;
16
19
  }
17
- export declare function getKustoWorker(): Promise<(first: monaco.Uri, ...more: monaco.Uri[]) => Promise<KustoWorker>>;
20
+ export declare function getKustoWorker(): Promise<WorkerAccessor>;
18
21
  export declare const kustoDefaults: LanguageServiceDefaultsImpl;
22
+ export declare const themeNames: {
23
+ light: string;
24
+ dark: string;
25
+ dark2: string;
26
+ };
@@ -1,11 +1,13 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
3
+ * monaco-kusto version: 7.2.0(ff25adc61b13954e5ec288fcdc16c92483943ef5)
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
8
  import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
9
+ import { g as getCslTypeNameFromClrType, a as getCallName, b as getExpression, c as getInputParametersAsCslString, d as getEntityDataTypeFromCslType } from './schema-53127847.js';
10
+ export { s as showSchema } from './schema-53127847.js';
9
11
 
10
12
  function getCurrentCommandRange(editor, cursorPosition) {
11
13
  const zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
@@ -59,7 +61,7 @@ function extend(editor) {
59
61
  * Highlights the command that surround cursor location
60
62
  */
61
63
  class KustoCommandHighlighter {
62
- static ID = 'editor.contrib.kustoCommandHighliter';
64
+ static ID = 'editor.contrib.kustoCommandHighlighter';
63
65
  static CURRENT_COMMAND_HIGHLIGHT = {
64
66
  className: 'selectionHighlight'
65
67
  };
@@ -203,6 +205,11 @@ function withMode(callback) {
203
205
  import('./kustoMode.js').then(callback);
204
206
  }
205
207
  const kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
208
+ const themeNames = {
209
+ light: 'kusto-light',
210
+ dark: 'kusto-dark',
211
+ dark2: 'kusto-dark2'
212
+ };
206
213
  monaco.languages.onLanguage('kusto', () => {
207
214
  withMode(mode => mode.setupMode(kustoDefaults, monaco));
208
215
  });
@@ -210,7 +217,7 @@ monaco.languages.register({
210
217
  id: 'kusto',
211
218
  extensions: ['.csl', '.kql']
212
219
  });
213
- monaco.editor.defineTheme('kusto-light', {
220
+ monaco.editor.defineTheme(themeNames.light, {
214
221
  base: 'vs',
215
222
  inherit: true,
216
223
  rules: [{
@@ -294,7 +301,7 @@ monaco.editor.defineTheme('kusto-light', {
294
301
  }],
295
302
  colors: {}
296
303
  });
297
- monaco.editor.defineTheme('kusto-dark', {
304
+ monaco.editor.defineTheme(themeNames.dark, {
298
305
  base: 'vs-dark',
299
306
  inherit: true,
300
307
  rules: [{
@@ -380,7 +387,7 @@ monaco.editor.defineTheme('kusto-dark', {
380
387
  // see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
381
388
  }
382
389
  });
383
- monaco.editor.defineTheme('kusto-dark2', {
390
+ monaco.editor.defineTheme(themeNames.dark2, {
384
391
  base: 'vs-dark',
385
392
  inherit: true,
386
393
  rules: [],
@@ -395,8 +402,13 @@ monaco.editor.defineTheme('kusto-dark2', {
395
402
  // Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
396
403
  // Most other language features are initialized in kustoMode.ts
397
404
  monaco.editor.onDidCreateEditor(editor => {
398
- // hook up extension methods to editor.
399
- extend(editor);
405
+ if (window.MonacoEnvironment?.globalAPI) {
406
+ // hook up extension methods to editor.
407
+ extend(editor);
408
+ }
409
+
410
+ // TODO: asked if there's a cleaner way to register an editor contribution. looks like monaco has an internal contribution registrar but it's no exposed in the API.
411
+ // https://stackoverflow.com/questions/46700245/how-to-add-an-ieditorcontribution-to-monaco-editor
400
412
  new KustoCommandHighlighter(editor);
401
413
  if (isStandaloneCodeEditor(editor)) {
402
414
  new KustoCommandFormatter(editor);
@@ -428,10 +440,16 @@ function isStandaloneCodeEditor(editor) {
428
440
  return editor.addAction !== undefined;
429
441
  }
430
442
  const globalApi = {
443
+ getCslTypeNameFromClrType,
444
+ getCallName,
445
+ getExpression,
446
+ getInputParametersAsCslString,
447
+ getEntityDataTypeFromCslType,
431
448
  kustoDefaults,
432
449
  getKustoWorker,
433
- getCurrentCommandRange
450
+ getCurrentCommandRange,
451
+ themeNames
434
452
  };
435
453
  monaco.languages.kusto = globalApi;
436
454
 
437
- export { getCurrentCommandRange, getKustoWorker, kustoDefaults };
455
+ export { getCallName, getCslTypeNameFromClrType, getCurrentCommandRange, getEntityDataTypeFromCslType, getExpression, getInputParametersAsCslString, getKustoWorker, kustoDefaults, themeNames };