A Language Server Protocol (LSP) implementation for PostgreSQL and PL/pgSQL, built with tree-sitter-postgres and tower-lsp.
- 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
- Folding Ranges — Collapse multi-line statements
- Rename — Rename symbols across the workspace
- PL/pgSQL Support — Parses PL/pgSQL function bodies with language injection
cargo buildRequires the tree-sitter-postgres repository cloned as a sibling directory (../tree-sitter-postgres).
The server communicates over stdio:
cargo run -p pg-lspConfigure your editor to use pg-lsp as the language server for .sql files.
BSD-3-Clause