3 releases

0.2.2 Feb 24, 2022
0.2.1 Feb 21, 2022
0.2.0 Feb 20, 2022

#58 in #lsp

Download history 1/week @ 2024-02-19 25/week @ 2024-02-26 4/week @ 2024-03-11 59/week @ 2024-04-01

63 downloads per month
Used in lsp-io

Custom license

240KB
5K SLoC

lsp-ty

This crate provides types used for LSP, and some helper structures, macro and trait for handling message.

For more information about LSP, see LSP - overview.

demo usage

check examples of lsp-io

add custom request, notification and response

If you want to custom request/response pair. First, define you request params and response result type, with Serialize and Deserialize derive.

#[derive(Clone, PartialEq, Debug, Default, Deserialize, Serialize)]
pub struct MyParams {
    pub name: String,
    pub pos: Position
}

#[derive(Clone, PartialEq, Debug, Default, Deserialize, Serialize)]
pub struct MyResult {
    pub data: Vec<String>
}

then use impl_req helper macro to auto complete FromReq trait for you custom types

// the second param is you custom request method
impl_req!(MyParams, "custom/my", MyResult);

impl notification message is similar with above, except that, notification does not need to specify response type.

Dependencies

~2–3MB
~93K SLoC