postgres-lsp-1.3.0 is not a library.
postgres-lsp
A Language Server Protocol (LSP) implementation for PostgreSQL and PL/pgSQL, built with tree-sitter-postgres and tower-lsp.
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 one of several style guides
- PL/pgSQL Support — Parses PL/pgSQL function bodies with language injection
Installation
Homebrew (macOS / Linux)
[!NOTE] Homebrew 6.0 added tap trust, and some versions fail to install third-party taps inside the build sandbox (the error mentions
build.rb ... exited with 1). If you hit this, trust the formula first:or, as a temporary workaround, set
HOMEBREW_NO_REQUIRE_TAP_TRUST=1for the install.
From Source (via Cargo)
Building
Requires the tree-sitter-postgres repository cloned as a sibling directory (../tree-sitter-postgres).
Usage
The server communicates over stdio:
Configure your editor to use postgres-lsp as the language server for .sql files.
License
BSD-3-Clause