@elastic/monaco-esql 3.1.6 → 3.1.8
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 +3 -6
- package/lib/monarch.js +20 -6
- package/package.json +19 -23
package/README.md
CHANGED
|
@@ -5,20 +5,18 @@ grammar engine).
|
|
|
5
5
|
|
|
6
6
|
<img width="725" alt="image" src="https://github.com/user-attachments/assets/a725841e-68d6-4765-aa29-54a3062e6a3e" />
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
## Usage
|
|
10
9
|
|
|
11
10
|
To highlight ES|QL code in Monaco editor, you need to register ES|QL language
|
|
12
11
|
and its Monarch grammar:
|
|
13
12
|
|
|
14
13
|
```js
|
|
15
|
-
import { language as monarchLanguage } from
|
|
14
|
+
import { language as monarchLanguage } from "@elastic/monaco-esql/lib/monarch-shared";
|
|
16
15
|
|
|
17
|
-
monaco.languages.register({id:
|
|
18
|
-
monaco.languages.setMonarchTokensProvider(
|
|
16
|
+
monaco.languages.register({ id: "esql" });
|
|
17
|
+
monaco.languages.setMonarchTokensProvider("esql", monarchLanguage);
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
22
20
|
## Releasing
|
|
23
21
|
|
|
24
22
|
Publish with `release-it` tool:
|
|
@@ -28,7 +26,6 @@ yarn build
|
|
|
28
26
|
npx release-it
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
|
|
32
29
|
## License
|
|
33
30
|
|
|
34
31
|
MIT
|
package/lib/monarch.js
CHANGED
|
@@ -37,7 +37,7 @@ const create = (deps = {}) => {
|
|
|
37
37
|
{ include: "@whitespace" },
|
|
38
38
|
// Keywords
|
|
39
39
|
[
|
|
40
|
-
/@?[a-zA-Z_$][\w$]*(?![\.\-:])/,
|
|
40
|
+
/@?[a-zA-Z_$][\w$]*(?![\.\-:a-zA-Z_0-9])/,
|
|
41
41
|
{
|
|
42
42
|
cases: {
|
|
43
43
|
"@sourceCommands": { token: "keyword.command.source.$0" },
|
|
@@ -90,22 +90,36 @@ const create = (deps = {}) => {
|
|
|
90
90
|
/\|/,
|
|
91
91
|
{ token: "delimiter.pipe", switchTo: "@beforeMnemonicWhitespace" },
|
|
92
92
|
],
|
|
93
|
+
[
|
|
94
|
+
/\(/,
|
|
95
|
+
{ token: "delimiter.parenthesis", switchTo: "@firstCommandNameInSubQuery" },
|
|
96
|
+
],
|
|
93
97
|
],
|
|
94
98
|
beforeMnemonicWhitespace: [
|
|
95
99
|
{ include: "@whitespace" },
|
|
96
100
|
["", { token: "", switchTo: "@commandName" }],
|
|
97
101
|
],
|
|
98
|
-
|
|
99
|
-
commandName: [
|
|
100
|
-
// First tries to match all known command names.
|
|
102
|
+
exactCommandName: [
|
|
101
103
|
[
|
|
102
|
-
sourceCommands.join("|"),
|
|
104
|
+
withLowercaseVariants(sourceCommands).join("|"),
|
|
103
105
|
{ token: "keyword.command.source.$0", switchTo: "@root" },
|
|
104
106
|
],
|
|
105
107
|
[
|
|
106
|
-
processingCommands.join("|"),
|
|
108
|
+
withLowercaseVariants(processingCommands).join("|"),
|
|
107
109
|
{ token: "keyword.command.processing.$0", switchTo: "@root" },
|
|
108
110
|
],
|
|
111
|
+
],
|
|
112
|
+
firstCommandNameInSubQuery: [
|
|
113
|
+
{ include: "@whitespace" },
|
|
114
|
+
// Try to match an exact command name
|
|
115
|
+
{ include: "@exactCommandName" },
|
|
116
|
+
// If not matched, go to root
|
|
117
|
+
{ include: "@root" }
|
|
118
|
+
],
|
|
119
|
+
// Matches *command name*, i.e. the mnemonic.
|
|
120
|
+
commandName: [
|
|
121
|
+
// First tries to match all known command names.
|
|
122
|
+
{ include: "@exactCommandName" },
|
|
109
123
|
// If command name is not well known, just matches the first word.
|
|
110
124
|
[
|
|
111
125
|
/\w+\b/,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/monaco-esql",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -48,26 +48,22 @@
|
|
|
48
48
|
"monaco-editor": "*"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@biomejs/biome": "
|
|
52
|
-
"@chromatic-com/storybook": "
|
|
53
|
-
"@monaco-editor/react": "
|
|
54
|
-
"@storybook/addon-
|
|
55
|
-
"@storybook/
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
"typescript": "^5.7.3",
|
|
70
|
-
"vitest": "^3.0.7"
|
|
71
|
-
},
|
|
72
|
-
"dependencies": {}
|
|
51
|
+
"@biomejs/biome": "2.2.4",
|
|
52
|
+
"@chromatic-com/storybook": "4.1.1",
|
|
53
|
+
"@monaco-editor/react": "4.7.0",
|
|
54
|
+
"@storybook/addon-onboarding": "9.1.5",
|
|
55
|
+
"@storybook/react-vite": "9.1.5",
|
|
56
|
+
"@types/react": "19.1.13",
|
|
57
|
+
"@vitest/browser": "3.2.4",
|
|
58
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
59
|
+
"monaco-editor": "0.53.0",
|
|
60
|
+
"playwright": "1.55.0",
|
|
61
|
+
"react": "19.1.1",
|
|
62
|
+
"react-dom": "19.1.1",
|
|
63
|
+
"storybook": "9.1.5",
|
|
64
|
+
"typescript": "5.9.2",
|
|
65
|
+
"vitest": "3.2.4",
|
|
66
|
+
"@storybook/addon-vitest": "9.1.5",
|
|
67
|
+
"@storybook/addon-docs": "9.1.5"
|
|
68
|
+
}
|
|
73
69
|
}
|