pub fn run_main_loop(
receiver: Receiver<Message>,
sender: Sender<Message>,
journal_file: Option<PathBuf>,
position_encoding: PositionEncoding,
) -> i32Expand description
Run the main event loop.
Uses crossbeam_channel::select! to multiplex between incoming LSP
messages and results from background task threads, keeping the main
loop responsive while expensive requests run in parallel.
§Arguments
receiver- Channel to receive LSP messages from the clientsender- Channel to send LSP messages to the clientjournal_file- Optional path to the root journal file for multi-file support
§Returns
The exit code from the exit notification (after the loop breaks
cleanly), or 0 if the channel was closed before an exit
notification arrived. The caller is expected to drain any IO
threads (e.g., lsp_server::Connection::stdio()’s
io_threads.join()) AFTER this returns and BEFORE terminating the
process - otherwise the shutdown response queued in the writer
thread’s channel never reaches the client, which is the bug behind
the stdio_smoke CI flake.