langserver
1.x
Docs/langserver/Introduction
Open

Reading1 min
Updated2 Aug 2026
Sourcev1/index.mdx

langserver

A small, language-agnostic adapter for building language servers in Go.

It handles the parts every language server repeats, namely JSON-RPC framing, sessions and LSP position mapping, and knows nothing about any particular language. You supply functions; it supplies the protocol.

handlers := map[string]langserver.Handler{
	"textDocument/completion": func(s langserver.Session, params json.RawMessage) (any, *langserver.RPCError) {
		// call your language's completion function
	},
}

Install01

go get github.com/xraph/langserver

Packages02

PackagePurposeDependencies
langserverJSON-RPC framing, sessions, handler dispatchnone
langserver/lspLSP positions and rangesnone
langserver/stdiostdio binding, how editors launch a servernone
langserver/wsWebSocket bindinggorilla/websocket
Note

A language module can depend on the core packages to ship an LSP binary without inheriting a WebSocket stack. That is enforced by a test, not by a convention nobody checks.

Who uses it03

DQL ships dql-lsp on this adapter. Anything with functions to call can do the same.

Next04