@kusto/monaco-kusto 11.4.0 → 12.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 +25 -1
- package/package.json +3 -1
- package/release/dev/kustoMode-d3f9e09a.js +1818 -0
- package/release/dev/kustoMode.js +4 -2040
- package/release/dev/kustoWorker.js +49 -90
- package/release/dev/{main-1587ba64.js → main-f36cb42f.js} +2 -2
- package/release/dev/monaco.contribution.js +254 -214
- package/release/dev/{schema-a5230652.js → schema-077630e6.js} +13 -2
- package/release/esm/extendedGlobalApi/getRangeHtml.d.ts +2 -0
- package/release/esm/extendedGlobalApi/getRangeHtml.js +11 -0
- package/release/esm/extendedGlobalApi/index.d.ts +1 -0
- package/release/esm/extendedGlobalApi/index.js +1 -0
- package/release/esm/globals.d.ts +1 -0
- package/release/esm/globals.js +1 -0
- package/release/esm/kusto.worker.js +39 -91
- package/release/esm/kustoMode-349f5467.js +957 -0
- package/release/esm/kustoMode.d.ts +4 -8
- package/release/esm/kustoMode.js +94 -104
- package/release/esm/kustoWorker.d.ts +2 -5
- package/release/esm/kustoWorker.js +2 -5
- package/release/esm/languageFeatures.d.ts +1 -14
- package/release/esm/languageFeatures.js +0 -299
- package/release/esm/languageServiceManager/kustoLanguageService.d.ts +2 -4
- package/release/esm/languageServiceManager/kustoLanguageService.js +58 -71
- package/release/esm/languageServiceManager/schema.d.ts +2 -2
- package/release/esm/languageServiceManager/settings.d.ts +0 -2
- package/release/esm/monaco.contribution.d.ts +1 -6
- package/release/esm/monaco.contribution.js +64 -88
- package/release/esm/{schema-c006895b.js → schema-b8f0ba9b.js} +12 -2
- package/release/esm/syntaxHighlighting/SemanticTokensProvider.d.ts +18 -0
- package/release/esm/syntaxHighlighting/SemanticTokensProvider.js +78 -0
- package/release/esm/syntaxHighlighting/kustoMonarchLanguageDefinition.d.ts +2 -0
- package/release/esm/syntaxHighlighting/kustoMonarchLanguageDefinition.js +401 -0
- package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.d.ts +6 -0
- package/release/esm/syntaxHighlighting/semanticTokensProviderRegistrar.js +23 -0
- package/release/esm/syntaxHighlighting/themes.d.ts +11 -0
- package/release/esm/syntaxHighlighting/themes.js +103 -0
- package/release/esm/syntaxHighlighting/types.d.ts +41 -0
- package/release/esm/syntaxHighlighting/types.js +55 -0
- package/release/min/kustoMode-2dd4a01e.js +7 -0
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-75aa3e71.js → main-86d6c837.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/schema-a60c216c.js +7 -0
- package/release/esm/languageServiceManager/kustoMonarchLanguageDefinition.d.ts +0 -2
- package/release/esm/languageServiceManager/kustoMonarchLanguageDefinition.js +0 -211
- package/release/min/schema-192b3175.js +0 -7
|
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
49
|
var t = {};
|
|
14
50
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -86,18 +122,6 @@ export var TokenKind;
|
|
|
86
122
|
TokenKind[TokenKind["BracketRangeToken"] = 262144] = "BracketRangeToken";
|
|
87
123
|
TokenKind[TokenKind["ClientDirectiveToken"] = 524288] = "ClientDirectiveToken";
|
|
88
124
|
})(TokenKind || (TokenKind = {}));
|
|
89
|
-
/**
|
|
90
|
-
* convert the bridge.net object to a plain javascript object that only contains data.
|
|
91
|
-
* @param k2Classifications @kusto/language-service-next bridge.net object
|
|
92
|
-
*/
|
|
93
|
-
function toClassifiedRange(k2Classifications) {
|
|
94
|
-
return k2Classifications.map(function (classification) { return ({
|
|
95
|
-
start: classification.Start,
|
|
96
|
-
end: classification.End,
|
|
97
|
-
length: classification.Length,
|
|
98
|
-
kind: classification.Kind,
|
|
99
|
-
}); });
|
|
100
|
-
}
|
|
101
125
|
var symbolKindToName = (_a = {},
|
|
102
126
|
_a[sym.SymbolKind.Cluster] = 'Cluster',
|
|
103
127
|
_a[sym.SymbolKind.Column] = 'Column',
|
|
@@ -182,22 +206,6 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
182
206
|
'3Dchart': k2.CompletionKind.RenderChart,
|
|
183
207
|
list: k2.CompletionKind.RenderChart,
|
|
184
208
|
};
|
|
185
|
-
this.disabledCompletionItemsV1 = {
|
|
186
|
-
capacity: k.OptionKind.Policy,
|
|
187
|
-
callout: k.OptionKind.Policy,
|
|
188
|
-
encoding: k.OptionKind.Policy,
|
|
189
|
-
batching: k.OptionKind.Policy,
|
|
190
|
-
querythrottling: k.OptionKind.Policy,
|
|
191
|
-
merge: k.OptionKind.Policy,
|
|
192
|
-
querylimit: k.OptionKind.Policy,
|
|
193
|
-
rowstore: k.OptionKind.Policy,
|
|
194
|
-
streamingingestion: k.OptionKind.Policy,
|
|
195
|
-
restricted_view_access: k.OptionKind.Policy,
|
|
196
|
-
sharding: k.OptionKind.Policy,
|
|
197
|
-
'restricted-viewers': k.OptionKind.Policy,
|
|
198
|
-
attach: k.OptionKind.Command,
|
|
199
|
-
purge: k.OptionKind.Command,
|
|
200
|
-
};
|
|
201
209
|
this._kustoKindtolsKind = (_b = {},
|
|
202
210
|
_b[k.OptionKind.None] = ls.CompletionItemKind.Interface,
|
|
203
211
|
_b[k.OptionKind.Operator] = ls.CompletionItemKind.Method,
|
|
@@ -675,46 +683,27 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
675
683
|
return ls.Diagnostic.create(range, diag.Message, severity, diag.Code);
|
|
676
684
|
});
|
|
677
685
|
};
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
absoluteStart: block.Start,
|
|
700
|
-
absoluteEnd: block.End,
|
|
701
|
-
}); });
|
|
702
|
-
return Promise.resolve(result);
|
|
703
|
-
}
|
|
704
|
-
// Entire document requested
|
|
705
|
-
var blocks = this.toArray(script.Blocks);
|
|
706
|
-
var classifications = blocks
|
|
707
|
-
.map(function (block) {
|
|
708
|
-
return _this.toArray(block.Service.GetClassifications(block.Start, block.Length).Classifications);
|
|
709
|
-
})
|
|
710
|
-
.reduce(function (prev, curr) { return prev.concat(curr); }, []);
|
|
711
|
-
return Promise.resolve([
|
|
712
|
-
{
|
|
713
|
-
classifications: toClassifiedRange(classifications),
|
|
714
|
-
absoluteStart: 0,
|
|
715
|
-
absoluteEnd: document.getText().length,
|
|
716
|
-
},
|
|
717
|
-
]);
|
|
686
|
+
KustoLanguageService.prototype.getClassifications = function (document) {
|
|
687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
688
|
+
var codeScript, codeBlocks, classificationRanges;
|
|
689
|
+
var _this = this;
|
|
690
|
+
return __generator(this, function (_a) {
|
|
691
|
+
codeScript = this.parseDocumentV2(document);
|
|
692
|
+
codeBlocks = this.toArray(codeScript.Blocks);
|
|
693
|
+
classificationRanges = codeBlocks.map(function (block) {
|
|
694
|
+
var Classifications = block.Service.GetClassifications(block.Start, block.Length).Classifications;
|
|
695
|
+
return _this.toArray(Classifications);
|
|
696
|
+
});
|
|
697
|
+
return [2 /*return*/, classificationRanges.flatMap(function (ranges) {
|
|
698
|
+
return ranges.map(function (range) {
|
|
699
|
+
var _a = document.positionAt(range.Start), line = _a.line, character = _a.character;
|
|
700
|
+
var length = range.Length;
|
|
701
|
+
var kind = range.Kind;
|
|
702
|
+
return { line: line, character: character, length: length, kind: kind };
|
|
703
|
+
});
|
|
704
|
+
})];
|
|
705
|
+
});
|
|
706
|
+
});
|
|
718
707
|
};
|
|
719
708
|
KustoLanguageService.prototype.getAffectedBlocks = function (blocks, changeIntervals) {
|
|
720
709
|
return blocks.filter(function (block) {
|
|
@@ -1612,8 +1601,7 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1612
1601
|
return command;
|
|
1613
1602
|
};
|
|
1614
1603
|
KustoLanguageService.prototype.getCurrentCommandV2 = function (script, offset) {
|
|
1615
|
-
|
|
1616
|
-
return block;
|
|
1604
|
+
return script.GetBlockAtPosition(offset);
|
|
1617
1605
|
};
|
|
1618
1606
|
KustoLanguageService.prototype.getTextToInsert = function (rule, option) {
|
|
1619
1607
|
var beforeApplyInfo = rule.GetBeforeApplyInfo(option.Value);
|
|
@@ -1744,7 +1732,6 @@ var KustoLanguageService = /** @class */ (function () {
|
|
|
1744
1732
|
}());
|
|
1745
1733
|
var languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
|
|
1746
1734
|
includeControlCommands: true,
|
|
1747
|
-
useSemanticColorization: true,
|
|
1748
1735
|
completionOptions: { includeExtendedSyntax: false },
|
|
1749
1736
|
});
|
|
1750
1737
|
/**
|
|
@@ -62,8 +62,8 @@ export interface EngineSchema {
|
|
|
62
62
|
readonly databases: readonly Database[];
|
|
63
63
|
};
|
|
64
64
|
readonly database: Database | undefined;
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
globalScalarParameters?: readonly ScalarParameter[];
|
|
66
|
+
globalTabularParameters?: readonly TabularParameter[];
|
|
67
67
|
}
|
|
68
68
|
export type TableEntityType = 'Table' | 'ExternalTable' | 'MaterializedViewTable';
|
|
69
69
|
export interface ClusterMangerSchema {
|
|
@@ -3,8 +3,6 @@ export interface LanguageSettings {
|
|
|
3
3
|
includeControlCommands?: boolean;
|
|
4
4
|
newlineAfterPipe?: boolean;
|
|
5
5
|
openSuggestionDialogAfterPreviousSuggestionAccepted?: boolean;
|
|
6
|
-
useSemanticColorization?: boolean;
|
|
7
|
-
useTokenColorization?: boolean;
|
|
8
6
|
disabledCompletionItems?: string[];
|
|
9
7
|
onDidProvideCompletionItems?: OnDidProvideCompletionItems;
|
|
10
8
|
enableHover?: boolean;
|
|
@@ -5,7 +5,7 @@ export * from './languageServiceManager/schema';
|
|
|
5
5
|
export * from './languageServiceManager/renderInfo';
|
|
6
6
|
export * from './languageServiceManager/settings';
|
|
7
7
|
export * from './types';
|
|
8
|
-
export
|
|
8
|
+
export * from './extendedGlobalApi';
|
|
9
9
|
declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
10
10
|
private _onDidChange;
|
|
11
11
|
private _languageSettings;
|
|
@@ -19,8 +19,3 @@ declare class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
|
19
19
|
}
|
|
20
20
|
export declare function getKustoWorker(): Promise<WorkerAccessor>;
|
|
21
21
|
export declare const kustoDefaults: LanguageServiceDefaultsImpl;
|
|
22
|
-
export declare const themeNames: {
|
|
23
|
-
light: string;
|
|
24
|
-
dark: string;
|
|
25
|
-
dark2: string;
|
|
26
|
-
};
|
|
@@ -1,14 +1,64 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
49
|
+
import * as mode from './kustoMode';
|
|
2
50
|
import KustoCommandHighlighter from './commandHighlighter';
|
|
3
51
|
import KustoCommandFormatter from './commandFormatter';
|
|
4
|
-
import { extend
|
|
5
|
-
import {
|
|
52
|
+
import { extend } from './extendedEditor';
|
|
53
|
+
import { themes } from './syntaxHighlighting/themes';
|
|
54
|
+
import { LANGUAGE_ID } from './globals';
|
|
55
|
+
import * as schema from './languageServiceManager/schema';
|
|
56
|
+
import { getRangeHtml } from './extendedGlobalApi';
|
|
6
57
|
export * from './languageServiceManager/schema';
|
|
7
58
|
export * from './languageServiceManager/renderInfo';
|
|
8
59
|
export * from './languageServiceManager/settings';
|
|
9
60
|
export * from './types';
|
|
10
|
-
export
|
|
11
|
-
// --- Kusto configuration and defaults ---------
|
|
61
|
+
export * from './extendedGlobalApi';
|
|
12
62
|
var LanguageServiceDefaultsImpl = /** @class */ (function () {
|
|
13
63
|
function LanguageServiceDefaultsImpl(languageSettings) {
|
|
14
64
|
this._onDidChange = new monaco.Emitter();
|
|
@@ -53,8 +103,6 @@ var defaultLanguageSettings = {
|
|
|
53
103
|
includeControlCommands: true,
|
|
54
104
|
newlineAfterPipe: true,
|
|
55
105
|
openSuggestionDialogAfterPreviousSuggestionAccepted: true,
|
|
56
|
-
useSemanticColorization: true,
|
|
57
|
-
useTokenColorization: false,
|
|
58
106
|
enableHover: true,
|
|
59
107
|
formatter: {
|
|
60
108
|
indentationSize: 4,
|
|
@@ -71,85 +119,23 @@ var defaultLanguageSettings = {
|
|
|
71
119
|
completionOptions: { includeExtendedSyntax: false },
|
|
72
120
|
};
|
|
73
121
|
export function getKustoWorker() {
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
mode.getKustoWorker()
|
|
122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
+
return __generator(this, function (_a) {
|
|
124
|
+
return [2 /*return*/, mode.getKustoWorker()];
|
|
77
125
|
});
|
|
78
126
|
});
|
|
79
127
|
}
|
|
80
|
-
function withMode(callback) {
|
|
81
|
-
import('./kustoMode').then(callback);
|
|
82
|
-
}
|
|
83
128
|
export var kustoDefaults = new LanguageServiceDefaultsImpl(defaultLanguageSettings);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
dark: 'kusto-dark',
|
|
87
|
-
dark2: 'kusto-dark2',
|
|
88
|
-
};
|
|
89
|
-
monaco.languages.onLanguage('kusto', function () {
|
|
90
|
-
withMode(function (mode) { return mode.setupMode(kustoDefaults, monaco); });
|
|
129
|
+
monaco.languages.onLanguage(LANGUAGE_ID, function () {
|
|
130
|
+
mode.setupMode(kustoDefaults, monaco);
|
|
91
131
|
});
|
|
92
132
|
monaco.languages.register({
|
|
93
|
-
id:
|
|
133
|
+
id: LANGUAGE_ID,
|
|
94
134
|
extensions: ['.csl', '.kql'],
|
|
95
135
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
rules: [
|
|
100
|
-
{ token: 'comment', foreground: '008000' }, // CommentToken Green
|
|
101
|
-
{ token: 'variable.predefined', foreground: '800080' }, // CalculatedColumnToken Purple
|
|
102
|
-
{ token: 'function', foreground: '0000FF' }, // FunctionNameToken Blue
|
|
103
|
-
{ token: 'operator.sql', foreground: 'CC3700' }, // _WAS_ OperatorToken OrangeRed, but wasn't accessible.
|
|
104
|
-
{ token: 'string', foreground: 'B22222' }, // StringLiteralToken Firebrick
|
|
105
|
-
{ token: 'operator.scss', foreground: '0000FF' }, // SubOperatorToken Blue
|
|
106
|
-
{ token: 'variable', foreground: 'C71585' }, // TableColumnToken MediumVioletRed
|
|
107
|
-
{ token: 'variable.parameter', foreground: '9932CC' }, // TableToken DarkOrchid
|
|
108
|
-
{ token: '', foreground: '000000' }, // UnknownToken, PlainTextToken Black
|
|
109
|
-
{ token: 'type', foreground: '0000FF' }, // DataTypeToken Blue
|
|
110
|
-
{ token: 'tag', foreground: '0000FF' }, // ControlCommandToken Blue
|
|
111
|
-
{ token: 'annotation', foreground: '2B91AF' }, // QueryParametersToken FF2B91AF
|
|
112
|
-
{ token: 'keyword', foreground: '0000FF' }, // CslCommandToken, PluginToken Blue
|
|
113
|
-
{ token: 'number', foreground: '191970' }, // LetVariablesToken MidnightBlue
|
|
114
|
-
{ token: 'annotation', foreground: '9400D3' }, // ClientDirectiveToken DarkViolet
|
|
115
|
-
{ token: 'invalid', background: 'cd3131' },
|
|
116
|
-
],
|
|
117
|
-
colors: {},
|
|
118
|
-
});
|
|
119
|
-
monaco.editor.defineTheme(themeNames.dark, {
|
|
120
|
-
base: 'vs-dark',
|
|
121
|
-
inherit: true,
|
|
122
|
-
rules: [
|
|
123
|
-
{ token: 'comment', foreground: '608B4E' }, // CommentToken Green
|
|
124
|
-
{ token: 'variable.predefined', foreground: '4ec9b0' }, // CalculatedColumnToken Purple
|
|
125
|
-
{ token: 'function', foreground: 'dcdcaa' }, // FunctionNameToken Blue
|
|
126
|
-
{ token: 'operator.sql', foreground: '9cdcfe' }, // OperatorToken OrangeRed
|
|
127
|
-
{ token: 'string', foreground: 'ce9178' }, // StringLiteralToken Firebrick
|
|
128
|
-
{ token: 'operator.scss', foreground: '569cd6' }, // SubOperatorToken Blue
|
|
129
|
-
{ token: 'variable', foreground: '4ec9b0' }, // TableColumnToken MediumVioletRed
|
|
130
|
-
{ token: 'variable.parameter', foreground: 'c586c0' }, // TableToken DarkOrchid
|
|
131
|
-
{ token: '', foreground: 'd4d4d4' }, // UnknownToken, PlainTextToken Black
|
|
132
|
-
{ token: 'type', foreground: '569cd6' }, // DataTypeToken Blue
|
|
133
|
-
{ token: 'tag', foreground: '569cd6' }, // ControlCommandToken Blue
|
|
134
|
-
{ token: 'annotation', foreground: '9cdcfe' }, // QueryParametersToken FF2B91AF
|
|
135
|
-
{ token: 'keyword', foreground: '569cd6' }, // CslCommandToken, PluginToken Blue
|
|
136
|
-
{ token: 'number', foreground: 'd7ba7d' }, // LetVariablesToken MidnightBlue
|
|
137
|
-
{ token: 'annotation', foreground: 'b5cea8' }, // ClientDirectiveToken DarkViolet
|
|
138
|
-
{ token: 'invalid', background: 'cd3131' },
|
|
139
|
-
],
|
|
140
|
-
colors: {
|
|
141
|
-
// see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
monaco.editor.defineTheme(themeNames.dark2, {
|
|
145
|
-
base: 'vs-dark',
|
|
146
|
-
inherit: true,
|
|
147
|
-
rules: [],
|
|
148
|
-
colors: {
|
|
149
|
-
// see: https://code.visualstudio.com/api/references/theme-color#editor-widget-colors
|
|
150
|
-
'editor.background': '#1B1A19', // gray 200
|
|
151
|
-
'editorSuggestWidget.selectedBackground': '#004E8C',
|
|
152
|
-
},
|
|
136
|
+
themes.forEach(function (_a) {
|
|
137
|
+
var name = _a.name, data = _a.data;
|
|
138
|
+
return monaco.editor.defineTheme(name, data);
|
|
153
139
|
});
|
|
154
140
|
// Initialize kusto specific language features that don't currently have a natural way to extend using existing apis.
|
|
155
141
|
// Most other language features are initialized in kustoMode.ts
|
|
@@ -193,15 +179,5 @@ function triggerSuggestDialogWhenCompletionItemSelected(editor) {
|
|
|
193
179
|
function isStandaloneCodeEditor(editor) {
|
|
194
180
|
return editor.addAction !== undefined;
|
|
195
181
|
}
|
|
196
|
-
var globalApi = {
|
|
197
|
-
getCslTypeNameFromClrType: getCslTypeNameFromClrType,
|
|
198
|
-
getCallName: getCallName,
|
|
199
|
-
getExpression: getExpression,
|
|
200
|
-
getInputParametersAsCslString: getInputParametersAsCslString,
|
|
201
|
-
getEntityDataTypeFromCslType: getEntityDataTypeFromCslType,
|
|
202
|
-
kustoDefaults: kustoDefaults,
|
|
203
|
-
getKustoWorker: getKustoWorker,
|
|
204
|
-
getCurrentCommandRange: getCurrentCommandRange,
|
|
205
|
-
themeNames: themeNames,
|
|
206
|
-
};
|
|
182
|
+
var globalApi = __assign(__assign({}, schema), { kustoDefaults: kustoDefaults, getKustoWorker: getKustoWorker, getRangeHtml: getRangeHtml });
|
|
207
183
|
monaco.languages.kusto = globalApi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 12.0.1(56b90ce0fd31e7d6792f5098d1e8204274966b6e)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -81,4 +81,14 @@ const getInputParameterAsCslString = inputParameter => {
|
|
|
81
81
|
*/
|
|
82
82
|
let showSchema;
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const schema = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
85
|
+
__proto__: null,
|
|
86
|
+
getCallName,
|
|
87
|
+
getCslTypeNameFromClrType,
|
|
88
|
+
getEntityDataTypeFromCslType,
|
|
89
|
+
getExpression,
|
|
90
|
+
getInputParametersAsCslString,
|
|
91
|
+
showSchema
|
|
92
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
93
|
+
|
|
94
|
+
export { getEntityDataTypeFromCslType as a, getCallName as b, getExpression as c, getInputParametersAsCslString as d, showSchema as e, getCslTypeNameFromClrType as g, schema as s };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as monaco from 'monaco-editor';
|
|
2
|
+
import { editor } from 'monaco-editor';
|
|
3
|
+
import { ClassificationRange } from './types';
|
|
4
|
+
type ClassificationsGetter = (uri: string) => Promise<ClassificationRange[]>;
|
|
5
|
+
export declare class SemanticTokensProvider implements monaco.languages.DocumentSemanticTokensProvider {
|
|
6
|
+
private readonly classificationsGetter;
|
|
7
|
+
constructor(classificationsGetter: ClassificationsGetter);
|
|
8
|
+
getLegend(): {
|
|
9
|
+
tokenTypes: import("./types").Token[];
|
|
10
|
+
tokenModifiers: any[];
|
|
11
|
+
};
|
|
12
|
+
provideDocumentSemanticTokens(model: editor.ITextModel): Promise<{
|
|
13
|
+
data: Uint32Array;
|
|
14
|
+
resultId: string;
|
|
15
|
+
}>;
|
|
16
|
+
releaseDocumentSemanticTokens(): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { tokenTypes } from './types';
|
|
38
|
+
var SemanticTokensProvider = /** @class */ (function () {
|
|
39
|
+
function SemanticTokensProvider(classificationsGetter) {
|
|
40
|
+
this.classificationsGetter = classificationsGetter;
|
|
41
|
+
}
|
|
42
|
+
SemanticTokensProvider.prototype.getLegend = function () {
|
|
43
|
+
return { tokenTypes: tokenTypes, tokenModifiers: [] };
|
|
44
|
+
};
|
|
45
|
+
SemanticTokensProvider.prototype.provideDocumentSemanticTokens = function (model) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
var uri, classifications, semanticTokens;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
uri = model.uri.toString();
|
|
52
|
+
return [4 /*yield*/, this.classificationsGetter(uri)];
|
|
53
|
+
case 1:
|
|
54
|
+
classifications = _a.sent();
|
|
55
|
+
semanticTokens = classifications.map(function (classification, index) {
|
|
56
|
+
var previousClassification = classifications[index - 1];
|
|
57
|
+
return semanticTokenMaker(classification, previousClassification);
|
|
58
|
+
});
|
|
59
|
+
return [2 /*return*/, {
|
|
60
|
+
data: new Uint32Array(semanticTokens.flat()),
|
|
61
|
+
resultId: model.getVersionId().toString(),
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
SemanticTokensProvider.prototype.releaseDocumentSemanticTokens = function () { };
|
|
68
|
+
return SemanticTokensProvider;
|
|
69
|
+
}());
|
|
70
|
+
export { SemanticTokensProvider };
|
|
71
|
+
var emptyClassification = { line: 0, character: 0, length: 0, kind: 0 };
|
|
72
|
+
function semanticTokenMaker(classification, previousClassification) {
|
|
73
|
+
if (previousClassification === void 0) { previousClassification = emptyClassification; }
|
|
74
|
+
var line = classification.line, character = classification.character, length = classification.length, kind = classification.kind;
|
|
75
|
+
var deltaLine = line - previousClassification.line;
|
|
76
|
+
var deltaStart = deltaLine ? character : character - previousClassification.character;
|
|
77
|
+
return [deltaLine, deltaStart, length, kind, 0];
|
|
78
|
+
}
|