@kusto/monaco-kusto 13.1.2 → 14.0.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.
- package/README.md +8 -0
- package/package.json +2 -2
- package/release/dev/Kusto.Language.Bridge.min.js +299 -300
- package/release/dev/kustoMode.js +2 -2
- package/release/dev/kustoWorker.js +71 -33
- package/release/dev/{main-c03ce015.js → main-0c9da73f.js} +2 -2
- package/release/dev/monaco.contribution.js +2 -2
- package/release/dev/{schema-855435f8.js → schema-f22af8ab.js} +2 -2
- package/release/dev/{types-ca38c9eb.js → types-b5d705d0.js} +2 -2
- package/release/esm/{globals-aceb1d69.js → globals-cc147acb.js} +1 -1
- package/release/esm/kusto.worker.js +23 -7
- package/release/esm/kustoMode.js +2 -2
- package/release/esm/kustoWorker.d.ts +2 -5
- package/release/esm/kustoWorker.js +1 -1
- package/release/esm/languageServiceManager/kustoLanguageService.d.ts +2 -5
- package/release/esm/languageServiceManager/kustoLanguageService.js +26 -16
- package/release/esm/monaco.contribution.js +4 -4
- package/release/esm/{schema-cf8a68a3.js → schema-3165ad55.js} +1 -1
- package/release/esm/types.d.ts +13 -4
- package/release/min/Kusto.Language.Bridge.min.js +299 -300
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-56143edb.js → main-dd497f63.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-ee15a82d.js → schema-3ad9e39b.js} +2 -2
- package/release/min/{types-a9697f8c.js → types-ab5d5bb2.js} +2 -2
package/release/dev/kustoMode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
|
-
define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-
|
|
8
|
+
define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-0c9da73f', './types-b5d705d0'], (function (exports, monaco, main, types$1) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
|
-
define('vs/language/kusto/kustoWorker', ['exports', './main-
|
|
8
|
+
define('vs/language/kusto/kustoWorker', ['exports', './main-0c9da73f', './schema-f22af8ab'], (function (exports, main, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _slicedToArray$2(r, e) { return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$2(); }
|
|
11
11
|
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -4705,37 +4705,75 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-c03ce015', './schema
|
|
|
4705
4705
|
}
|
|
4706
4706
|
}, {
|
|
4707
4707
|
key: "getReferencedGlobalParams",
|
|
4708
|
-
value: function
|
|
4709
|
-
var
|
|
4710
|
-
|
|
4711
|
-
|
|
4708
|
+
value: function () {
|
|
4709
|
+
var _getReferencedGlobalParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(document, cursorOffset) {
|
|
4710
|
+
var parsedAndAnalyzed, diagnostics, ambientParameters, referencedSymbols, intersection, parameters;
|
|
4711
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4712
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4713
|
+
case 0:
|
|
4714
|
+
parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
|
|
4715
|
+
if (parsedAndAnalyzed) {
|
|
4716
|
+
_context2.next = 3;
|
|
4717
|
+
break;
|
|
4718
|
+
}
|
|
4719
|
+
return _context2.abrupt("return", {
|
|
4720
|
+
kind: 'ok',
|
|
4721
|
+
parameters: []
|
|
4722
|
+
});
|
|
4723
|
+
case 3:
|
|
4724
|
+
diagnostics = parsedAndAnalyzed.GetDiagnostics().GetEnumerator();
|
|
4725
|
+
case 4:
|
|
4726
|
+
if (!diagnostics.moveNext()) {
|
|
4727
|
+
_context2.next = 12;
|
|
4728
|
+
break;
|
|
4729
|
+
}
|
|
4730
|
+
if (!(diagnostics.Current.Code === 'KS245')) {
|
|
4731
|
+
_context2.next = 9;
|
|
4732
|
+
break;
|
|
4733
|
+
}
|
|
4734
|
+
return _context2.abrupt("return", {
|
|
4735
|
+
kind: 'maximumDepthExceeded'
|
|
4736
|
+
});
|
|
4737
|
+
case 9:
|
|
4738
|
+
console.warn("getReferencedGlobalParams: ".concat(diagnostics.Current.Code, " ").concat(diagnostics.Current.Message));
|
|
4739
|
+
case 10:
|
|
4740
|
+
_context2.next = 4;
|
|
4741
|
+
break;
|
|
4742
|
+
case 12:
|
|
4743
|
+
// We take the ambient parameters
|
|
4744
|
+
ambientParameters = this.toArray(this._kustoJsSchemaV2.Parameters); // We take all referenced symbols in the query
|
|
4745
|
+
referencedSymbols = this.toArray(parsedAndAnalyzed.Syntax.GetDescendants(Kusto.Language.Syntax.Expression)).filter(function (expression) {
|
|
4746
|
+
return expression.ReferencedSymbol !== null;
|
|
4747
|
+
}).map(function (x) {
|
|
4748
|
+
return x.ReferencedSymbol;
|
|
4749
|
+
}); // The Intersection between them is the ambient parameters that are used in the query.
|
|
4750
|
+
// Note: Ideally we would use Set here (or at least array.Include), but were' compiling down to es2015.
|
|
4751
|
+
intersection = referencedSymbols.filter(function (referencedSymbol) {
|
|
4752
|
+
return ambientParameters.filter(function (ambientParameter) {
|
|
4753
|
+
return ambientParameter === referencedSymbol;
|
|
4754
|
+
}).length > 0;
|
|
4755
|
+
});
|
|
4756
|
+
parameters = intersection.map(function (param) {
|
|
4757
|
+
return {
|
|
4758
|
+
name: param.Name,
|
|
4759
|
+
type: param.Type.Name
|
|
4760
|
+
};
|
|
4761
|
+
});
|
|
4762
|
+
return _context2.abrupt("return", {
|
|
4763
|
+
kind: 'ok',
|
|
4764
|
+
parameters: parameters
|
|
4765
|
+
});
|
|
4766
|
+
case 17:
|
|
4767
|
+
case "end":
|
|
4768
|
+
return _context2.stop();
|
|
4769
|
+
}
|
|
4770
|
+
}, _callee2, this);
|
|
4771
|
+
}));
|
|
4772
|
+
function getReferencedGlobalParams(_x2, _x3) {
|
|
4773
|
+
return _getReferencedGlobalParams.apply(this, arguments);
|
|
4712
4774
|
}
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
var ambientParameters = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
4716
|
-
|
|
4717
|
-
// We take all referenced symbols in the query
|
|
4718
|
-
var referencedSymbols = this.toArray(parsedAndAnalyzed.Syntax.GetDescendants(Kusto.Language.Syntax.Expression)).filter(function (expression) {
|
|
4719
|
-
return expression.ReferencedSymbol !== null;
|
|
4720
|
-
}).map(function (x) {
|
|
4721
|
-
return x.ReferencedSymbol;
|
|
4722
|
-
});
|
|
4723
|
-
|
|
4724
|
-
// The Intersection between them is the ambient parameters that are used in the query.
|
|
4725
|
-
// Note: Ideally we would use Set here (or at least array.Include), but were' compiling down to es2015.
|
|
4726
|
-
var intersection = referencedSymbols.filter(function (referencedSymbol) {
|
|
4727
|
-
return ambientParameters.filter(function (ambientParameter) {
|
|
4728
|
-
return ambientParameter === referencedSymbol;
|
|
4729
|
-
}).length > 0;
|
|
4730
|
-
});
|
|
4731
|
-
var result = intersection.map(function (param) {
|
|
4732
|
-
return {
|
|
4733
|
-
name: param.Name,
|
|
4734
|
-
type: param.Type.Name
|
|
4735
|
-
};
|
|
4736
|
-
});
|
|
4737
|
-
return Promise.resolve(result);
|
|
4738
|
-
}
|
|
4775
|
+
return getReferencedGlobalParams;
|
|
4776
|
+
}()
|
|
4739
4777
|
}, {
|
|
4740
4778
|
key: "getGlobalParams",
|
|
4741
4779
|
value: function getGlobalParams(document) {
|
|
@@ -5470,7 +5508,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-c03ce015', './schema
|
|
|
5470
5508
|
value: function getReferencedSymbols(uri, cursorOffset) {
|
|
5471
5509
|
var document = this._getTextDocument(uri);
|
|
5472
5510
|
if (!document) {
|
|
5473
|
-
console.error("
|
|
5511
|
+
console.error("getReferencedSymbols: document is ".concat(document, ". uri is ").concat(uri));
|
|
5474
5512
|
return null;
|
|
5475
5513
|
}
|
|
5476
5514
|
var referencedParams = this._languageService.getReferencedSymbols(document, cursorOffset);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
|
-
define('vs/language/kusto/main-
|
|
8
|
+
define('vs/language/kusto/main-0c9da73f', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
/* --------------------------------------------------------------------------------------------
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
|
-
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './types-
|
|
8
|
+
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './types-b5d705d0', './schema-f22af8ab'], (function (require, exports, monaco, types, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
|
-
define('vs/language/kusto/schema-
|
|
8
|
+
define('vs/language/kusto/schema-f22af8ab', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
|
-
define('vs/language/kusto/types-
|
|
8
|
+
define('vs/language/kusto/types-b5d705d0', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
var LANGUAGE_ID = 'kusto';
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -8,7 +8,7 @@
|
|
|
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-
|
|
11
|
+
import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-3165ad55.js';
|
|
12
12
|
import '@kusto/language-service/bridge.min';
|
|
13
13
|
import '@kusto/language-service/Kusto.JavaScript.Client.min';
|
|
14
14
|
import '@kusto/language-service/newtonsoft.json.min';
|
|
@@ -1096,10 +1096,23 @@ class KustoLanguageService {
|
|
|
1096
1096
|
}));
|
|
1097
1097
|
return Promise.resolve(result);
|
|
1098
1098
|
}
|
|
1099
|
-
getReferencedGlobalParams(document, cursorOffset) {
|
|
1099
|
+
async getReferencedGlobalParams(document, cursorOffset) {
|
|
1100
1100
|
const parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
|
|
1101
1101
|
if (!parsedAndAnalyzed) {
|
|
1102
|
-
|
|
1102
|
+
return {
|
|
1103
|
+
kind: 'ok',
|
|
1104
|
+
parameters: []
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
const diagnostics = parsedAndAnalyzed.GetDiagnostics().GetEnumerator();
|
|
1108
|
+
while (diagnostics.moveNext()) {
|
|
1109
|
+
if (diagnostics.Current.Code === 'KS245') {
|
|
1110
|
+
return {
|
|
1111
|
+
kind: 'maximumDepthExceeded'
|
|
1112
|
+
};
|
|
1113
|
+
} else {
|
|
1114
|
+
console.warn(`getReferencedGlobalParams: ${diagnostics.Current.Code} ${diagnostics.Current.Message}`);
|
|
1115
|
+
}
|
|
1103
1116
|
}
|
|
1104
1117
|
|
|
1105
1118
|
// We take the ambient parameters
|
|
@@ -1111,11 +1124,14 @@ class KustoLanguageService {
|
|
|
1111
1124
|
// The Intersection between them is the ambient parameters that are used in the query.
|
|
1112
1125
|
// Note: Ideally we would use Set here (or at least array.Include), but were' compiling down to es2015.
|
|
1113
1126
|
const intersection = referencedSymbols.filter(referencedSymbol => ambientParameters.filter(ambientParameter => ambientParameter === referencedSymbol).length > 0);
|
|
1114
|
-
const
|
|
1127
|
+
const parameters = intersection.map(param => ({
|
|
1115
1128
|
name: param.Name,
|
|
1116
1129
|
type: param.Type.Name
|
|
1117
1130
|
}));
|
|
1118
|
-
return
|
|
1131
|
+
return {
|
|
1132
|
+
kind: 'ok',
|
|
1133
|
+
parameters
|
|
1134
|
+
};
|
|
1119
1135
|
}
|
|
1120
1136
|
getGlobalParams(document) {
|
|
1121
1137
|
const params = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
@@ -1798,7 +1814,7 @@ class KustoWorkerImpl {
|
|
|
1798
1814
|
getReferencedSymbols(uri, cursorOffset) {
|
|
1799
1815
|
const document = this._getTextDocument(uri);
|
|
1800
1816
|
if (!document) {
|
|
1801
|
-
console.error(`
|
|
1817
|
+
console.error(`getReferencedSymbols: document is ${document}. uri is ${uri}`);
|
|
1802
1818
|
return null;
|
|
1803
1819
|
}
|
|
1804
1820
|
const referencedParams = this._languageService.getReferencedSymbols(document, cursorOffset);
|
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:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -9,7 +9,7 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
|
9
9
|
import { languages } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
10
10
|
import * as ls from 'vscode-languageserver-types';
|
|
11
11
|
import debounce from 'lodash-es/debounce';
|
|
12
|
-
import { L as LANGUAGE_ID, T as Token, t as tokenTypes } from './globals-
|
|
12
|
+
import { L as LANGUAGE_ID, T as Token, t as tokenTypes } from './globals-cc147acb.js';
|
|
13
13
|
|
|
14
14
|
class WorkerManager {
|
|
15
15
|
constructor(_monacoInstance, defaults) {
|
|
@@ -5,7 +5,7 @@ import * as kustoService from './languageServiceManager/kustoLanguageService';
|
|
|
5
5
|
import type { LanguageSettings } from './languageServiceManager/settings';
|
|
6
6
|
import { Schema, showSchema, ScalarParameter, Database, TabularParameter } from './languageServiceManager/schema';
|
|
7
7
|
import type { RenderInfo } from './languageServiceManager/renderInfo';
|
|
8
|
-
import type { ClusterReference, DatabaseReference } from './types';
|
|
8
|
+
import type { ClusterReference, DatabaseReference, GetReferencedGlobalParamsResult } from './types';
|
|
9
9
|
import { ClassificationRange } from './syntaxHighlighting/types';
|
|
10
10
|
export type InterfaceFor<C> = {
|
|
11
11
|
[Member in keyof C]: C[Member];
|
|
@@ -45,10 +45,7 @@ export declare class KustoWorkerImpl {
|
|
|
45
45
|
kind: string;
|
|
46
46
|
display: string;
|
|
47
47
|
}[]>;
|
|
48
|
-
getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<
|
|
49
|
-
name: string;
|
|
50
|
-
type: string;
|
|
51
|
-
}[]>;
|
|
48
|
+
getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<GetReferencedGlobalParamsResult>;
|
|
52
49
|
getRenderInfo(uri: string, cursorOffset: number): Promise<RenderInfo | null>;
|
|
53
50
|
/**
|
|
54
51
|
* Get command in context and the command range.
|
|
@@ -74,7 +74,7 @@ var KustoWorkerImpl = /** @class */ (function () {
|
|
|
74
74
|
KustoWorkerImpl.prototype.getReferencedSymbols = function (uri, cursorOffset) {
|
|
75
75
|
var document = this._getTextDocument(uri);
|
|
76
76
|
if (!document) {
|
|
77
|
-
console.error("
|
|
77
|
+
console.error("getReferencedSymbols: document is ".concat(document, ". uri is ").concat(uri));
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
80
|
var referencedParams = this._languageService.getReferencedSymbols(document, cursorOffset);
|
|
@@ -10,7 +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
|
+
import type { ClusterReference, DatabaseReference, GetReferencedGlobalParamsResult } from '../types';
|
|
14
14
|
import { ClassificationRange } from '../syntaxHighlighting/types';
|
|
15
15
|
export declare enum TokenKind {
|
|
16
16
|
TableToken = 2,
|
|
@@ -115,10 +115,7 @@ export interface LanguageService {
|
|
|
115
115
|
kind: string;
|
|
116
116
|
display: string;
|
|
117
117
|
}[]>;
|
|
118
|
-
getReferencedGlobalParams(document: TextDocument, offset?: number): Promise<
|
|
119
|
-
name: string;
|
|
120
|
-
type: string;
|
|
121
|
-
}[]>;
|
|
118
|
+
getReferencedGlobalParams(document: TextDocument, offset?: number): Promise<GetReferencedGlobalParamsResult>;
|
|
122
119
|
getRenderInfo(document: TextDocument, cursorOffset: number): Promise<RenderInfo | undefined>;
|
|
123
120
|
getDatabaseReferences(document: TextDocument, cursorOffset: number): Promise<DatabaseReference[]>;
|
|
124
121
|
getClusterReferences(document: TextDocument, cursorOffset: number): Promise<ClusterReference[]>;
|
|
@@ -1214,23 +1214,33 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1214
1214
|
return Promise.resolve(result);
|
|
1215
1215
|
};
|
|
1216
1216
|
KustoLanguageService.prototype.getReferencedGlobalParams = function (document, cursorOffset) {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1217
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1218
|
+
var parsedAndAnalyzed, diagnostics, ambientParameters, referencedSymbols, intersection, parameters;
|
|
1219
|
+
return __generator(this, function (_a) {
|
|
1220
|
+
parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
|
|
1221
|
+
if (!parsedAndAnalyzed) {
|
|
1222
|
+
return [2 /*return*/, { kind: 'ok', parameters: [] }];
|
|
1223
|
+
}
|
|
1224
|
+
diagnostics = parsedAndAnalyzed.GetDiagnostics().GetEnumerator();
|
|
1225
|
+
while (diagnostics.moveNext()) {
|
|
1226
|
+
if (diagnostics.Current.Code === 'KS245') {
|
|
1227
|
+
return [2 /*return*/, { kind: 'maximumDepthExceeded' }];
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
console.warn("getReferencedGlobalParams: ".concat(diagnostics.Current.Code, " ").concat(diagnostics.Current.Message));
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
ambientParameters = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
1234
|
+
referencedSymbols = this.toArray(parsedAndAnalyzed.Syntax.GetDescendants(Kusto.Language.Syntax.Expression))
|
|
1235
|
+
.filter(function (expression) { return expression.ReferencedSymbol !== null; })
|
|
1236
|
+
.map(function (x) { return x.ReferencedSymbol; });
|
|
1237
|
+
intersection = referencedSymbols.filter(function (referencedSymbol) {
|
|
1238
|
+
return ambientParameters.filter(function (ambientParameter) { return ambientParameter === referencedSymbol; }).length > 0;
|
|
1239
|
+
});
|
|
1240
|
+
parameters = intersection.map(function (param) { return ({ name: param.Name, type: param.Type.Name }); });
|
|
1241
|
+
return [2 /*return*/, { kind: 'ok', parameters: parameters }];
|
|
1242
|
+
});
|
|
1231
1243
|
});
|
|
1232
|
-
var result = intersection.map(function (param) { return ({ name: param.Name, type: param.Type.Name }); });
|
|
1233
|
-
return Promise.resolve(result);
|
|
1234
1244
|
};
|
|
1235
1245
|
KustoLanguageService.prototype.getGlobalParams = function (document) {
|
|
1236
1246
|
var params = this.toArray(this._kustoJsSchemaV2.Parameters);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
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
9
|
import { editor } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
10
|
-
import { T as Token, L as LANGUAGE_ID } from './globals-
|
|
11
|
-
import { g as getCslTypeNameFromClrType, a as getCallName, b as getExpression, c as getInputParametersAsCslString, d as getEntityDataTypeFromCslType } from './schema-
|
|
12
|
-
export { s as showSchema } from './schema-
|
|
10
|
+
import { T as Token, L as LANGUAGE_ID } from './globals-cc147acb.js';
|
|
11
|
+
import { g as getCslTypeNameFromClrType, a as getCallName, b as getExpression, c as getInputParametersAsCslString, d as getEntityDataTypeFromCslType } from './schema-3165ad55.js';
|
|
12
|
+
export { s as showSchema } from './schema-3165ad55.js';
|
|
13
13
|
|
|
14
14
|
function getCurrentCommandRange(editor, cursorPosition) {
|
|
15
15
|
const zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 14.0.0(b10154abad9ec434f6b4ea889775260fe2c626b1)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
package/release/esm/types.d.ts
CHANGED
|
@@ -19,6 +19,18 @@ export interface LanguageServiceDefaults {
|
|
|
19
19
|
setMaximumWorkerIdleTime(value: number): void;
|
|
20
20
|
getWorkerMaxIdleTime(): number;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* kind == maximumDepthExceeded: Query syntax depth exceeded maximum safe limit
|
|
24
|
+
*/
|
|
25
|
+
export type GetReferencedGlobalParamsResult = {
|
|
26
|
+
kind: 'ok';
|
|
27
|
+
parameters: {
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
}[];
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'maximumDepthExceeded';
|
|
33
|
+
};
|
|
22
34
|
export interface KustoWorker {
|
|
23
35
|
setSchema(schema: Schema): Promise<void>;
|
|
24
36
|
setSchemaFromShowSchema(schema: any, clusterConnectionString: string, databaseInContextName: string, globalScalarParameters?: ScalarParameter[], globalTabularParameters?: TabularParameter[]): Promise<void>;
|
|
@@ -66,10 +78,7 @@ export interface KustoWorker {
|
|
|
66
78
|
* statement.
|
|
67
79
|
* It is also different from getGlobalParams that will return all global parameters whether used or not.
|
|
68
80
|
*/
|
|
69
|
-
getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<
|
|
70
|
-
name: string;
|
|
71
|
-
type: string;
|
|
72
|
-
}[]>;
|
|
81
|
+
getReferencedGlobalParams(uri: string, cursorOffset?: number): Promise<GetReferencedGlobalParamsResult>;
|
|
73
82
|
getReferencedSymbols(uri: string, cursorOffset?: number): Promise<{
|
|
74
83
|
name: string;
|
|
75
84
|
kind: string;
|