feat(editor): format SQL files on save
This commit is contained in:
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;
|
||||
}
|
||||
Reference in new issue
Block a user