@kusto/monaco-kusto 7.0.0 → 7.0.1
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.
- package/README.md +4 -0
- package/package.json +1 -1
- package/release/dev/kustoMode.js +55 -25
- package/release/dev/kustoWorker.js +34 -105
- package/release/dev/{main-5ef10bd7.js → main-a33ab1e1.js} +2 -2
- package/release/dev/monaco.contribution.js +17 -3
- package/release/dev/schema-0bb01ba6.js +109 -0
- package/release/esm/kusto.worker.js +11 -69
- package/release/esm/kustoMode.d.ts +10 -4
- package/release/esm/kustoMode.js +14 -9
- package/release/esm/kustoWorker.d.ts +22 -8
- package/release/esm/languageFeatures.d.ts +11 -14
- package/release/esm/languageService/kustoLanguageService.d.ts +2 -8
- package/release/esm/languageService/schema.d.ts +7 -2
- package/release/esm/languageService/settings.d.ts +2 -2
- package/release/esm/monaco.contribution.d.ts +6 -3
- package/release/esm/monaco.contribution.js +10 -3
- package/release/esm/schema-cdbe085f.js +85 -0
- package/release/esm/types.d.ts +8 -120
- package/release/esm/workerManager.d.ts +2 -2
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-c8dacaab.js → main-8cd8c26d.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/schema-d831c44f.js +7 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*!-----------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
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-0bb01ba6', ['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.
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
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-cdbe085f.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.
|
|
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
|
-
|
|
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
|
|
2180
|
+
return new KustoWorkerImpl(ctx, createData);
|
|
2239
2181
|
});
|
|
2240
2182
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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):
|
|
8
|
-
export declare function getKustoWorker(): Promise<
|
|
13
|
+
export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): AugmentedWorkerAccessor;
|
|
14
|
+
export declare function getKustoWorker(): Promise<AugmentedWorkerAccessor>;
|
package/release/esm/kustoMode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 7.0.
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
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
|
|
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
|
|
1099
|
-
worker.normalizeSchema(schema, connection, database).then(schema =>
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
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
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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<
|
|
82
|
-
getDatabaseReferences(uri: string, cursorOffset: number): Promise<
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
3
|
-
import type {
|
|
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,5 @@ declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
|
14
17
|
setMaximumWorkerIdleTime(value: number): void;
|
|
15
18
|
getWorkerMaxIdleTime(): number;
|
|
16
19
|
}
|
|
17
|
-
export declare function getKustoWorker(): Promise<
|
|
20
|
+
export declare function getKustoWorker(): Promise<WorkerAccessor>;
|
|
18
21
|
export declare const kustoDefaults: LanguageServiceDefaultsImpl;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version: 7.0.
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
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-cdbe085f.js';
|
|
10
|
+
export { s as showSchema } from './schema-cdbe085f.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.
|
|
64
|
+
static ID = 'editor.contrib.kustoCommandHighlighter';
|
|
63
65
|
static CURRENT_COMMAND_HIGHLIGHT = {
|
|
64
66
|
className: 'selectionHighlight'
|
|
65
67
|
};
|
|
@@ -428,10 +430,15 @@ function isStandaloneCodeEditor(editor) {
|
|
|
428
430
|
return editor.addAction !== undefined;
|
|
429
431
|
}
|
|
430
432
|
const globalApi = {
|
|
433
|
+
getCslTypeNameFromClrType,
|
|
434
|
+
getCallName,
|
|
435
|
+
getExpression,
|
|
436
|
+
getInputParametersAsCslString,
|
|
437
|
+
getEntityDataTypeFromCslType,
|
|
431
438
|
kustoDefaults,
|
|
432
439
|
getKustoWorker,
|
|
433
440
|
getCurrentCommandRange
|
|
434
441
|
};
|
|
435
442
|
monaco.languages.kusto = globalApi;
|
|
436
443
|
|
|
437
|
-
export { getCurrentCommandRange, getKustoWorker, kustoDefaults };
|
|
444
|
+
export { getCallName, getCslTypeNameFromClrType, getCurrentCommandRange, getEntityDataTypeFromCslType, getExpression, getInputParametersAsCslString, getKustoWorker, kustoDefaults };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*!-----------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* monaco-kusto version: 7.0.1(d5a041ddb6e4a3a3ebcb2a1aa79da979a62b6da2)
|
|
4
|
+
* Released under the MIT license
|
|
5
|
+
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
|
+
*-----------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An input parameter either be a scalar in which case it has a name, type and
|
|
12
|
+
* cslType, or it can be columnar, in which case it will have a name, and a list
|
|
13
|
+
* of scalar types which are the column types.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Schema types:
|
|
18
|
+
* Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
|
|
19
|
+
* Cluster Manager – Internal only. A schema for clusters that manages other clusters.
|
|
20
|
+
* Data Management – Internal only. A schema for ingestion point operations.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const dotnetTypeToKustoType = {
|
|
24
|
+
'System.SByte': 'bool',
|
|
25
|
+
'System.Byte': 'uint8',
|
|
26
|
+
'System.Int16': 'int16',
|
|
27
|
+
'System.UInt16': 'uint16',
|
|
28
|
+
'System.Int32': 'int',
|
|
29
|
+
'System.UInt32': 'uint',
|
|
30
|
+
'System.Int64': 'long',
|
|
31
|
+
'System.UInt64': 'ulong',
|
|
32
|
+
'System.String': 'string',
|
|
33
|
+
'System.Single': 'float',
|
|
34
|
+
'System.Double': 'real',
|
|
35
|
+
'System.DateTime': 'datetime',
|
|
36
|
+
'System.TimeSpan': 'timespan',
|
|
37
|
+
'System.Guid': 'guid',
|
|
38
|
+
'System.Boolean': 'bool',
|
|
39
|
+
'Newtonsoft.Json.Linq.JArray': 'dynamic',
|
|
40
|
+
'Newtonsoft.Json.Linq.JObject': 'dynamic',
|
|
41
|
+
'Newtonsoft.Json.Linq.JToken': 'dynamic',
|
|
42
|
+
'System.Object': 'dynamic',
|
|
43
|
+
'System.Data.SqlTypes.SqlDecimal': 'decimal'
|
|
44
|
+
};
|
|
45
|
+
const getCslTypeNameFromClrType = clrType => dotnetTypeToKustoType[clrType] || clrType;
|
|
46
|
+
const kustoTypeToEntityDataType = {
|
|
47
|
+
object: 'Object',
|
|
48
|
+
bool: 'Boolean',
|
|
49
|
+
uint8: 'Byte',
|
|
50
|
+
int16: 'Int16',
|
|
51
|
+
uint16: 'UInt16',
|
|
52
|
+
int: 'Int32',
|
|
53
|
+
uint: 'UInt32',
|
|
54
|
+
long: 'Int64',
|
|
55
|
+
ulong: 'UInt64',
|
|
56
|
+
float: 'Single',
|
|
57
|
+
real: 'Double',
|
|
58
|
+
decimal: 'Decimal',
|
|
59
|
+
datetime: 'DateTime',
|
|
60
|
+
string: 'String',
|
|
61
|
+
dynamic: 'Dynamic',
|
|
62
|
+
timespan: 'TimeSpan'
|
|
63
|
+
};
|
|
64
|
+
const getEntityDataTypeFromCslType = cslType => kustoTypeToEntityDataType[cslType] || cslType;
|
|
65
|
+
const getCallName = fn => `${fn.name}(${fn.inputParameters.map(p => `{${p.name}}`).join(',')})`;
|
|
66
|
+
const getExpression = fn => `let ${fn.name} = ${getInputParametersAsCslString(fn.inputParameters)} ${fn.body}`;
|
|
67
|
+
const getInputParametersAsCslString = inputParameters => `(${inputParameters.map(inputParameter => getInputParameterAsCslString(inputParameter)).join(',')})`;
|
|
68
|
+
const getInputParameterAsCslString = inputParameter => {
|
|
69
|
+
// If this is a tabular parameter
|
|
70
|
+
if (inputParameter.columns && inputParameter.columns.length > 0) {
|
|
71
|
+
const attributesAsString = inputParameter.columns.map(col => `${col.name}:${col.cslType || getCslTypeNameFromClrType(col.type)}`).join(',');
|
|
72
|
+
return `${inputParameter.name}:${attributesAsString === '' ? '*' : attributesAsString}`;
|
|
73
|
+
} else {
|
|
74
|
+
return `${inputParameter.name}:${inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type)}`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* This is the schema of the output of kusto command
|
|
80
|
+
* .show schema as json
|
|
81
|
+
*/
|
|
82
|
+
let showSchema;
|
|
83
|
+
(function (_showSchema) {})(showSchema || (showSchema = {}));
|
|
84
|
+
|
|
85
|
+
export { getCallName as a, getExpression as b, getInputParametersAsCslString as c, getEntityDataTypeFromCslType as d, getCslTypeNameFromClrType as g, showSchema as s };
|