@elastic/monaco-esql 3.1.17 → 3.1.18

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/lib/monarch.js CHANGED
@@ -57,7 +57,10 @@ const create = (deps = {}) => {
57
57
  token: "keyword.command.source.promql",
58
58
  switchTo: "@promQLCommand",
59
59
  },
60
- "@headerCommands": { token: "keyword.command.header.$0" },
60
+ "@headerCommands": {
61
+ token: "keyword.command.header.$0",
62
+ switchTo: "@restOfQuery",
63
+ },
61
64
  "@default": {
62
65
  token: "keyword.command.source.$0",
63
66
  switchTo: "@restOfQuery",
package/lib/promql.js CHANGED
@@ -72,6 +72,12 @@ exports.promQLQuery = [
72
72
  nextEmbedded: "@pop",
73
73
  },
74
74
  ],
75
+ // String handling, to avoid exiting when finding a pipe inside a string.
76
+ [/"/, { token: "string", next: "@promqlDoubleString", nextEmbedded: "@pop" }],
77
+ [
78
+ /`/,
79
+ { token: "string", next: "@promqlBacktickString", nextEmbedded: "@pop" },
80
+ ],
75
81
  // Exit condition
76
82
  [
77
83
  /\|/,
@@ -83,7 +89,7 @@ exports.promQLQuery = [
83
89
  ],
84
90
  ];
85
91
  /**
86
- * These states are used for returning the control the promql embedding after a comment ends.
92
+ * These states are used for returning control to the promql embedding after a comment or string ends.
87
93
  */
88
94
  const promQLQueryOverrideRules = {
89
95
  promqlDocComment: [
@@ -99,6 +105,16 @@ const promQLQueryOverrideRules = {
99
105
  promqlLineComment: [
100
106
  [/.*$/, { token: "comment", next: "@pop", nextEmbedded: "promql" }],
101
107
  ],
108
+ promqlDoubleString: [
109
+ [/[^"\\]+/, "string"],
110
+ [/\\./, "string.escape"],
111
+ [/"/, { token: "string", next: "@pop", nextEmbedded: "promql" }],
112
+ ],
113
+ promqlBacktickString: [
114
+ [/[^`\\]+/, "string"],
115
+ [/\\./, "string.escape"],
116
+ [/`/, { token: "string", next: "@pop", nextEmbedded: "promql" }],
117
+ ],
102
118
  };
103
119
  /**
104
120
  * All PromQL tokenizer states needed to tokenize a PROMQL command bundled in one object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/monaco-esql",
3
- "version": "3.1.17",
3
+ "version": "3.1.18",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -78,7 +78,7 @@
78
78
  "lint-staged": "16.2.7",
79
79
  "monaco-editor": "0.55.1",
80
80
  "monaco-promql": "1.8.0",
81
- "playwright": "1.57.0",
81
+ "playwright": "1.58.1",
82
82
  "react": "19.2.3",
83
83
  "react-dom": "19.2.3",
84
84
  "storybook": "10.2.6",