Skip to main content

Crate perl_lsp_transport

Crate perl_lsp_transport 

Source
Expand description

LSP transport layer for perl-lsp.

This crate provides the transport layer implementation for the Perl Language Server, handling message framing according to the LSP Base Protocol specification.

§Overview

The LSP Base Protocol uses Content-Length based message framing over stdio (or other transports). This crate provides:

§Example

use std::io::{BufReader, stdin, stdout};
use perl_lsp_transport::{read_message, write_message};
use perl_lsp_protocol::JsonRpcResponse;

let mut reader = BufReader::new(stdin());
let mut writer = stdout();

// Read an incoming message
if let Ok(Some(request)) = read_message(&mut reader) {
    // Process request and create response
    let response = JsonRpcResponse::null(request.id);

    // Write the response
    write_message(&mut writer, &response)?;
}

Structs§

ContentLengthMessageReader
Stateful reader for Content-Length framed JSON-RPC requests.

Functions§

frame
Build a full Content-Length framed message from a payload body.
log_response
Log outgoing response metadata for transport debugging.
read_message
Read an LSP message from a buffered reader.
write_message
Write an LSP response with Content-Length framing.
write_notification
Write an LSP notification with Content-Length framing.