Skip to main content

Module jsonrpc

Module jsonrpc 

Source
Expand description

JSON-RPC 2.0, and the two ways it arrives on stdin.

LSP and MCP are the same protocol. Both are JSON-RPC 2.0 over stdio; they differ in how a message is delimited and in which methods exist. That is why this module is shared rather than duplicated per protocol — the parts that differ are Framing and the dispatch table, and nothing else.

Written by hand because tokio is denied outright by deny.toml, which rules out every async LSP crate. That constraint turned out to be the right shape anyway: a language server that reads a message, answers it, and reads the next one has no use for an executor, and §13’s “minimal dependency surface” is easier to hold with none.

Modules§

codes
The codes this server uses, from the JSON-RPC 2.0 specification.

Structs§

ErrorObject
A JSON-RPC error.
Incoming
A request or notification arriving from the client.
Outgoing
A reply, successful or not.

Enums§

Framing
How messages are delimited on the wire.

Functions§

read
Read one message, or None at end of input.
write
Write one message.