LSP multiplexer daemon for sharing language server instances across multiple editors.
This project is Bun/TypeScript-based (it previously had a Rust implementation, which has been removed).
If you open multiple editor instances on the same project (multiple Neovim windows, OpenCode + Neovim, etc.), each client usually spawns its own language server process. For heavier servers like tsgo, this can waste a lot of CPU and memory.
lspd sits between your editor(s) and the language server. It runs a single server process per (projectRoot, serverName) pair and multiplexes multiple editor clients to it.
- Shared LSP instances (one per project + server)
- Automatic lifecycle (daemon starts on first connection; exits after last client disconnects)
- Binary discovery (prefers
node_modules/.bin, with env overrides) - Request id translation (prevents collisions across multiple clients)
- Diagnostics bridging for mixed clients
- If a client doesn’t support pull diagnostics (
textDocument/diagnostic), the mux bridges pull->push usingtextDocument/publishDiagnostics.
- If a client doesn’t support pull diagnostics (
This package requires bun to be installed (the CLI is a small Node wrapper that spawns Bun).
npm install -g lspd
# or
bun add -g lspdlspd connect tsgo --project /path/to/project
lspd connect oxlint --project /path/to/projectlspd ps
lspd ps --json
lspd kill tsgo --project /path/to/project
lspd kill --all
lspd pruneYour editor should start lspd connect <server> and speak LSP over stdin/stdout.
-- instead of: cmd = { "tsgo", "--lsp", "-stdio" }
cmd = { "lspd", "connect", "tsgo", "--project", vim.loop.cwd() }Environment variables:
LSPD_TSGO_BIN=/absolute/path/to/tsgoLSPD_OXLINT_BIN=/absolute/path/to/oxlint
lspd connect <server>ensures a per-project daemon is running.- The daemon listens on a Unix domain socket under:
~/.cache/lspd/daemons/<id>/daemon.sock
- All connected clients are multiplexed into a single server process, with request/response routing handled via translated ids.
bun testNotes:
- The smoke tests use
test-fixtures/projand will runbun installthere as needed. - The
tsgosmoke test may buildtsgofrom source if the prebuilt binary hangs, which requiresgit,go, and network access.
MIT (see LICENSE).