Language Server Protocol frontend for sqlshield. Emits
schema-aware SQL diagnostics for embedded queries in .py, .rs, .go,
.js, .ts, and .tsx files as well as plain .sql files. Every
editor that speaks LSP (VS Code, Neovim, Helix, Emacs, Zed, …) can show
squiggles on the offending SQL string.
Status: experimental — full-document sync, diagnostics only. No completion, hover, or code actions yet.
cargo install --path sqlshield-lsp
# or from the workspace root:
cargo build --release --bin sqlshield-lspThe server walks up from the workspace root looking for a
.sqlshield.toml file. Relative paths
inside it are resolved against the file's directory.
# .sqlshield.toml
schema = "db/schema.sql"
dialect = "postgres"Without a config file the server still runs, but with an empty schema it can only flag SQL parse errors — missing-table/column diagnostics rely on the schema being loaded.
local configs = require("lspconfig.configs")
if not configs.sqlshield_lsp then
configs.sqlshield_lsp = {
default_config = {
cmd = { "sqlshield-lsp" },
filetypes = {
"python", "rust", "go", "javascript",
"typescript", "typescriptreact", "sql",
},
root_dir = require("lspconfig.util").root_pattern(".sqlshield.toml", ".git"),
settings = {},
},
}
end
require("lspconfig").sqlshield_lsp.setup({})A first-party VS Code extension lives at
editors/vscode/. It spawns
sqlshield-lsp over stdio and forwards diagnostics to the editor as you
type. Set sqlshield.serverPath if the binary isn't on PATH.
Set RUST_LOG=sqlshield_lsp=debug to get chatty stderr logs from the
server. Logs go to stderr so they don't interfere with the stdio JSON-RPC
transport.