Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>sql-formatter-plusNew to Visual Studio Code? Get it now.
sql-formatter-plus

sql-formatter-plus

MuhammadBadar

|
551 installs
| (2) | Free
A T-SQL and SQL Server formatter with selection support, safe identifier casing, and broad syntax coverage.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SQL Formatter Plus

A T-SQL / SQL Server formatter for Visual Studio Code. It formats complete documents or the current selection while preserving string literals, comments, quoted identifiers, and T-SQL-specific syntax.

Features

  • Formats T-SQL statements, clauses, joins, CTEs, subqueries, and set operations.
  • Supports SELECT, INSERT, UPDATE, DELETE, MERGE, DDL, stored procedures, triggers, TRY/CATCH, CASE, window functions, OFFSET/FETCH, and GO batches.
  • Preserves 'single-quoted' strings, N'Unicode' strings, "quoted" identifiers, [bracketed] identifiers, comments, and SQLCMD lines.
  • Formats the current selection when one exists; otherwise formats the whole document.
  • Uses the editor's tab size for indentation.
  • Preserves CRLF/LF line endings, BOMs, money literals, and multi-line literal contents.
  • Avoids changing the case of ambiguous identifiers while still uppercasing keywords.
  • Returns the original text unchanged if formatting fails.

Usage

  1. Install the extension from a .vsix file:
    • Open the Extensions view.
    • Select ... > Install from VSIX...
    • Choose the packaged sql-formatter-plus-3.1.1.vsix file.
  2. Open a .sql file.
  3. Optionally select the SQL you want to format.
  4. Run sql-formatter-plus: Format SQL from the Command Palette.

Selections that start or end inside a string literal, comment, or delimited identifier are skipped to avoid corrupting the document.

Development

npm install
npm test
npm run vsix

npm test compiles the extension and runs the unit and integration tests in a VS Code extension host. npm run vsix creates a packaged extension in the repository root.

Notes

  • Formatting is syntax-aware but does not validate SQL semantics.
  • The extension does not change object names, column names, or string contents.
  • Keyword casing is configurable through the formatter API; the VS Code command uses uppercase keywords.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft