From 760423873a46bb0533c60afdfee5c1dcab6a0597 Mon Sep 17 00:00:00 2001 From: lxk955 <164191365+lxk955@users.noreply.github.com> Date: Mon, 5 Oct 2026 10:45:06 +0800 Subject: [PATCH] feat(sql): support comma position configuration in SQL formatter --- .../editor/SqlFormatterSettingsPanel.vue | 27 ++++++++++ apps/desktop/src/i18n/locales/az.ts | 3 ++ apps/desktop/src/i18n/locales/en.ts | 3 ++ apps/desktop/src/i18n/locales/es.ts | 3 ++ apps/desktop/src/i18n/locales/id.ts | 3 ++ apps/desktop/src/i18n/locales/it.ts | 3 ++ apps/desktop/src/i18n/locales/ja.ts | 3 ++ apps/desktop/src/i18n/locales/ko.ts | 3 ++ apps/desktop/src/i18n/locales/pt-BR.ts | 3 ++ apps/desktop/src/i18n/locales/ru.ts | 3 ++ apps/desktop/src/i18n/locales/tr.ts | 3 ++ apps/desktop/src/i18n/locales/zh-CN.ts | 3 ++ apps/desktop/src/i18n/locales/zh-TW.ts | 3 ++ .../lib/__tests__/sql/sqlFormatter.spec.ts | 17 ++++++ .../__tests__/sql/sqlFormatterConfig.spec.ts | 16 ++++++ .../src/lib/__tests__/sql/sqlLayout.spec.ts | 38 ++++++++++++++ .../src/lib/settings/settingsSearch.ts | 1 + apps/desktop/src/lib/sql/layout/ddl.ts | 15 ++++-- apps/desktop/src/lib/sql/layout/index.ts | 1 + apps/desktop/src/lib/sql/layout/primitives.ts | 7 +++ apps/desktop/src/lib/sql/layout/printer.ts | 10 +++- apps/desktop/src/lib/sql/sqlFormatter.ts | 52 +++++++++++++++++++ .../desktop/src/lib/sql/sqlFormatterConfig.ts | 7 +++ 23 files changed, 222 insertions(+), 5 deletions(-) diff --git a/apps/desktop/src/components/editor/SqlFormatterSettingsPanel.vue b/apps/desktop/src/components/editor/SqlFormatterSettingsPanel.vue index 7997b02230..237a11d5e6 100644 --- a/apps/desktop/src/components/editor/SqlFormatterSettingsPanel.vue +++ b/apps/desktop/src/components/editor/SqlFormatterSettingsPanel.vue @@ -20,6 +20,7 @@ import { serializeSqlFormatterConfig, syncSqlFormatterConfigDraft, type SqlFormatterCase, + type SqlFormatterCommaPosition, type SqlFormatterExpressionWidth, type SqlFormatterFromClauseLayout, type SqlFormatterIndentStyle, @@ -83,6 +84,11 @@ const logicalOperatorOptions: { value: SqlFormatterLogicalOperatorNewline; label { value: "none", labelKey: "settings.sqlFormatterLogicalSameLine" }, ]; +const commaPositionOptions: { value: SqlFormatterCommaPosition; labelKey: string }[] = [ + { value: "after", labelKey: "settings.sqlFormatterCommaPositionAfter" }, + { value: "before", labelKey: "settings.sqlFormatterCommaPositionBefore" }, +]; + const fromClauseLayoutOptions: { value: SqlFormatterFromClauseLayout; labelKey: string }[] = [ { value: "newLine", labelKey: "settings.sqlFormatterFromNewLine" }, { value: "sameLine", labelKey: "settings.sqlFormatterFromSameLine" }, @@ -106,6 +112,7 @@ const sqlFormatterOptionLabelKeys: Record { +
+ + +
+ + +