Note: For the Chinese version of this document, see README_zh.md.
This is the official VS Code extension for the tightly optimized @guojc1/sql-formatter-compact engine. It is designed specifically for developers who have strict requirements for compact and clean SQL layouts.
🌟 Key Features
Relative Flush-Left Alignment: Resolves the annoying double-indentation issue for WHERE, AND, LEFT JOIN relative to FROM.
Pre-comma Layout (commaPosition: before): Elegantly places commas at the beginning of the line while keeping inline comments intact at the end of the previous line.
CASE Inline: Compresses long case-when statements into a single line to keep the code extremely compact.
Magic Comments: Supports /* sql-formatter-compact-disable */ to skip formatting for specific blocks of SQL.
⚙️ Configuration Priority
This extension is highly flexible and reads configurations based on the following priority (from highest to lowest):
Workspace / Project Config: If a .sql-formatter-compact.json or sqlfmt.json file is found in the root directory of your currently opened VS Code workspace, it will be used. This is highly recommended for team consistency.
Global User Config: If no workspace config is found, it will look for the same JSON files in your Operating System's User Home Directory (e.g., C:\Users\YourName or ~). This is great for standalone SQL scripts!
VS Code Settings GUI: If no physical files are found, it falls back to the settings configured directly within the VS Code UI (Ctrl + , -> Search "Compact SQL Formatter").