Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>SQL Stylist (T-SQL Formatter)New to Visual Studio Code? Get it now.
SQL Stylist (T-SQL Formatter)

SQL Stylist (T-SQL Formatter)

joeshakely

| (1) | Free
Opinionated T-SQL formatter matching ChatGPT's house style: uppercase keywords, clean indentation, optional AS alignment and block-comments.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SQL Stylist — VS Code Formatter for T‑SQL

An opinionated formatter that gets your .sql files to look like the way I usually send them: UPPERCASE keywords, clean indentation, optional AS alignment, and block‑style comments.

Quick Start

  1. Create the project
mkdir sql-stylist && cd sql-stylist
# drop the files from this repo into this folder
npm i
npm run compile
  1. Run in VS Code
  • Open this folder in VS Code.
  • Press F5 (Run → Start Debugging) to launch an Extension Development Host.
  • Open any .sql file there and run Format Document.
  1. Make it your default SQL formatter
  • In the Extension Host window: Command Palette → Preferences: Open Settings (JSON) and add:
{
  "editor.defaultFormatter": "your-name.sql-stylist",
  "[sql]": {
    "editor.defaultFormatter": "your-name.sql-stylist",
    "editor.formatOnSave": true
  },
  "sqlStylist.convertLineCommentsToBlock": true,
  "sqlStylist.alignAs": false
}
  1. Package to VSIX (optional)
npm run package
# then install the .vsix in VS Code (Extensions → … → Install from VSIX)

Options

  • sqlStylist.keywordCase — upper | lower | preserve (default: upper)
  • sqlStylist.tabWidth — spaces per indent (default: 4)
  • sqlStylist.linesBetweenQueries — blank lines between queries (default: 2)
  • sqlStylist.convertLineCommentsToBlock — turn -- comment-only lines into /* ... */ (default: true)
  • sqlStylist.alignAs — pad spaces to align AS in SELECT lists (naive; off by default)

Notes & Limitations

  • Uses sql-formatter under the hood with the transactsql dialect.
  • alignAs is a simple text pass that works best when sql-formatter has put one select item per line.
  • Comment conversion only targets comment-only lines. Inline -- after code are left as-is.

Dev Tips

  • See logs in View → Output → SQL Stylist.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft