@fc-components/monaco-editor 0.3.4 → 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/dist/monaco-editor.cjs.development.js +13 -2
- package/dist/monaco-editor.cjs.development.js.map +1 -1
- package/dist/monaco-editor.cjs.production.min.js +1 -1
- package/dist/monaco-editor.cjs.production.min.js.map +1 -1
- package/dist/monaco-editor.esm.js +13 -2
- package/dist/monaco-editor.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/sql/format.ts +4 -1
- package/src/sql/index.tsx +3 -1
|
@@ -3663,7 +3663,7 @@ var getSqlCompletionProvider = function getSqlCompletionProvider() {
|
|
|
3663
3663
|
var _templateObject$2;
|
|
3664
3664
|
function formatSql(sql) {
|
|
3665
3665
|
try {
|
|
3666
|
-
|
|
3666
|
+
var formatted = format(sql, {
|
|
3667
3667
|
tabWidth: 2,
|
|
3668
3668
|
keywordCase: 'upper',
|
|
3669
3669
|
// Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
|
|
@@ -3674,6 +3674,9 @@ function formatSql(sql) {
|
|
|
3674
3674
|
}]
|
|
3675
3675
|
}
|
|
3676
3676
|
});
|
|
3677
|
+
// sql-formatter treats $__xxx as a placeholder and inserts a space before '('.
|
|
3678
|
+
// Remove that extra space so $__timeFilter( stays intact as a function call.
|
|
3679
|
+
return formatted.replace(/(\$__[a-zA-Z_][a-zA-Z0-9_]*)\s+\(/g, '$1(');
|
|
3677
3680
|
} catch (_unused) {
|
|
3678
3681
|
// If formatting fails, return the original SQL
|
|
3679
3682
|
return sql;
|
|
@@ -3917,7 +3920,15 @@ var SqlEditor = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
3917
3920
|
alwaysConsumeMouseWheel: false
|
|
3918
3921
|
}
|
|
3919
3922
|
}
|
|
3920
|
-
})), enableFormat && (renderFormatButton ?
|
|
3923
|
+
})), enableFormat && (renderFormatButton ? React.createElement("div", {
|
|
3924
|
+
style: {
|
|
3925
|
+
position: 'absolute',
|
|
3926
|
+
top: 4,
|
|
3927
|
+
right: 4,
|
|
3928
|
+
zIndex: 10
|
|
3929
|
+
},
|
|
3930
|
+
onClick: handleFormat
|
|
3931
|
+
}, renderFormatButton(handleFormat)) : React.createElement("button", {
|
|
3921
3932
|
onClick: handleFormat,
|
|
3922
3933
|
className: formatBtnClassName,
|
|
3923
3934
|
title: 'Format SQL',
|