feat: add LSP server, VSCode + DataGrip extensions, release infra, autofix
CI / Test (push) Failing after 47s
CI / Build snapshot (push) Has been skipped

- 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)
This commit is contained in:
2026-06-28 12:48:28 +02:00
parent 7fb76bae3d
commit e88d32f281
49 changed files with 3228 additions and 49 deletions
+75
View File
@@ -0,0 +1,75 @@
# PgTidy — VSCode Extension
Formats and lints PostgreSQL/PL-pgSQL files using the `pgtidy` language server.
## Requirements
- `pgtidy` binary on `PATH` (see [Build the binary](#build-the-binary) below)
- Go 1.21+ (to build from source)
- VSCode 1.85+
## Build the binary
**Option A — install directly with Go (recommended):**
```sh
go install git.warky.dev/wdevs/pgtidy/cmd/pgtidy@latest
```
The binary lands in `$(go env GOPATH)/bin/`. Make sure that directory is on your `PATH`.
**Option B — build from source and place manually:**
```sh
git clone https://git.warky.dev/wdevs/PgTidy
cd PgTidy
go build -o pgtidy ./cmd/pgtidy
# Linux / macOS — move to a directory on PATH
mv pgtidy /usr/local/bin/
# Windows — move to a directory on PATH, e.g.
# move pgtidy.exe C:\tools\
```
Verify the binary is reachable:
```sh
pgtidy version
```
If you place it somewhere not on `PATH`, set the full path in VSCode settings:
```json
"pgtidy.path": "/path/to/pgtidy"
```
## Install from `.vsix`
1. Build the package: `pnpm run build && pnpm run package`
2. In VSCode: **Extensions**`···` menu → **Install from VSIX…** → select `pgtidy-*.vsix`
Or via CLI:
```sh
code --install-extension pgtidy-0.1.0.vsix
```
## Settings
| Setting | Default | Description |
|---|---|---|
| `pgtidy.path` | `"pgtidy"` | Path to the binary if not on `PATH` |
| `pgtidy.enable` | `true` | Enable/disable the language server |
## Features
- **Format on save** — configure via VSCode's `editor.formatOnSave`
- **Diagnostics** — lint findings shown inline as you type (MIG001MIG003, COR001003, NAM001003)
- **Quick fixes** — lightbulb actions for MIG001 (add `CONCURRENTLY`) and MIG003 (add `NOT VALID`)
`.sql` and `.pgsql` files are both handled.
## Troubleshooting
**No formatting / diagnostics:** Open the Output panel → select **PgTidy** to see server errors. Most common cause: `pgtidy` not found — set `pgtidy.path` to the full binary path.