@elastic/monaco-esql 3.1.7 → 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.
Files changed (3) hide show
  1. package/README.md +3 -6
  2. package/lib/monarch.js +19 -5
  3. package/package.json +13 -17
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 '@elastic/monaco-esql/lib/monarch-shared';
14
+ import { language as monarchLanguage } from "@elastic/monaco-esql/lib/monarch-shared";
16
15
 
17
- monaco.languages.register({id: 'esql'});
18
- monaco.languages.setMonarchTokensProvider('esql', monarchLanguage);
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
@@ -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
- // Matches *command name*, i.e. the mnemonic.
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.7",
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": "2.1.4",
52
- "@chromatic-com/storybook": "3",
51
+ "@biomejs/biome": "2.2.4",
52
+ "@chromatic-com/storybook": "4.1.1",
53
53
  "@monaco-editor/react": "4.7.0",
54
- "@storybook/addon-essentials": "^8.6.14",
55
- "@storybook/addon-onboarding": "8",
56
- "@storybook/blocks": "^8.6.14",
57
- "@storybook/experimental-addon-test": "^8.6.14",
58
- "@storybook/react": "8",
59
- "@storybook/react-vite": "8",
60
- "@storybook/test": "^8.6.14",
61
- "@types/react": "19.1.10",
54
+ "@storybook/addon-onboarding": "9.1.5",
55
+ "@storybook/react-vite": "9.1.5",
56
+ "@types/react": "19.1.13",
62
57
  "@vitest/browser": "3.2.4",
63
58
  "@vitest/coverage-v8": "3.2.4",
64
- "monaco-editor": "0.52.2",
65
- "playwright": "1.54.2",
59
+ "monaco-editor": "0.53.0",
60
+ "playwright": "1.55.0",
66
61
  "react": "19.1.1",
67
62
  "react-dom": "19.1.1",
68
- "storybook": "8",
63
+ "storybook": "9.1.5",
69
64
  "typescript": "5.9.2",
70
- "vitest": "3.2.4"
71
- },
72
- "dependencies": {}
65
+ "vitest": "3.2.4",
66
+ "@storybook/addon-vitest": "9.1.5",
67
+ "@storybook/addon-docs": "9.1.5"
68
+ }
73
69
  }