Crates.io | lsp-ty |
lib.rs | lsp-ty |
version | 0.2.2 |
source | src |
created_at | 2022-02-20 04:02:29.024499 |
updated_at | 2022-02-24 03:07:48.421283 |
description | type definitons for LSP |
homepage | https://privaterookie.github.io/lsp-types/ |
repository | https://github.com/PrivateRookie/lsp-types |
max_upload_size | |
id | 535554 |
size | 248,270 |
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.
check examples of lsp-io
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.