Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/latex-lsp/language-server
A library to implement language servers in Rust.
https://github.com/latex-lsp/language-server
language-server-protocol rust
Last synced: 14 days ago
JSON representation
A library to implement language servers in Rust.
- Host: GitHub
- URL: https://github.com/latex-lsp/language-server
- Owner: latex-lsp
- License: mit
- Created: 2020-05-05T12:37:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-23T05:58:16.000Z (over 3 years ago)
- Last Synced: 2023-03-02T15:56:52.346Z (over 1 year ago)
- Topics: language-server-protocol, rust
- Language: Rust
- Homepage:
- Size: 86.9 KB
- Stars: 18
- Watchers: 3
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![CI](https://github.com/latex-lsp/language-server/workflows/CI/badge.svg)](https://github.com/latex-lsp/language-server/actions)
[![Coverage](https://codecov.io/gh/latex-lsp/language-server/branch/master/graph/badge.svg)](https://codecov.io/gh/latex-lsp/language-server)
[![Rust](https://img.shields.io/badge/rustc-1.39%2B-blue)](https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html)
[![LSP](https://img.shields.io/badge/lsp-3.15-blue)](https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/)
[![Dependabot](https://api.dependabot.com/badges/status?host=github&repo=latex-lsp/language-server)](https://dependabot.com)
[![crates.io](https://img.shields.io/crates/v/language-server)](https://crates.io/crates/language-server)
[![docs.rs](https://docs.rs/language-server/badge.svg)](https://docs.rs/language-server)# language-server
A library to implement asynchronous language servers in Rust. It features
- Full server and client support of the
[Language Server Protocol 3.15](https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/).
- Independent of the underlying transport layer and the used async executor.## Example
A simple language server using the [Tokio](https://tokio.rs/) runtime:
```rust
use async_executors::TokioTp;
use language_server::{async_trait::async_trait, types::*, *};
use std::{convert::TryFrom, sync::Arc};
use tokio_util::compat::*;struct Server;
#[async_trait]
impl LanguageServer for Server {
async fn initialize(
&self,
_params: InitializeParams,
_client: Arc,
) -> Result {
Ok(InitializeResult::default())
}async fn initialized(&self, _params: InitializedParams, client: Arc) {
let params = ShowMessageParams {
typ: MessageType::Info,
message: "Hello World!".to_owned(),
};client.show_message(params).await;
}
}fn main() {
let executor = TokioTp::try_from(&mut tokio::runtime::Builder::new())
.expect("failed to create thread pool");executor.block_on(
LanguageService::builder()
.server(Arc::new(Server))
.input(tokio::io::stdin().compat())
.output(tokio::io::stdout().compat_write())
.executor(executor.clone())
.build()
.listen(),
);
}
```More examples can be found [here](examples).