@elastic/monaco-esql 3.1.1 → 3.1.2

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 (2) hide show
  1. package/lib/monarch.js +21 -10
  2. package/package.json +1 -1
package/lib/monarch.js CHANGED
@@ -3,23 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.create = void 0;
4
4
  const create = (deps = {}) => {
5
5
  const { sourceCommands = [], processingCommands = [], options = [], literals = [], functions = [], delimiters = [], temporalUnits = [], } = deps;
6
- const timeUnits = temporalUnits.flat().sort((a, b) => (a > b ? -1 : 1));
6
+ const timeUnits = withLowercaseVariants(temporalUnits.flat()).sort((a, b) => (a > b ? -1 : 1));
7
7
  return {
8
8
  // Uncomment when developing.
9
9
  // defaultToken: "invalid",
10
10
  // ES|QL is case-insensitive.
11
- ignoreCase: true,
11
+ ignoreCase: false,
12
12
  // Lists of known language keywords and built-ins.
13
- sourceCommands,
14
- processingCommands,
15
- options,
16
- literals,
17
- functions,
13
+ sourceCommands: withLowercaseVariants(sourceCommands),
14
+ processingCommands: withLowercaseVariants(processingCommands),
15
+ processingCommandsOnlyUppercase: processingCommands,
16
+ options: withLowercaseVariants(options),
17
+ literals: withLowercaseVariants(literals),
18
+ functions: withLowercaseVariants(functions),
18
19
  delimiters,
19
- namedOperators: [
20
+ namedOperators: withLowercaseVariants([
20
21
  ...(deps.operators?.named?.binary ?? []),
21
22
  ...(deps.operators?.named?.other ?? []),
22
- ],
23
+ ]),
23
24
  // Pre-defined regular expressions.
24
25
  escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
25
26
  digits: /\d+(_+\d+)*/,
@@ -39,7 +40,7 @@ const create = (deps = {}) => {
39
40
  {
40
41
  cases: {
41
42
  "@sourceCommands": { token: "keyword.command.source.$0" },
42
- "@processingCommands": { token: "keyword.command.processing.$0" },
43
+ "@processingCommandsOnlyUppercase": { token: "keyword.command.processing.$0" },
43
44
  "@options": { token: "keyword.option.$0" },
44
45
  "@literals": { token: "keyword.literal.$0" },
45
46
  "@functions": { token: "identifier.function.$0" },
@@ -169,3 +170,13 @@ const create = (deps = {}) => {
169
170
  };
170
171
  };
171
172
  exports.create = create;
173
+ /**
174
+ * Given a list of strings, returns a new list with both the original and their lowercase versions (no duplicates).
175
+ */
176
+ function withLowercaseVariants(list) {
177
+ const set = new Set(list);
178
+ for (const item of list) {
179
+ set.add(item.toLowerCase());
180
+ }
181
+ return Array.from(set);
182
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/monaco-esql",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"