Unverified Commit b81fb0bc authored by aiwenmo's avatar aiwenmo Committed by GitHub

[Fix][web] Fix the bug of beautifying "||" in the editor

[Fix][web]  Fix the bug of beautifying "||" in the editor
parents 34555b1e f94cea8a
...@@ -157,9 +157,10 @@ const FlinkSqlEditor = (props:any) => { ...@@ -157,9 +157,10 @@ const FlinkSqlEditor = (props:any) => {
var formatted = format(model.getValueInRange(range), { var formatted = format(model.getValueInRange(range), {
indent: ' '.repeat(options.tabSize) indent: ' '.repeat(options.tabSize)
}); });
formatted = formatted.replace(/` ([^`]*) `/g,function (){return '`'+arguments[1].trim()+'`'}) formatted = formatted.replaceAll(/` ([^`]*) `/g,function (){return '`'+arguments[1].trim()+'`'})
.replace(/\$ {([^}]*)}/g,function (){return '${'+arguments[1].trim()+'}'}) .replaceAll(/\$ {([^}]*)}/g,function (){return '${'+arguments[1].trim()+'}'})
.replace(/\| ([^}]*)\|/g,function (){return '|'+arguments[1].trim()+'|'}) .replaceAll(/\| ([^}]*)\|/g,function (){return '|'+arguments[1].trim()+'|'})
.replaceAll(/ - /g,function (){return '-'});
return [ return [
{ {
range: range, range: range,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment