Built on [tree-sitter-postgres](https://github.com/gmr/tree-sitter-postgres), 
[postgres-lsp](https://github.com/gmr/postgres-lsp) implements the [Language 
Server Protocol](https://en.wikipedia.org/wiki/Language_Server_Protocol) for 
PostgreSQL SQL and PL/pgSQL. Point your editor at it for `.sql` files and get 
diagnostics, navigation, completion, and formatting backed by real PostgreSQL 
grammar rather than regex heuristics.

## Features

- **Diagnostics** — Parse errors from tree-sitter reported as LSP diagnostics
- **Semantic Tokens** — Syntax highlighting via semantic token classification
- **Document Symbols** — Outline of DDL statements (tables, functions, views, 
etc.)
- **Workspace Symbols** — Search across all open files
- **Go to Definition** — Navigate to table, function, type, and column 
definitions
- **Find References** — Find all usages of a symbol across the workspace
- **Hover** — Show definition source on hover
- **Completion** — Context-aware completion for keywords, tables, columns, and 
functions
- **Signature Help** — Parameter hints for function calls
- **Folding Ranges** — Collapse multi-line statements
- **Rename** — Rename symbols across the workspace
- **Code Actions** — Quick fixes and refactor rewrites
- **Formatting** — Reformat SQL using the styles supported by 
[libpgfmt](https://github.com/gmr/libpgfmt): river, mozilla, aweber, dbt, 
gitlab, kickstarter, mattmc3, pg_dump
- **PL/pgSQL Support** — Parses PL/pgSQL function bodies with language injection

Binaries and Installation instructions are available @ 
[https://github.com/gmr/postgres-lsp](https://github.com/gmr/postgres-lsp).

Reply via email to