- pkg/lsp: JSON-RPC 2.0 LSP server (formatting, diagnostics, codeAction quick-fixes) - cmd/pgtidy: lsp and config subcommands - pkg/diagnostics: TextFix struct for byte-range autofixes - pkg/lint: MIG001/MIG003 autofixes, ApplyFixes helper, --fix flag on lint command - editors/vscode: TypeScript extension with LanguageClient, showVersion/showConfig/formatDocument commands, logo - editors/datagrip: Gradle JetBrains plugin via LSP4IJ, pluginIcon - .goreleaser.yaml, .github/workflows: CI + release pipeline - Makefile: snapshot, release, vscode-compile, vscode-package targets - go.mod + all imports: module path updated to git.warky.dev/wdevs/pgtidy - assets: logo files (256px, 128px, 1024px, ico)
PgTidy — DataGrip / JetBrains Plugin
Formats and lints SQL files in DataGrip (and any JetBrains IDE) via the LSP4IJ plugin.
Requirements
pgtidybinary onPATH— download from releases or build withgo install git.warky.dev/wdevs/pgtidy/cmd/pgtidy@latest- LSP4IJ plugin installed (free, by Red Hat)
- DataGrip 2024.3+ (or any JetBrains IDE 2024.3+)
Install the plugin
Option A — Install from disk (.zip)
- Build:
./gradlew buildPlugin(output inbuild/distributions/) - In DataGrip: Settings → Plugins → ⚙ → Install Plugin from Disk… → select the
.zip - Restart the IDE
Option B — Install LSP4IJ and configure manually (no plugin build needed)
- Install LSP4IJ from the marketplace (Settings → Plugins → Marketplace → search "LSP4IJ")
- Go to Settings → Language Servers → + (Add)
- Fill in:
- Name:
PgTidy - Command:
pgtidy lsp
- Name:
- Under Mappings, add file patterns:
*.sql,*.pgsql - Click OK and restart the IDE
Features
- Formatting —
Code → Reformat Code(Ctrl+Alt+L) formats the current SQL file - Diagnostics — lint findings shown as inspections (MIG001–MIG003, COR001–003, NAM001–003)
- Quick fixes — intention actions for MIG001 (add
CONCURRENTLY) and MIG003 (addNOT VALID)
Troubleshooting
Server not starting: Check View → Tool Windows → LSP4IJ Consoles for stderr output. Most common cause: pgtidy not found on PATH — update the command to the full path, e.g. /usr/local/bin/pgtidy lsp.