tinymist/crates/sync-lsp
ParaN3xus b239224a63
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
feat: add js package registry support for tinymist-wasm (#2102)
Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
2025-10-01 16:40:21 +08:00
..
src feat: add js package registry support for tinymist-wasm (#2102) 2025-10-01 16:40:21 +08:00
Cargo.toml feat: add js transport to sync-ls (#2029) 2025-08-12 06:07:23 +08:00
README.md feat: implements dap-server scaffold (#1517) 2025-03-17 09:33:59 +08:00

sync-ls

Sync LSP server inspired by async-lsp, primarily for tinymist. The author of this crate thinks that async-lsp is better than sync-ls, so please use async-lsp whenever possible unless you have a good reason to use sync-ls. Some random points:

  • The req_queue and transport are extracted from the rust-analyzer project.
  • The sync-ls should have better performance on stdio transport than async-lsp, especially on windows, but the author have forgotten the idea.
  • The sync-ls handlers can get a mutable reference to the state, which is not possible in tower-lsp.
  • The sync-ls supports both LSP and DAP with a common codebase.

Debugging with input mirroring

You can record the input during running the editors with binary. You can then replay the input to debug the language server.

# Record the input
your-ls --mirror input.txt
# Replay the input
your-ls --replay input.txt

This is much more useful when devloping a dap server.

Usage

Starts a LSP server with stdio transport:

with_stdio_transport::<LspMessage>(args.mirror.clone(), |conn| {
    let client = LspClientRoot::new(tokio_handle, conn.sender);
    LspBuilder::new(args, client.weak())
        // Adds request handlers
        .with_request::<Shutdown>(State::shutdown)
        // Adds event handlers
        .with_event(&LspInterrupt::Settle, State::interrupt)
        .build()
        .start(conn.receiver, is_replay)
})?;