Major formatting-control update for the rule-based (offline) engine.
New in this release
- Blank lines between statements — set the exact number of blank lines between top-level statements (nested statements inside BEGIN...END are untouched; comments stay attached to their statement)
- Blank lines before / after GO — exact spacing around batch separators;
GO 5counts and trailing comments on the GO line are kept - Subquery re-indentation — nested subqueries and derived tables are always indented at least one level per nesting depth
- Preserve comments (on by default) — comments are re-inserted next to the code they belong to after formatting; never silently deleted
- Leading or trailing comma placement
- Indent with tabs option
- Max consecutive blank lines and trim trailing whitespace
- Full Custom rule set — every rule used by the Classic and Modern presets is now individually configurable
- Help — new Help page under Tools → Options → Format T-SQL Script, and a "Format T-SQL Script Help" entry in the Tools menu
Install / upgrade
Download SsmsSqlFormatter.vsix below, close SSMS, double-click to install (upgrades any earlier version), restart SSMS.
Format with Ctrl+Shift+Alt+F, right-click → Format T-SQL Script, or the Tools menu.
Settings: Tools → Options → Format T-SQL Script.
Notes
- Scripts with syntax errors are never modified.
- Optional AI engine available (bring your own Anthropic API key) — everything above works fully offline.
- Microsoft does not officially support extensions in SSMS 21/22 — use at your own risk.
MIT licensed.