All Projects → ebkalderon → tower-lsp

ebkalderon / tower-lsp

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Language Server Protocol implementation written in Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to tower-lsp

Lsp
Client implementation of the Language Server Protocol for Sublime Text
Stars: ✭ 1,018 (+123.74%)
Mutual labels:  language-server-protocol, lsp
Elm Language Client Vscode
Improving your Elm experience since 2019
Stars: ✭ 162 (-64.4%)
Mutual labels:  language-server-protocol, lsp
Protocol Buffers Language Server
[WIP] Protocol Buffers Language Server
Stars: ✭ 44 (-90.33%)
Mutual labels:  language-server-protocol, lsp
Monaco Languageclient
NPM module to connect Monaco editor with language servers
Stars: ✭ 419 (-7.91%)
Mutual labels:  language-server-protocol, lsp
Haskell Ide Engine
The engine for haskell ide-integration. Not an IDE
Stars: ✭ 2,433 (+434.73%)
Mutual labels:  language-server-protocol, lsp
Typescript Language Server
TypeScript & JavaScript Language Server
Stars: ✭ 462 (+1.54%)
Mutual labels:  language-server-protocol, lsp
Nvim Lspconfig
Quickstart configurations for the Nvim LSP client
Stars: ✭ 3,410 (+649.45%)
Mutual labels:  language-server-protocol, lsp
Kak Lsp
Kakoune Language Server Protocol Client
Stars: ✭ 363 (-20.22%)
Mutual labels:  language-server-protocol, lsp
Cquery
C/C++ language server supporting multi-million line code base, powered by libclang. Emacs, Vim, VSCode, and others with language server protocol support. Cross references, completion, diagnostics, semantic highlighting and more
Stars: ✭ 2,338 (+413.85%)
Mutual labels:  language-server-protocol, lsp
Fsautocomplete
F# language server using Language Server Protocol
Stars: ✭ 208 (-54.29%)
Mutual labels:  language-server-protocol, lsp
groovy-language-server
A language server for Groovy
Stars: ✭ 132 (-70.99%)
Mutual labels:  language-server-protocol, lsp
lsp-test
A functional test framework for LSP servers
Stars: ✭ 35 (-92.31%)
Mutual labels:  language-server-protocol, lsp
Atom Languageclient
Language Server Protocol support for Atom (the basis of Atom-IDE)
Stars: ✭ 385 (-15.38%)
Mutual labels:  language-server-protocol, lsp
Jupyterlab Lsp
Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
Stars: ✭ 796 (+74.95%)
Mutual labels:  language-server-protocol, lsp
Erlang ls
The Erlang Language Server
Stars: ✭ 363 (-20.22%)
Mutual labels:  language-server-protocol, lsp
Glsl Language Server
Language server implementation for GLSL
Stars: ✭ 53 (-88.35%)
Mutual labels:  language-server-protocol, lsp
camel-language-server
The Apache Camel LSP server implementation
Stars: ✭ 31 (-93.19%)
Mutual labels:  language-server-protocol, lsp
Elm Language Server
Language server implementation for Elm
Stars: ✭ 298 (-34.51%)
Mutual labels:  language-server-protocol, lsp
Dockerfile Language Server Nodejs
A language server for Dockerfiles powered by Node.js, TypeScript, and VSCode technologies.
Stars: ✭ 170 (-62.64%)
Mutual labels:  language-server-protocol, lsp
Csharp Language Server Protocol
Language Server Protocol in C#
Stars: ✭ 230 (-49.45%)
Mutual labels:  language-server-protocol, lsp

tower-lsp

Build Status Crates.io Documentation

Language Server Protocol implementation for Rust based on Tower.

Tower is a simple and composable framework for implementing asynchronous services in Rust. Central to Tower is the Service trait, which provides the necessary abstractions for defining request/response clients and servers. Examples of protocols implemented using the Service trait include hyper for HTTP and tonic for gRPC.

This library (tower-lsp) provides a simple implementation of the Language Server Protocol (LSP) that makes it easy to write your own language server. It consists of three parts:

  • The LanguageServer trait which defines the behavior of your language server.
  • The asynchronous LspService delegate which wraps your language server implementation and defines the behavior of the protocol.
  • A Server which spawns the LspService and processes requests and responses over stdio or TCP.

Example

use tower_lsp::jsonrpc::Result;
use tower_lsp::lsp_types::*;
use tower_lsp::{Client, LanguageServer, LspService, Server};

#[derive(Debug)]
struct Backend {
    client: Client,
}

#[tower_lsp::async_trait]
impl LanguageServer for Backend {
    async fn initialize(&self, _: InitializeParams) -> Result<InitializeResult> {
        Ok(InitializeResult::default())
    }

    async fn initialized(&self, _: InitializedParams) {
        self.client
            .log_message(MessageType::INFO, "server initialized!")
            .await;
    }

    async fn shutdown(&self) -> Result<()> {
        Ok(())
    }
}

#[tokio::main]
async fn main() {
    let stdin = tokio::io::stdin();
    let stdout = tokio::io::stdout();

    let (service, socket) = LspService::new(|client| Backend { client });
    Server::new(stdin, stdout, socket).serve(service).await;
}

Using runtimes other than tokio

By default, tower-lsp is configured for use with tokio.

Using tower-lsp with other runtimes requires disabling default-features and enabling the runtime-agnostic feature:

[dependencies.tower-lsp]
version = "*"
default-features = false
features = ["runtime-agnostic"]

Using proposed features

You can use enable proposed features in the LSP Specification version 3.17 by enabling the proposed Cargo crate feature. Note that there are no semver guarantees to the proposed features so there may be breaking changes between any type of version in the proposed features.

Ecosystem

  • tower-lsp-boilerplate - Useful GitHub project template which makes writing new language servers easier.

License

tower-lsp is free and open source software distributed under the terms of either the MIT or the Apache 2.0 license, at your option.

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].