Commit f94cea8a authored by JinPeng's avatar JinPeng

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

parent 3e5a6bfb
...@@ -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