Skip to content

feat: add SQL format button with keyword uppercasing and clause line breaks - #98

Merged
aalvaropc merged 1 commit into
mainfrom
feat/sql-format
Apr 11, 2026
Merged

feat: add SQL format button with keyword uppercasing and clause line breaks#98
aalvaropc merged 1 commit into
mainfrom
feat/sql-format

Conversation

@aalvaropc

@aalvaropc aalvaropc commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • New SqlFormatter module that formats SQL with uppercased keywords, clause-level line breaks, and indented sub-clauses
  • "Format" button in the SQL editor toolbar
  • Handles SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, HAVING, LIMIT, and other major clauses
  • Normalizes whitespace and indents sub-clauses (JOIN, AND, OR, ON) for readability
  • Updates both the LiveView state and CodeMirror editor content via set_sql event

Test plan

  • mix test test/onesqlx/querying/sql_formatter_test.exs — 7 tests (keywords, line breaks, JOINs, GROUP BY, whitespace)
  • mix precommit — 638 tests, 0 failures
  • Manual: type messy SQL, click Format, verify clean output in editor

@aalvaropc
aalvaropc merged commit 5d7e501 into main Apr 11, 2026
2 checks passed
@aalvaropc
aalvaropc deleted the feat/sql-format branch April 11, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant