@kusto/monaco-kusto 6.2.0 → 7.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 +31 -10
- package/globalApi.d.ts +13 -0
- package/package.json +6 -5
- package/release/dev/kustoMode.js +4 -2
- package/release/dev/kustoWorker.js +2 -2
- package/release/dev/{main-81df16b2.js → main-5ef10bd7.js} +2 -2
- package/release/dev/monaco.contribution.js +62 -55
- package/release/esm/commandFormatter.d.ts +1 -1
- package/release/esm/commandHighlighter.d.ts +1 -2
- package/release/esm/extendedEditor.d.ts +2 -2
- package/release/esm/kusto.worker.js +1 -1
- package/release/esm/kustoMode.d.ts +2 -4
- package/release/esm/kustoMode.js +3 -1
- package/release/esm/kustoWorker.d.ts +1 -1
- package/release/esm/languageFeatures.d.ts +4 -6
- package/release/esm/languageService/kustoMonarchLanguageDefinition.d.ts +1 -1
- package/release/esm/languageService/settings.d.ts +2 -2
- package/release/esm/monaco.contribution.d.ts +8 -6
- package/release/esm/monaco.contribution.js +65 -59
- package/release/esm/types.d.ts +261 -0
- package/release/esm/workerManager.d.ts +4 -6
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +2 -2
- package/release/min/{main-bf0e83c5.js → main-c8dacaab.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/monaco.d.ts +1 -312
package/README.md
CHANGED
|
@@ -25,19 +25,25 @@ Kusto language plugin for the Monaco Editor. It provides the following features
|
|
|
25
25
|
|
|
26
26
|
Example at [/samples/amd](https://github.com/Azure/monaco-kusto/tree/master/samples/amd)
|
|
27
27
|
|
|
28
|
-
1. Run `npm run copyMonacoFilesAMD <path>` or `yarn copyMonacoFilesAMD <path>`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
1. Run `npm run copyMonacoFilesAMD <path>` or `yarn copyMonacoFilesAMD <path>`
|
|
29
|
+
where <path> is where you want the monaco and kusto amd modules to be. These
|
|
30
|
+
files will need to be served as-in.
|
|
31
|
+
2. Using a amd module loader, import `vs/language/kusto/monaco.contribution` 1. The monaco editors included loader can be made available via a global
|
|
32
|
+
require `require` by adding the script tag: `<script src="<path>/vs/loader.js"></script>`
|
|
33
|
+
3. You should now be able to create monaco editors with `language: 'kusto'`. The
|
|
34
|
+
kusto worker can be reached via the monaco global:
|
|
35
|
+
`monaco.languages.kusto.getKustoWorker()`
|
|
36
|
+
4. If using typeScript, add "@kusto/monaco-kusto/globalApi" to compilerOptions.types in tsconfig.json`
|
|
32
37
|
|
|
33
38
|
### ESM
|
|
34
39
|
|
|
35
40
|
Parcel example at [/samples/parcel](https://github.com/Azure/monaco-kusto/tree/master/samples/parcel)
|
|
36
41
|
|
|
37
42
|
1. Configure your bundler so `@kusto/monaco-kusto/release/esm/kusto.worker` has it's own entry point
|
|
38
|
-
2. Configure
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
2. Configure the global `MonacoEnvironment` with either `getWorkerUrl` or `getWorker`
|
|
44
|
+
3. You should now be able to create monaco editors with `language: 'kusto'`. The
|
|
45
|
+
kusto worker can be reached via the monaco global:
|
|
46
|
+
`monaco.languages.kusto.getKustoWorker()`
|
|
41
47
|
|
|
42
48
|
### Setting a schema
|
|
43
49
|
|
|
@@ -45,9 +51,10 @@ There are 2 APIs to set a Kusto schema:
|
|
|
45
51
|
|
|
46
52
|
1. `setSchema` - the passed schema is of type `ClusterType` (defined in `schema.ts`).
|
|
47
53
|
The database in ROOT.database will be the one in context.
|
|
48
|
-
2. `setSchemaFromShowSchema` - a method to set a schema from the result of the
|
|
49
|
-
The result is a list of databases (see
|
|
50
|
-
|
|
54
|
+
2. `setSchemaFromShowSchema` - a method to set a schema from the result of the
|
|
55
|
+
Kusto query `.show schema as json`. The result is a list of databases (see
|
|
56
|
+
interface `Result` in `schema.ts`), so when this method is used, it also
|
|
57
|
+
requires a cluster URI and the name of the database in context.
|
|
51
58
|
|
|
52
59
|
## Contributing
|
|
53
60
|
|
|
@@ -65,6 +72,20 @@ There are 2 APIs to set a Kusto schema:
|
|
|
65
72
|
|
|
66
73
|
## Changelog
|
|
67
74
|
|
|
75
|
+
### 7.0.0
|
|
76
|
+
|
|
77
|
+
- BREAKING CHANGE: Bumped monaco-editor peer dependency to ~0.37.0
|
|
78
|
+
- This version of monaco-editor no longer requires a patch to work with Parcel. Details here: https://github.com/microsoft/monaco-editor/issues/2966
|
|
79
|
+
- fix: "monaco is not defined" errors when consuming esm files
|
|
80
|
+
- Moved types from global interface (`monaco.languages.kusto.*`) to esm index
|
|
81
|
+
file `import { SomeType } from '@kusto/monaco-kusto`. With this, esm
|
|
82
|
+
consumer no longer need to include
|
|
83
|
+
`@kusto/monaco-kusto/release/monaco.d.ts`.
|
|
84
|
+
- ESM output no longer requires `MonacoEnvironment.globalApi` to be `true`
|
|
85
|
+
- Moved `@kusto/monaco-kusto/release/monaco.d.ts` content to
|
|
86
|
+
`@kusto/monaco-kusto/globalApi.d.ts`. Original file now references this new
|
|
87
|
+
one, and will be removed in a future release.
|
|
88
|
+
|
|
68
89
|
### 6.2.0
|
|
69
90
|
|
|
70
91
|
- Esm output not longer requires `self.MonacoEnvironment` to be true
|
package/globalApi.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Augments monaco global types with Kusto api. Should be imported if you're using amd modules, or if you've set `MonacoEnvironment.globalApi` to true.
|
|
2
|
+
|
|
3
|
+
/// <reference types="monaco-editor/monaco" />
|
|
4
|
+
|
|
5
|
+
declare namespace monaco.editor {
|
|
6
|
+
export interface ICodeEditor {
|
|
7
|
+
getCurrentCommandRange(cursorPosition: monaco.Position): monaco.Range;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare namespace monaco.languages {
|
|
12
|
+
export const kusto: typeof import('@kusto/monaco-kusto');
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kusto/monaco-kusto",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "CSL, KQL plugin for the Monaco Editor",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft"
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"release",
|
|
30
30
|
"README.md",
|
|
31
|
-
"copyMonacoFilesAMD"
|
|
31
|
+
"copyMonacoFilesAMD",
|
|
32
|
+
"globalApi.d.ts"
|
|
32
33
|
],
|
|
33
34
|
"bin": {
|
|
34
35
|
"copyMonacoFilesAMD": "./copyMonacoFilesAMD.js"
|
|
@@ -53,13 +54,13 @@
|
|
|
53
54
|
"concurrently": "^7.6.0",
|
|
54
55
|
"http-server": "^0.12.3",
|
|
55
56
|
"live-server": "^1.2.1",
|
|
56
|
-
"monaco-editor": "~0.
|
|
57
|
+
"monaco-editor": "~0.37.0",
|
|
57
58
|
"monaco-languages": "2.11.1",
|
|
58
59
|
"rimraf": "^4.1.2",
|
|
59
60
|
"rollup": "^3.17.3",
|
|
60
61
|
"terser": "^5.16.2",
|
|
61
62
|
"ts-node": "^10.9.1",
|
|
62
|
-
"typescript": "^
|
|
63
|
+
"typescript": "^5.0.4",
|
|
63
64
|
"vscode-languageserver-textdocument": "1.0.4"
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
@@ -70,6 +71,6 @@
|
|
|
70
71
|
"xregexp": "^5.1.1"
|
|
71
72
|
},
|
|
72
73
|
"peerDependencies": {
|
|
73
|
-
"monaco-editor": "~0.
|
|
74
|
+
"monaco-editor": "~0.37.0"
|
|
74
75
|
}
|
|
75
76
|
}
|
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: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
|
|
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-5ef10bd7'], (function (exports, monaco, main) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -1569,12 +1569,14 @@ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './ma
|
|
|
1569
1569
|
insertText: entry.insertText,
|
|
1570
1570
|
sortText: entry.sortText,
|
|
1571
1571
|
filterText: entry.filterText,
|
|
1572
|
+
// TODO: Is this cast safe?
|
|
1572
1573
|
documentation: formatDocLink((_entry$documentation = entry.documentation) === null || _entry$documentation === void 0 ? void 0 : _entry$documentation.value),
|
|
1573
1574
|
detail: entry.detail,
|
|
1574
1575
|
range: wordRange,
|
|
1575
1576
|
kind: toCompletionItemKind(entry.kind)
|
|
1576
1577
|
};
|
|
1577
1578
|
if (entry.textEdit) {
|
|
1579
|
+
// TODO: Where is the "range" property coming from?
|
|
1578
1580
|
item.range = toRange(entry.textEdit.range);
|
|
1579
1581
|
item.insertText = entry.textEdit.newText;
|
|
1580
1582
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
|
|
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-5ef10bd7'], (function (exports, main) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _slicedToArray$2(arr, i) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$3(arr, i) || _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."); }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
|
|
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-5ef10bd7', ['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: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
|
|
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'], (function (require, exports, monaco
|
|
8
|
+
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main'], (function (require, exports, monaco) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -24,7 +24,57 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco
|
|
27
|
+
var monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
28
|
+
|
|
29
|
+
function getCurrentCommandRange(editor, cursorPosition) {
|
|
30
|
+
var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
|
|
31
|
+
var lines = editor.getModel().getLinesContent();
|
|
32
|
+
var commandOrdinal = 0;
|
|
33
|
+
var linesWithCommandOrdinal = [];
|
|
34
|
+
for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
|
|
35
|
+
var isEmptyLine = lines[lineNumber].trim() === '';
|
|
36
|
+
if (isEmptyLine) {
|
|
37
|
+
// increase commandCounter - we'll be starting a new command.
|
|
38
|
+
linesWithCommandOrdinal.push({
|
|
39
|
+
commandOrdinal: commandOrdinal++,
|
|
40
|
+
lineNumber: lineNumber
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
linesWithCommandOrdinal.push({
|
|
44
|
+
commandOrdinal: commandOrdinal,
|
|
45
|
+
lineNumber: lineNumber
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// No need to keep scanning if we're past our line and we've seen an empty line.
|
|
50
|
+
if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
|
|
55
|
+
var currentCommandLines = linesWithCommandOrdinal.filter(function (line) {
|
|
56
|
+
return line.commandOrdinal === currentCommandOrdinal;
|
|
57
|
+
});
|
|
58
|
+
var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
|
|
59
|
+
var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
|
|
60
|
+
|
|
61
|
+
// End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
|
|
62
|
+
// Start-column of 1 and End column of 2 means 1st character is selected.
|
|
63
|
+
// Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
|
|
64
|
+
var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
|
|
65
|
+
return new monaco__namespace.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Extending ICode editor to contain additional kusto-specific methods.
|
|
70
|
+
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
71
|
+
*/
|
|
72
|
+
function extend(editor) {
|
|
73
|
+
var proto = Object.getPrototypeOf(editor);
|
|
74
|
+
proto.getCurrentCommandRange = function (cursorPosition) {
|
|
75
|
+
getCurrentCommandRange(this, cursorPosition);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
28
78
|
|
|
29
79
|
function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); }
|
|
30
80
|
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -33,6 +83,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
33
83
|
function _defineProperty$2(obj, key, value) { key = _toPropertyKey$2(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
84
|
function _toPropertyKey$2(arg) { var key = _toPrimitive$2(arg, "string"); return _typeof$2(key) === "symbol" ? key : String(key); }
|
|
35
85
|
function _toPrimitive$2(input, hint) { if (_typeof$2(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof$2(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
86
|
+
|
|
36
87
|
/**
|
|
37
88
|
* Highlights the command that surround cursor location
|
|
38
89
|
*/
|
|
@@ -77,7 +128,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
77
128
|
this.decorations = this.editor.deltaDecorations(this.decorations, []);
|
|
78
129
|
return;
|
|
79
130
|
}
|
|
80
|
-
var commandRange = this.editor
|
|
131
|
+
var commandRange = getCurrentCommandRange(this.editor, changeEvent.selection.getStartPosition());
|
|
81
132
|
var decorations = [{
|
|
82
133
|
range: commandRange,
|
|
83
134
|
options: KustoCommandHighlighter.CURRENT_COMMAND_HIGHLIGHT
|
|
@@ -120,7 +171,7 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
120
171
|
editor.addAction({
|
|
121
172
|
id: 'editor.action.kusto.formatCurrentCommand',
|
|
122
173
|
label: 'Format Command Under Cursor',
|
|
123
|
-
keybindings: [
|
|
174
|
+
keybindings: [monaco__namespace.KeyMod.chord(monaco__namespace.KeyMod.CtrlCmd | monaco__namespace.KeyCode.KeyK, monaco__namespace.KeyMod.CtrlCmd | monaco__namespace.KeyCode.KeyF)],
|
|
124
175
|
run: function run(ed) {
|
|
125
176
|
editor.trigger('KustoCommandFormatter', 'editor.action.formatSelection', null);
|
|
126
177
|
},
|
|
@@ -131,52 +182,6 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
131
182
|
});
|
|
132
183
|
});
|
|
133
184
|
|
|
134
|
-
/**
|
|
135
|
-
* Extending ICode editor to contain additional kusto-specific methods.
|
|
136
|
-
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
137
|
-
*/
|
|
138
|
-
function extend(editor) {
|
|
139
|
-
var proto = Object.getPrototypeOf(editor);
|
|
140
|
-
proto.getCurrentCommandRange = function (cursorPosition) {
|
|
141
|
-
var zeroBasedCursorLineNumber = cursorPosition.lineNumber - 1;
|
|
142
|
-
var lines = this.getModel().getLinesContent();
|
|
143
|
-
var commandOrdinal = 0;
|
|
144
|
-
var linesWithCommandOrdinal = [];
|
|
145
|
-
for (var lineNumber = 0; lineNumber < lines.length; lineNumber++) {
|
|
146
|
-
var isEmptyLine = lines[lineNumber].trim() === '';
|
|
147
|
-
if (isEmptyLine) {
|
|
148
|
-
// increase commandCounter - we'll be starting a new command.
|
|
149
|
-
linesWithCommandOrdinal.push({
|
|
150
|
-
commandOrdinal: commandOrdinal++,
|
|
151
|
-
lineNumber: lineNumber
|
|
152
|
-
});
|
|
153
|
-
} else {
|
|
154
|
-
linesWithCommandOrdinal.push({
|
|
155
|
-
commandOrdinal: commandOrdinal,
|
|
156
|
-
lineNumber: lineNumber
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// No need to keep scanning if we're past our line and we've seen an empty line.
|
|
161
|
-
if (lineNumber > zeroBasedCursorLineNumber && commandOrdinal > linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal) {
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
var currentCommandOrdinal = linesWithCommandOrdinal[zeroBasedCursorLineNumber].commandOrdinal;
|
|
166
|
-
var currentCommandLines = linesWithCommandOrdinal.filter(function (line) {
|
|
167
|
-
return line.commandOrdinal === currentCommandOrdinal;
|
|
168
|
-
});
|
|
169
|
-
var currentCommandStartLine = currentCommandLines[0].lineNumber + 1;
|
|
170
|
-
var currentCommandEndLine = currentCommandLines[currentCommandLines.length - 1].lineNumber + 1;
|
|
171
|
-
|
|
172
|
-
// End-column of 1 means no characters will be highlighted - since columns are 1-based in monaco apis.
|
|
173
|
-
// Start-column of 1 and End column of 2 means 1st character is selected.
|
|
174
|
-
// Thus if a line has n column and we need to provide n+1 so that the entire line will be highlighted.
|
|
175
|
-
var commandEndColumn = lines[currentCommandEndLine - 1].length + 1;
|
|
176
|
-
return new monaco.Range(currentCommandStartLine, 1, currentCommandEndLine, commandEndColumn);
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
185
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
181
186
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
182
187
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -184,8 +189,8 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
184
189
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
185
190
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
186
191
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
187
|
-
// --- Kusto configuration and defaults ---------
|
|
188
192
|
|
|
193
|
+
// --- Kusto configuration and defaults ---------
|
|
189
194
|
var LanguageServiceDefaultsImpl = /*#__PURE__*/function () {
|
|
190
195
|
// in milliseconds. For example - this is 2 minutes 2 * 60 * 1000
|
|
191
196
|
|
|
@@ -492,12 +497,14 @@ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/edito
|
|
|
492
497
|
function isStandaloneCodeEditor(editor) {
|
|
493
498
|
return editor.addAction !== undefined;
|
|
494
499
|
}
|
|
495
|
-
|
|
500
|
+
var globalApi = {
|
|
496
501
|
kustoDefaults: kustoDefaults,
|
|
497
|
-
getKustoWorker: getKustoWorker
|
|
502
|
+
getKustoWorker: getKustoWorker,
|
|
503
|
+
getCurrentCommandRange: getCurrentCommandRange
|
|
498
504
|
};
|
|
505
|
+
monaco__namespace.languages.kusto = globalApi;
|
|
499
506
|
|
|
500
|
-
exports.
|
|
507
|
+
exports.getCurrentCommandRange = getCurrentCommandRange;
|
|
501
508
|
exports.getKustoWorker = getKustoWorker;
|
|
502
509
|
exports.kustoDefaults = kustoDefaults;
|
|
503
510
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
export declare function getCurrentCommandRange(editor: monaco.editor.ICodeEditor, cursorPosition: monaco.Position): monaco.Range;
|
|
3
3
|
/**
|
|
4
4
|
* Extending ICode editor to contain additional kusto-specific methods.
|
|
5
5
|
* note that the extend method needs to be called at least once to take affect, otherwise this here code is useless.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="monaco-editor/monaco" />
|
|
3
|
-
import type { LanguageServiceDefaultsImpl } from './monaco.contribution';
|
|
1
|
+
import type { LanguageServiceDefaults } from './monaco.contribution';
|
|
4
2
|
import * as languageFeatures from './languageFeatures';
|
|
5
3
|
/**
|
|
6
4
|
* Called when Kusto language is first needed (a model has the language set)
|
|
7
5
|
* @param defaults
|
|
8
6
|
*/
|
|
9
|
-
export declare function setupMode(defaults:
|
|
7
|
+
export declare function setupMode(defaults: LanguageServiceDefaults, monacoInstance: typeof globalThis.monaco): languageFeatures.WorkerAccessor;
|
|
10
8
|
export declare function getKustoWorker(): Promise<languageFeatures.WorkerAccessor>;
|
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: 7.0.0(f23f8fe8dd705f8413d0d094c76eb0af2131aace)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -862,12 +862,14 @@ class CompletionAdapter {
|
|
|
862
862
|
insertText: entry.insertText,
|
|
863
863
|
sortText: entry.sortText,
|
|
864
864
|
filterText: entry.filterText,
|
|
865
|
+
// TODO: Is this cast safe?
|
|
865
866
|
documentation: formatDocLink(entry.documentation?.value),
|
|
866
867
|
detail: entry.detail,
|
|
867
868
|
range: wordRange,
|
|
868
869
|
kind: toCompletionItemKind(entry.kind)
|
|
869
870
|
};
|
|
870
871
|
if (entry.textEdit) {
|
|
872
|
+
// TODO: Where is the "range" property coming from?
|
|
871
873
|
item.range = toRange(entry.textEdit.range);
|
|
872
874
|
item.insertText = entry.textEdit.newText;
|
|
873
875
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="monaco-editor/monaco" />
|
|
2
1
|
import * as ls from 'vscode-languageserver-types';
|
|
2
|
+
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.worker';
|
|
3
3
|
import * as kustoService from './languageService/kustoLanguageService';
|
|
4
4
|
import type { LanguageSettings } from './languageService/settings';
|
|
5
5
|
import { Schema, showSchema, ScalarParameter, Database, TabularParameter } from './languageService/schema';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="../monaco" />
|
|
2
|
-
/// <reference types="monaco-editor/monaco" />
|
|
3
1
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
4
|
-
import type {
|
|
2
|
+
import type { LanguageServiceDefaults, LanguageSettings } from './monaco.contribution';
|
|
5
3
|
import type { KustoWorker } from './kustoWorker';
|
|
6
4
|
import type { Schema } from './languageService/schema';
|
|
7
5
|
export interface WorkerAccessor {
|
|
@@ -18,7 +16,7 @@ export declare class DiagnosticsAdapter {
|
|
|
18
16
|
private _schemaListener;
|
|
19
17
|
private _cursorListener;
|
|
20
18
|
private _debouncedValidations;
|
|
21
|
-
constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults:
|
|
19
|
+
constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
|
|
22
20
|
private getMonacoCodeActions;
|
|
23
21
|
private getOrCreateDebouncedValidation;
|
|
24
22
|
dispose(): void;
|
|
@@ -33,7 +31,7 @@ export declare class ColorizationAdapter {
|
|
|
33
31
|
private _configurationListener;
|
|
34
32
|
private _schemaListener;
|
|
35
33
|
private decorations;
|
|
36
|
-
constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults:
|
|
34
|
+
constructor(_monacoInstance: typeof globalThis.monaco, _languageId: string, _worker: WorkerAccessor, defaults: LanguageServiceDefaults, onSchemaChange: monaco.IEvent<Schema>);
|
|
37
35
|
dispose(): void;
|
|
38
36
|
/**
|
|
39
37
|
* Return true if the range doesn't intersect any of the line ranges.
|
|
@@ -46,7 +44,7 @@ export declare class ColorizationAdapter {
|
|
|
46
44
|
export declare class CompletionAdapter implements monaco.languages.CompletionItemProvider {
|
|
47
45
|
private _worker;
|
|
48
46
|
private languageSettings;
|
|
49
|
-
constructor(_worker: WorkerAccessor, languageSettings:
|
|
47
|
+
constructor(_worker: WorkerAccessor, languageSettings: LanguageSettings);
|
|
50
48
|
get triggerCharacters(): string[];
|
|
51
49
|
provideCompletionItems(model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.CompletionContext, token: monaco.CancellationToken): monaco.Thenable<monaco.languages.CompletionList>;
|
|
52
50
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.worker';
|
|
2
2
|
export declare const KustoLanguageDefinition: monaco.languages.IMonarchLanguage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { OnDidProvideCompletionItems } from '../types';
|
|
2
2
|
export interface LanguageSettings {
|
|
3
3
|
includeControlCommands?: boolean;
|
|
4
4
|
newlineAfterPipe?: boolean;
|
|
@@ -7,7 +7,7 @@ export interface LanguageSettings {
|
|
|
7
7
|
useSemanticColorization?: boolean;
|
|
8
8
|
useTokenColorization?: boolean;
|
|
9
9
|
disabledCompletionItems?: string[];
|
|
10
|
-
onDidProvideCompletionItems?:
|
|
10
|
+
onDidProvideCompletionItems?: OnDidProvideCompletionItems;
|
|
11
11
|
enableHover?: boolean;
|
|
12
12
|
formatter?: FormatterOptions;
|
|
13
13
|
syntaxErrorAsMarkDown?: SyntaxErrorAsMarkDownOptions;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
/// <reference types="../monaco" />
|
|
2
1
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
3
2
|
import type { KustoWorker } from './kustoWorker';
|
|
4
|
-
|
|
3
|
+
import type { LanguageServiceDefaults, LanguageSettings } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { getCurrentCommandRange } from './extendedEditor';
|
|
6
|
+
declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
5
7
|
private _onDidChange;
|
|
6
8
|
private _languageSettings;
|
|
7
9
|
private _workerMaxIdleTime;
|
|
8
|
-
constructor(languageSettings:
|
|
9
|
-
get onDidChange(): monaco.IEvent<
|
|
10
|
-
get languageSettings():
|
|
11
|
-
setLanguageSettings(options:
|
|
10
|
+
constructor(languageSettings: LanguageSettings);
|
|
11
|
+
get onDidChange(): monaco.IEvent<LanguageServiceDefaults>;
|
|
12
|
+
get languageSettings(): LanguageSettings;
|
|
13
|
+
setLanguageSettings(options: LanguageSettings): void;
|
|
12
14
|
setMaximumWorkerIdleTime(value: number): void;
|
|
13
15
|
getWorkerMaxIdleTime(): number;
|
|
14
16
|
}
|