Skip to main content

Module transport

Module transport 

Source
Expand description

Child-process transport for an LSP server.

Spawns the configured server binary, captures its stdio, and exposes split LspReader / LspWriter halves so the actor can run read_loop and write_loop on independent tokio tasks (the canonical full-duplex pattern).

§Cross-platform process discovery

tokio::process::Command::new(name) consults the host’s PATH (and on Windows applies the standard .exe suffix search). The transport does no manual PATH walking; if a server binary cannot be found, the error returned from spawn carries the OS-level reason verbatim.

§stderr capture

LSP servers log to stderr. We pipe stderr into a background task that emits each line through tracing::warn! with a server_id field so users can debug a misbehaving server without seeing its noise on the terminal. The stderr task ends naturally when the server closes the pipe.

§Lifecycle

ChildTransport owns the Child handle. Dropping the transport closes stdin (signalling shutdown to the server in the LSP protocol) but does NOT kill the process – the actor is responsible for sending the shutdown/exit LSP sequence and awaiting graceful exit. Use ChildTransport::kill to force-terminate from a Drop implementation in the actor’s supervision layer.

Structs§

ChildTransport
One spawned LSP server process and its split codec halves.

Enums§

TransportError
Spawn errors and lifecycle errors for the transport.