Skip to content

toba/sqlite-lsp

Repository files navigation

sqlite-lsp

A Language Server Protocol implementation for SQLite — so your editor can tell you about your broken SQL before you find out the hard way.

Uses modernc.org/sqlite (a pure-Go SQLite) as the parser, which means validation comes from SQLite's own Prepare — not a third-party grammar that kinda-sorta matches. If SQLite would reject it, so will this.

Features

  • Syntax validation via SQLite's actual parser — catches errors at the statement level, with line and column positions
  • Schema-aware validation — point it at a .db file and get diagnostics for missing tables, nonexistent columns, type mismatches
  • Multi-statement support — handles semicolons in strings, comments, and other places that trip up naïve splitters
  • Cross-platform — builds for macOS, Linux, and Windows on amd64 and arm64

Install

Homebrew (macOS)

brew install toba/tap/sqlite-lsp

Scoop (Windows)

scoop bucket add toba https://github.com/toba/scoop-bucket
scoop install sqlite-lsp

From source

go install github.com/toba/sqlite-lsp/cmd/sqlite-lsp@latest

Binary releases

Grab a binary from Releases.

Editor Integration

Zed

Install the sqlite-lsp extension from the Extensions panel — search for "sqlite-lsp" and click Install.

How It Works

The server spins up an in-memory SQLite database and runs Prepare against each statement. Syntax errors come back with the token that SQLite choked on and its position in your source. For schema validation, it opens your database file read-only and does the same thing — so you get real "no such table" and "no such column" errors, not guesses.

Statement splitting handles the usual hazards: semicolons inside string literals, line comments, block comments, escaped quotes. It's not a full tokenizer, but it covers the cases that actually come up.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages