Skip to main content

Module frame

Module frame 

Source
Expand description

JSONL and LSP Content-Length framing on one stream.

Enums§

FrameError
A framing read that cannot produce a body.
Framing
How the peer framed the last message. Replies use the same style.

Constants§

MAX_HEADER_LINES
Hard cap on LSP header lines.
MAX_MESSAGE_BYTES
Hard cap on one JSON-RPC body.

Functions§

classify_first_line
Classify the first line the way read_message does.
is_header_line
First-line rule: ^[A-Za-z][A-Za-z0-9-]*: is headers. Anything else, including a non-{ JSONL body, is JSONL.
read_message
Read one framed body. The returned Framing is what the reply must use.
write_message
Write payload using framing. Does not append a second newline to JSON.