Files

PgTidy — DataGrip / JetBrains Plugin

Formats SQL files in DataGrip (and any JetBrains IDE) by shelling out to the pgtidy binary.

Requirements

  • pgtidy binary on PATH — download from releases or build with go install git.warky.dev/wdevs/pgtidy/cmd/pgtidy@latest
  • DataGrip 2024.3+ (or any JetBrains IDE 2024.3+)

Install the plugin

  1. Build: ./gradlew buildPlugin (output in build/distributions/)
  2. In DataGrip: Settings → Plugins → ⚙ → Install Plugin from Disk… → select the .zip
  3. Restart the IDE

Features

  • FormattingFormat with PgTidy (Ctrl+Alt+Shift+P or right-click in the editor) formats the current SQL file via pgtidy fmt
  • Version checkTools → Show PgTidy Version and the status bar widget show the installed pgtidy version
  • Diagnostics — lint findings (MIG001MIG003, COR001003, NAM001003) are shown inline as editor annotations, via a native ExternalAnnotator that runs pgtidy lint --json
  • Quick fixes — intention actions for MIG001 (add CONCURRENTLY) and MIG003 (add NOT VALID)

Troubleshooting

"Cannot start pgtidy" error: the pgtidy binary isn't on PATH for the IDE process. Install it or restart the IDE after adding it to PATH.

No diagnostics showing: diagnostics only run on files with a .sql or .pgsql extension; check pgtidy lint --json runs cleanly on the file from a terminal with the same PATH as the IDE.