Format SQL in VS Code without losing work. Every format is checked: SQL Format Desk re-tokenizes its own output and compares it to your original (ignoring only whitespace and keyword case). If anything would be dropped or changed, it aborts and changes nothing.
Buy SQL Format Desk Pro — $12 one-time — adds procedure/function body formatting, team style files, embedded SQL, and lint hints. Install Lite first, then Pro.
Features (Free)
- Format Document and Format Selection (also works as the standard VS Code formatter for
sql files, including Format on Save)
- 6 dialects + generic: T-SQL (SQL Server), PostgreSQL, PL/SQL (Oracle), MySQL, BigQuery, SQLite, and Generic SQL
- Auto-detect dialect: setting → language id → file extension (
.tsql, .pgsql, .pls, .mysql, .bq…) → content heuristics (GO, [brackets], $$, ::, VARCHAR2, backticks, QUALIFY, PRAGMA…)
- Status bar shows the detected dialect; click it to override for the current file
- Preview diff before apply for the SQL Format Desk commands (side-by-side diff, then Apply / Discard)
- Round-trip guard: abort with a message instead of corrupting your query
- Options: indent (spaces, tab, or follow editor), keyword case (upper / lower / preserve), comma position (trailing / leading)
- 100% offline: no network requests, no telemetry, no child processes, no webview
Commands
| Command |
What it does |
| SQL Format Desk: Format Document (Safe) |
Format the whole file (with preview if enabled) |
| SQL Format Desk: Format Selection (Safe) |
Format the selection only |
| SQL Format Desk: Select Dialect |
Override dialect for this file (or back to Auto) |
Settings
| Setting |
Default |
|
sqlFormatDesk.dialect |
auto |
auto, sql, transactsql, postgresql, plsql, mysql, bigquery, sqlite |
sqlFormatDesk.indent |
2 |
1–8, "tab", or "editor" |
sqlFormatDesk.keywordCase |
upper |
upper, lower, preserve |
sqlFormatDesk.commaPosition |
after |
after (trailing) or before (leading) |
sqlFormatDesk.previewBeforeApply |
true |
Diff + confirm for the SQL Format Desk commands |
sqlFormatDesk.showStatusBar |
true |
Show detected dialect |
Known limits
- Stored procedure / function bodies are not reformatted statement-by-statement in Lite (upstream engine limitation; Pro adds practical body formatting). The guard prevents damage; worst case you'll see an abort message.
- Detection heuristics can be wrong on very short queries — click the status bar to pick the dialect.
- Format Document / Format on Save apply directly (no preview); the guard still runs.
Lite vs Pro
|
Lite (Free) |
Pro ($12 one-time) |
| Safe Format Document / Selection with round-trip guard |
✅ |
✅ |
| 6 dialects + auto-detect, preview diff |
✅ |
✅ |
| Procedure / function body formatting |
— |
✅ |
.sqlformat.json team style file |
— |
✅ |
| Embedded SQL in JS / TS / Python / PHP strings |
— |
✅ |
| Lint hints |
— |
✅ |
| 100% offline, no telemetry |
✅ |
✅ |
Everything above is free and complete. SQL Format Desk Pro is a separate offline add-on for a one-time $12, no subscription. It adds:
- Practical procedure / function body formatting
.sqlformat.json team style files
- Embedded SQL formatting in JS / TS / Python / PHP strings
- Lint hints
Install it alongside this free Lite extension. Get SQL Format Desk Pro for $12
Privacy
Runs entirely on your computer. No network, no data collection.
Support
Bugs and ideas: zecroapp@gmail.com · https://zecro-sql-format-desk.pages.dev/
Engine: sql-formatter (MIT), bundled. See THIRD-PARTY-NOTICES.md.
© 2026 Zecro LLC, Washington, USA.
| |