shandy-sqlfmt extension for VSCode

January 10, 2025 ยท View on GitHub

GitHub license Actions status Marketplace Version

A Visual Studio Code extension for shandy-sqlfmt. Available on the Visual Studio Marketplace.

icon

Usage

Install shandy-sqlfmt

Please install shandy-sqlfmt first.

This extension will automatically detect the sqlfmt command in your workspace, and if can't find it, it will find it in your $PATH.

Global install

pipx install shandy-sqlfmt[jinja]

Local install

# Use your virtualenv tool
cd workspace
python -m venv .venv
source .venv/bin/activate

pip install shandy-sqlfmt[jinja]

Example configuration

You can configure shandy-sqlfmt to format SQL or Jinja-SQL on-save by enabling the editor.formatOnSave action in settings.json, and setting shandy-sqlfmt as your default formatter.

{
  "[sql]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "yassun7010.shandy-sqlfmt"
  },
  "[jinja-sql]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "yassun7010.shandy-sqlfmt"
  }
}

Commands

CommandDescription
shandy-sqlfmt: Format WorkspaceFormat all SQL files in workspace.

License

MIT