A lightweight SQL formatter extension for Visual Studio Code built for teams with custom SQL formatting conventions.
JMAN SQL Formatter helps standardize SQL files across projects by applying consistent formatting rules while preserving readability and developer workflow.
Features
Format SQL files directly inside VS Code using:
Shift + Alt + F
- Right Click →
Format Document
- Command Palette →
JMAN SQL Formatter: Format Document
Format all SQL files in your workspace at once:
- Command Palette →
JMAN SQL Formatter: Format Directory
- A confirmation dialog will appear to prevent accidental formatting
- Progress indicator shows file-by-file formatting status
- Failed files are reported without interrupting the batch process
Supports:
- SQL keyword formatting
- Consistent indentation
- Line breaks
- Readability improvements
- Company-specific formatting rules
Example:
Before
select id,name from users where active=1;
After
SELECT
id
, name
FROM users
WHERE
active = 1
;
🚨 SQL Error Highlighting
When formatting fails due to invalid SQL syntax:
- The exact error line is highlighted
- Errors appear in the Problems panel
🛠 dbt & Jinja Friendly
Built with templated SQL workflows in mind.
Example:
Before
SELECT {{ dbt_utils.generate_surrogate_key(['id']) }}, name, age FROM {{ ref('users') }}
After
SELECT
{{ dbt_utils.generate_surrogate_key(['id']) }}
, name
, age
FROM {{ ref('users') }}
Requirements
No additional setup required.
Supported environments:
- Visual Studio Code
^1.100.0
- SQL files
- dbt SQL files (partial support)
Extension Settings
This extension contributes the following settings:
You can set the SQL dialect used for formatting through File -> Preferences -> Settings -> Search 'jman' and select desired dialect from the dropdown.
Currently supported dialects:
sql (default)
postgresql
mysql
sqlite
snowflake
tsql
Default:
"sql"
Usage
Open a SQL file and run:
Shift + Alt + F
or:
Command Palette → Format Document
Use special comments to prevent the formatter from formatting specific SQL blocks:
/* sql-formatter-disable */
SELECT * FROM tbl1;
/* sql-formatter-enable */
SELECT * FROM tbl2;
This is useful for:
- Preserving manually formatted SQL blocks
- Skipping non-standard or custom SQL syntax
- Maintaining specific formatting conventions in certain sections
Known Issues
- Complex templated SQL may not format perfectly
- Some dialect-specific syntax may not yet be supported
- Extremely malformed SQL can produce partial formatting
Release Notes
1.0.0
Initial release featuring:
- SQL document formatting
- VS Code formatter integration
- SQL syntax diagnostics
- Error highlighting
Contributing
Contributions, suggestions, and bug reports are welcome.
License
MIT License