Crate tokio_lsp

Crate tokio_lsp 

Source
Expand description

§tokio-lsp

A Language Server Protocol (LSP) client implementation in Rust.

This crate provides a lightweight, async-first LSP client that can be integrated into text editors and IDEs. It implements the LSP 3.16 specification and focuses on providing a clean, safe API for communicating with language servers.

§Features

  • Full LSP 3.16 specification support
  • Async/await interface using tokio
  • Type-safe message handling with serde
  • Comprehensive error handling
  • Transport layer abstraction

§Example

use tokio_lsp::Client;
use tokio::process::{ChildStdin, ChildStdout};
use std::io::Cursor;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Example using mock streams
    let reader = Cursor::new(vec![]);
    let writer = Cursor::new(Vec::new());
    let client = Client::new(reader, writer);
    // In real usage, you'd connect to a language server process
    // and use its stdin/stdout for reader/writer
    Ok(())
}

Re-exports§

pub use client::Client;
pub use error::LspError;
pub use error::Result;

Modules§

client
The main LSP client implementation.
error
Error types for the LSP client.
prelude
Re-export commonly used types
transport
Transport layer for the Language Server Protocol.
types
Core types for the Language Server Protocol.