This commit is contained in:
Timothy J. Baek 2024-10-06 12:07:45 -07:00
parent e6265897c8
commit 913620ff0c
3 changed files with 13 additions and 1 deletions

View File

@ -14,7 +14,7 @@
import { oneDark } from '@codemirror/theme-one-dark';
import { onMount, createEventDispatcher, getContext } from 'svelte';
import { onMount, createEventDispatcher, getContext, tick } from 'svelte';
import { formatPythonCode } from '$lib/apis/utils';
import { toast } from 'svelte-sonner';
@ -66,6 +66,10 @@
changes: [{ from: 0, to: codeEditor.state.doc.length, insert: formattedCode }]
});
_value = formattedCode;
dispatch('change', { value: _value });
await tick();
toast.success($i18n.t('Code formatted successfully'));
return true;
}

View File

@ -267,6 +267,10 @@ class Pipe:
await tick();
const res = await codeEditor.formatPythonCodeHandler();
await tick();
content = _content;
await tick();
if (res) {
console.log('Code formatted successfully');

View File

@ -155,6 +155,10 @@ class Tools:
await tick();
const res = await codeEditor.formatPythonCodeHandler();
await tick();
content = _content;
await tick();
if (res) {
console.log('Code formatted successfully');