feat(editor): format SQL files on save

This commit is contained in:
lizzzzz777 authored and GitHub committed 2026-08-25 14:46:25 +08:00
1 parent 249896dddf
commit 876f850e2d
17 files changed
+148 -7

No files matched your search

@@ -0,0 +1,6 @@
export async function formatSqlSnapshotForSave(sqlSnapshot: string, currentSql: () => string, format: (sql: string) => Promise<string>, applyFormatted: (sql: string) => void): Promise<string> {
const formatted = await format(sqlSnapshot);
if (currentSql() !== sqlSnapshot) return currentSql();
if (formatted !== sqlSnapshot) applyFormatted(formatted);
return formatted;
}