This VS Code extension provides automatic formatting for SQL files according to specific style guidelines.
Features
- Capitalizes SQL keywords
- Aligns SELECT statements
- Formats JOIN clauses with proper indentation
- Formats WHERE clauses with each condition on a new line
- Handles subquery formatting
- Manages block indentations (IF, ELSE, WHILE)
- Standardizes comments
- Formats variable declarations
Configuration
The extension can be enabled/disabled in VS Code settings:
{
"sqlStyleFormatter.enabled": true
}
Guidelines Followed
The formatter follows these key SQL styling guidelines:
- SQL keywords are capitalized
- Each code block ends with a GO statement
- Consistent indentation for joins, subqueries, and control flow blocks
- Comma-first formatting for column lists
- Proper comment formatting
- Standardized variable declaration style
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "SQL Style Formatter"
- Click Install
Requirements
- VS Code version 1.85.0 or higher
- TypeScript
Contributing
Contributions are welcome! Please submit issues or pull requests on the GitHub repository.
| |