WIP: Asynchronous Language Server Protocol framework

Related tags

IDEs async-lsp
Overview

async-lsp

crates.io docs.rs CI Status

Asynchronous Language Server Protocol (LSP) framework based on tower.

⚠️ This project serves as a proof-of-concept for LSP with middlewares and is in early development stage. It may not be production ready yet.

Overview

This crate is centered at trait LspService which mainly consists of a tower Service of LSP requests and a handler of LSP notifications.

As protocol defines, requests can be processed concurrently (asynchronously), while notifications must be processed in order (synchronously), changing states and affecting semantics of later requests and/or notifications.

Request handling is designed in a decoupled manner with tower-layer, so you can chain multiple request processing layer (aka. middleware) to build complex a service.

Despite the name of LspService, it can be used to build both Language Server and Language Client. They are logically symmetric and both using duplex channels. The only difference is the kind of requests and notifications they support.

Usage

See documentations (TODO) and examples.

Similar projects

tower-lsp

async-lsp is heavily inspired by tower-lsp, we are both built on tower but have major design differences.

  1. tower-lsp is less flexible and hard to use with tower ecosystem. It doesn't support custom tower Layer since the Service interface is builtin. Both server lifecycle handling and concurrency logic is built-in and is hard to opt-opt or customize.

    async-lsp uses tower Layer to implement server lifecycle, concurrency, tracing and more. Users can select and compose layers, or creating custom ones.

  2. tower-lsp handles notifications asynchronously, which is semantically incorrect and introduces out-of-order issues.

    async-lsp executes notification handlers synchronously, and allows it to control main loop when, it needs to exit or something goes wrong.

  3. tower-lsp's trait LanguageServer accepts immutable state &self for concurrency. Thus state changing notifications like textDocument/didChange always requires asynchronous locks, regarding that the underlying communication channel is synchronous anyway.

    async-lsp accepts &mut self for requests and notifications, and the former returns a Future without borrowing self. Requests borrows only immutable states and can be run concurrently, while still being able to mutate state (like snapshotting) during preparation.

  4. tower-lsp provides some higher level abstractions over LSP specification to make it more ergonomic, like generic Client::show_message, simplified LanguageServer::shutdown, or planned Progress-API.

    While this is not a goal of async-lsp. By default we doesn't do more than serialization, deserialization and request/response id handling. Parameters and interface follows the lsp-types' Request and Notification traits. But you are still free to implement your custom Requests for extension, or custom middlewares for higher level API.

  5. tower-lsp is specialized for building Language Servers.

    async-lsp can be used for both Language Servers and Clients.

lsp-server

lsp-server is a simple and synchronous framework for only Language Server. You need spawning tasks and managing ongoing requests/responses manually.

License

async-lsp is distributed under the terms of either the MIT or the Apache 2.0 license, at your option. See LICENSE-MIT and LICENSE-APACHE for details.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
Experimental treesiter based language server, let's see how far this goes 😆.

tsls Tree-sitter based language server for general languages. Warning: It's in active development right now, and bug is expected. Features Go To Defin

A brand-new language server for Typst, plus a VS Code extension

Typst LSP A brand-new language server for Typst. Features Syntax highlighting, error reporting, code completion, and function signature help Compiles

Rust language support in Atom - LOOKING FOR MAINTAINER, see #144

Rust language support in Atom Adds syntax highlighting and snippets to Rust files in Atom. Install Install the package language-rust in Atom (Preferen

RustDT is an Eclipse based IDE for the Rust programming language:
RustDT is an Eclipse based IDE for the Rust programming language:

Project website: http://rustdt.github.io/ As of 2017, RustDT is no longer actively maintained, see this blog post for more information. If you are int

The official Sublime Text 3 package for the Rust Programming Language
The official Sublime Text 3 package for the Rust Programming Language

Rust Enhanced About This is a Sublime Text 3 package which supports Rust starting with version 1.0, it makes no attempt at supporting earlier incompat

rust-analyzer is a modular compiler frontend for the Rust language
rust-analyzer is a modular compiler frontend for the Rust language

rust-analyzer is a modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.

prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage.
prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage.

prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage. Project Status We currently support the

AIDL Language Server Protocol (LSP) server

AIDL Language Server Protocol (LSP) server Experimental AIDL LSP server based on rust-aidl-parser. Features: diagnostics workspace symbols (Ctrl+T in

A LSP (Language Server Protocol) server for OpenSCAD.

openscad-LSP A LSP (Language Server Protocol) server for OpenSCAD. inspired by dzhu/openscad-language-server Tested with VSCode on Mac and Windows. Te

impl LSP (Language Server Protocol) Server for librime

rime-ls 为 rime 输入法核心库 librime (的部分功能) 实现 LSP 协议, 从而通过编辑器的代码补全功能输入汉字. 项目还处在早期阶段, 各方面都非常不成熟. 目标是提供 rime + LSP 的通用解决方案, 在不同编辑器内实现与其他 rime 前端类似的输入体验. Feat

Ratchet is a fast, robust, lightweight and fully asynchronous implementation of RFC6455 (The WebSocket protocol).

Ratchet 🚧 Ratchet is a fast, robust, lightweight and fully asynchronous implementation of RFC6455 (The WebSocket protocol). Complete with an optional

Protocol for Asynchronous, Reliable, Secure and Efficient Consensus

PARSEC - Protocol for Asynchronous, Reliable, Secure and Efficient Consensus Crate Documentation Linux/macOS Windows Issues MaidSafe website SAFE Dev

This is the core library with the full abstraction and implementation of the Minecraft protocol and logic. (Currently WIP)

MineRust (WIP) This is the core library with the full abstraction and implementation of the Minecraft protocol and logic. This project is currently WI

Hitbox is an asynchronous caching framework supporting multiple backends and suitable for distributed and for single-machine applications.

Hitbox is an asynchronous caching framework supporting multiple backends and suitable for distributed and for single-machine applications.

High-performance asynchronous computation framework for system simulation

Asynchronix A high-performance asynchronous computation framework for system simulation. What is this? Warning: this page is at the moment mostly addr

Kakoune Language Server Protocol Client

Kakoune Language Server Protocol Client kak-lsp is a Language Server Protocol client for Kakoune implemented in Rust. Installation Note kak-lsp.toml d

Language Server Protocol (LSP) support for vim and neovim.
Language Server Protocol (LSP) support for vim and neovim.

For legacy python implementation, see branch master. LanguageClient-neovim Language Server Protocol support for vim and neovim. More recordings at Upd

Fennel language server protocol (LSP) support.

fennel-language-server Fennel language server protocol (LSP) support. fennel-language-server is currently in a very early stage and unreliable. Use it

IDE tools for writing pest grammars, using the Language Server Protocol for Visual Studio Code, Vim and other editors

Pest IDE Tools IDE support for Pest, via the LSP. This repository contains an implementation of the Language Server Protocol in Rust, for the Pest par

Owner
null
A LSP (Language Server Protocol) server for OpenSCAD.

openscad-LSP A LSP (Language Server Protocol) server for OpenSCAD. inspired by dzhu/openscad-language-server Tested with VSCode on Mac and Windows. Te

Leathong 20 Dec 15, 2022
impl LSP (Language Server Protocol) Server for librime

rime-ls 为 rime 输入法核心库 librime (的部分功能) 实现 LSP 协议, 从而通过编辑器的代码补全功能输入汉字. 项目还处在早期阶段, 各方面都非常不成熟. 目标是提供 rime + LSP 的通用解决方案, 在不同编辑器内实现与其他 rime 前端类似的输入体验. Feat

zilch40 55 Jan 22, 2023
Kakoune Language Server Protocol Client

Kakoune Language Server Protocol Client kak-lsp is a Language Server Protocol client for Kakoune implemented in Rust. Installation Note kak-lsp.toml d

null 495 Dec 17, 2022
Language Server Protocol (LSP) support for vim and neovim.

For legacy python implementation, see branch master. LanguageClient-neovim Language Server Protocol support for vim and neovim. More recordings at Upd

Junfeng Li 3.5k Dec 29, 2022
Fennel language server protocol (LSP) support.

fennel-language-server Fennel language server protocol (LSP) support. fennel-language-server is currently in a very early stage and unreliable. Use it

null 68 Dec 27, 2022
IDE tools for writing pest grammars, using the Language Server Protocol for Visual Studio Code, Vim and other editors

Pest IDE Tools IDE support for Pest, via the LSP. This repository contains an implementation of the Language Server Protocol in Rust, for the Pest par

pest 20 Apr 8, 2023
crispmacs is a WIP implementation of Emacs from scratch in Rust.

crispmacs is a WIP implementation of Emacs from scratch in Rust.

rust 3 Jul 31, 2022
Rust IDE support for Atom, powered by the Rust Language Server (RLS)

IDE-Rust Rust language support for Atom-IDE, powered by rust-analyzer. Features Auto-completion Diagnostics (errors and warnings from rustc) Document

The Rust Programming Language 239 Dec 14, 2022
An experimental proofreading and linting language server for markdown files ✍️

prosemd is an experimental proofreading and linting language server for markdown files. It aims to provide helpful and smart diagnostics when writing

Phil Pluckthun 132 Dec 14, 2022
Repository for the Rust Language Server (aka RLS)

Rust Language Server (RLS) The RLS provides a server that runs in the background, providing IDEs, editors, and other tools with information about Rust

The Rust Programming Language 3.6k Dec 30, 2022