Files
zed/docs/src/languages/sql.md
T
Ben KunkleandZed Zippy f3a89766b8 Fix docs validation to detect unknown keys (#49660)
Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-19 20:46:21 -05:00

1.9 KiB

title, description
title description
SQL Configure SQL language support in Zed, including language servers, formatting, and debugging.

SQL

SQL files are handled by the SQL Extension.

Formatting

Zed supports auto-formatting SQL using external tools like sql-formatter.

  1. Install sql-formatter:
npm install -g sql-formatter
  1. Ensure sql-formatter is available in your path and check the version:
which sql-formatter
sql-formatter --version
  1. Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > SQL, or add to your settings file:
  "languages": {
    "SQL": {
      "formatter": {
        "external": {
          "command": "sql-formatter",
          "arguments": ["--language", "mysql"]
        }
      }
    }
  },

Substitute your preferred [SQL Dialect] for mysql above (duckdb, hive, mariadb, postgresql, redshift, snowflake, sqlite, spark, etc).

You can add this to Zed project settings (.zed/settings.json) or via your Zed user settings (~/.config/zed/settings.json).

Advanced Formatting

Sql-formatter also allows more precise control by providing sql-formatter configuration options. To provide these, create a .sql-formatter.json file in your project:

{
  "language": "postgresql",
  "tabWidth": 2,
  "keywordCase": "upper",
  "linesBetweenQueries": 2
}

When using a .sql-formatter.json file you can use a simplified Zed settings configuration:

{
  "languages": {
    "SQL": {
      "formatter": {
        "external": {
          "command": "sql-formatter"
        }
      }
    }
  }
}