feat(formatter): add custom default SQL layout engine

This commit is contained in:
t8y2 authored and GitHub committed 2026-09-17 17:21:47 +08:00
1 parent 58200ce5a4
commit 455117b8c5
20 files changed
+1588 -175

No files matched your search

@@ -14,7 +14,11 @@ import { DEFAULT_SQL_FORMATTER_SETTINGS } from "@/lib/sql/sqlFormatterConfig";
// QueryEditor.vue survives across the editor mounts in this file, so every test
// must advance its ids monotonically (never reuse a smaller id) to mirror the
// production counter.
const ORIGINAL_SQL = "select id, name\nfrom users\nwhere id = 1";
//
// The sample is long enough that formatting cannot collapse it onto one line:
// the default style joins a statement that fits onto one line, and the replay
// assertions below need a multi-line result.
const ORIGINAL_SQL = "select id, name, email, status, created_at, updated_at, tenant_id\nfrom users\nwhere status = 'active'\nand tenant_id = 42\nand deleted_at is null";
const COMPRESSED_SQL = compressSqlText(ORIGINAL_SQL, "mysql");
const FORMATTED_SQL = await formatSqlForEditing(COMPRESSED_SQL, "mysql", DEFAULT_SQL_FORMATTER_SETTINGS);