pgxls: PostgreSQL Language Server
An implementation of the Language Server Protocol for PostgreSQL.
Note
This project is a fork of sqls, refactored to be exclusively PostgreSQL-specific.
Features
pgxls aims to provide advanced intelligence for you to edit PostgreSQL SQL in your own editor.
Support RDBMS
Language Server Features
Auto Completion
- DML(Data Manipulation Language)
- SELECT
- INSERT
- UPDATE
- DELETE
- DDL(Data Definition Language)
Join completion
If the tables are connected with a foreign key pgxls can complete JOIN statements
CodeAction
- Execute SQL
- Explain SQL
- Switch Connection(Selected Database Connection)
- Switch Database
Hover
Signature Help
Installation
go install github.com/sqls-server/sqls@latest
Editor Plugins
DB Configuration
The connection to the PostgreSQL is essential to take advantage of the functionality provided by pgxls.
Configuration Methods
- Configuration file specified by the
-config flag
workspace/configuration set to LSP client
- Configuration file located in the following location
$XDG_CONFIG_HOME/sqls/config.yml ("$HOME/.config" is used instead of $XDG_CONFIG_HOME if it's not set)
Configuration file sample
# Set to true to use lowercase keywords instead of uppercase.
lowercaseKeywords: false
connections:
- alias: local_postgres
driver: postgresql
user: postgres
passwd: mysecretpassword1234
host: 127.0.0.1
port: 5432
dbName: dvdrental
params:
sslmode: disable
Workspace configuration Sample
- setting example with nvim-lspconfig.
require'lspconfig'.sqls.setup{
settings = {
sqls = {
connections = {
{
driver = 'postgresql',
dataSourceName = 'host=127.0.0.1 port=15432 user=postgres password=mysecretpassword1234 dbname=dvdrental sslmode=disable',
},
},
},
},
}
Contributors
This project exists thanks to all the people who contribute to the original sqls project.
Inspired
I created sqls inspired by the following OSS.