JSON-RPC framing and dispatch
Content-Length framing, request and notification handling, and a handler map keyed by method name. A language module registers the methods it answers and ignores the rest.
A language-agnostic adapter for building language servers in Go. It handles JSON-RPC framing, sessions and LSP position mapping, and knows nothing about any particular language. The core packages are standard-library only, enforced by a test.
Framing, sessions and positions are standard library only, so an LSP binary does not inherit a WebSocket stack. A test enforces it.
LSP counts characters in code units and Go counts bytes. Counting runes is as wrong as counting bytes, it just fails later.
How an editor launches a server, and how a browser reaches one, behind the same handler map.
The parts every language server repeats. You supply the functions and it supplies the protocol.
Content-Length framing, request and notification handling, and a handler map keyed by method name. A language module registers the methods it answers and ignores the rest.
Open documents, their versions and their content are held per session, so a handler is given the text it is being asked about instead of reading from disk and hoping.
Offset and position conversion that is correct for accented characters, CJK and emoji. A rune above the Basic Multilingual Plane is one rune, up to four bytes and two code units, and counting either of the wrong two produces an off-by-some that only appears in somebody else’s language.
stdio is how editors launch a server. WebSocket is how a browser reaches one. They are separate packages so the dependency the second needs is not paid for by the first.
Nothing in the adapter is aware of a grammar, a type system or a symbol table. DQL uses it to ship an editor experience, and so could anything else with functions to call.
JSON-RPC framing, sessions and handler dispatch. No dependencies.
Positions and ranges, including the UTF-16 arithmetic. No dependencies.
The binding editors use to launch a server. No dependencies.
The WebSocket binding, and the only package that costs a dependency.
A language-agnostic adapter for building language servers in Go. It handles JSON-RPC framing, sessions and LSP position mapping, and knows nothing about any particular language. The core packages are standard-library only, enforced by a test.
Shipping something on langserver? Nobody is listed here yet. Tell me what you built and you will be the first.
Get listed →