Commit d63bd9b903b0149f489aafecd050855891d1751c

Authored by fengwotao
1 parent e7e07f64

pref: 优化格式化换行

@@ -191,6 +191,7 @@ @@ -191,6 +191,7 @@
191 aceEditor.value.setOptions({ 191 aceEditor.value.setOptions({
192 enableBasicAutocompletion: true, 192 enableBasicAutocompletion: true,
193 enableLiveAutocompletion: true, 193 enableLiveAutocompletion: true,
  194 + enableSnippets: true,
194 theme: getAceClass.value === 'dark' ? 'ace/theme/terminal' : 'ace/theme/chrome', 195 theme: getAceClass.value === 'dark' ? 'ace/theme/terminal' : 'ace/theme/chrome',
195 }); 196 });
196 aceEditor.value.setValue(''); 197 aceEditor.value.setValue('');
@@ -304,8 +305,10 @@ @@ -304,8 +305,10 @@
304 }; 305 };
305 306
306 const handleFormat = () => { 307 const handleFormat = () => {
  308 + let oldValue = aceEditor.value?.getValue() || '';
  309 + oldValue = oldValue.replaceAll(/;(\n+)?/g, ';\n');
  310 + aceEditor.value?.setValue(oldValue);
307 beautify(aceEditor.value.session); 311 beautify(aceEditor.value.session);
308 - aceEditor.value.getSession().setUseWrapMode(true);  
309 }; 312 };
310 313
311 const [registerModal, { openModal }] = useModal(); 314 const [registerModal, { openModal }] = useModal();