How do editor and server exchange messages without blocking UI?
Per Wikipedia: “LSP transport uses JSON-RPC over stdio or TCP with Content-Length headers to send requests, responses and notifications.”
Like passing notes with envelope size on front — length header tells reader where note ends.
- Client encodes JSON-RPC with header
- Writes to server stdin
- Server reads Content-Length
- Server decodes and dispatches
- Server replies same way
- Stdio default in neovim
- TCP alternative for remote
- Header-based framing avoids delimiter issues
Content-Length: 123\r\n\r\n{"jsonrpc":"2.0",...}- Built from: Language Server Protocol — protocol needs transport
- Related: LSP Server — server uses transport
- Related: LSP Client — client uses transport
- Contrasts with: LSP Events — events ride on transport
- Mixing stdout logs with transport corrupts stream
- Forgetting \r\n header causes hang