@fc-components/monaco-editor 0.3.5 → 0.3.6

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.5",
6
+ "version": "0.3.6",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/monaco-editor.esm.js",
package/src/sql/format.ts CHANGED
@@ -2,7 +2,7 @@ import { format } from 'sql-formatter';
2
2
 
3
3
  export function formatSql(sql: string): string {
4
4
  try {
5
- return format(sql, {
5
+ const formatted = format(sql, {
6
6
  tabWidth: 2,
7
7
  keywordCase: 'upper',
8
8
  // Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
@@ -11,6 +11,9 @@ export function formatSql(sql: string): string {
11
11
  custom: [{ regex: String.raw`\$__[a-zA-Z_][a-zA-Z0-9_]*` }],
12
12
  },
13
13
  });
14
+ // sql-formatter treats $__xxx as a placeholder and inserts a space before '('.
15
+ // Remove that extra space so $__timeFilter( stays intact as a function call.
16
+ return formatted.replace(/(\$__[a-zA-Z_][a-zA-Z0-9_]*)\s+\(/g, '$1(');
14
17
  } catch {
15
18
  // If formatting fails, return the original SQL
16
19
  return sql;