Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Clean T-SQL FormatterNew to Visual Studio Code? Get it now.
Clean T-SQL Formatter

Clean T-SQL Formatter

João Matos

|
1 install
| (0) | Free
A VS Code formatter extension for T-SQL.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Clean T-SQL Formatter

A VS Code extension that formats T-SQL statements consistently.

  • Clean T-SQL Formatter
    • Install
    • Build & Run Locally
    • Use
    • Settings
    • Example
    • Notes

Install

Install Clean T-SQL Formatter from the Visual Studio Code Extensions view:

  1. Open Extensions in VS Code.
  2. Search for "Clean T-SQL Formatter" or clean-tsql-formatter.
  3. Select the extension and choose Install.

Alternatively, build and install a VSIX locally or run the extension in the Extension Development Host (see Build & Run Locally).

Build & Run Locally

  1. Clone the repository:
git clone https://github.com/JMatos1221/tsql-formatter.git
cd tsql-formatter
  1. Install dependencies and compile:
npm install
npm run compile
  1. Open the project in VS Code and press F5 to launch the Extension Development Host.

Use

Open a .sql file and run Format Document (right-click → Format Document, Command Palette → Format Document, or use your keybinding). To format automatically on save, enable Editor: Format On Save.

Settings

  • tsqlFormatter.linesBetweenQueries (number, default: 2): Number of empty lines between top-level statements.
  • tsqlFormatter.breakOnKeywords (boolean, default: true): Place keywords like WHERE, JOIN, AND, OR on their own lines.
  • tsqlFormatter.keywordCase (upper | lower | preserve, default: preserve): Keyword casing mode.
  • tsqlFormatter.elementCase (upper | lower | preserve | matchTable, default: preserve): Identifier casing for tables/columns.
  • tsqlFormatter.useBrackets (boolean, default: false): Wrap identifiers in square brackets (e.g., [TableName]).

Change these in VS Code Settings by searching for tsqlFormatter.

Example

Before:

select id, name from users where active=1 order by name

After (with defaults and keywordCase: "upper"):

SELECT id, name
FROM users
WHERE active = 1
ORDER BY name

Notes

  • This extension focuses on formatting; it does not validate SQL semantics.
  • Formatting results depend on your tsqlFormatter.* settings.
  • Report issues or feature requests at https://github.com/JMatos1221/tsql-formatter/issues

License: MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft