sync_lsp/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub use connection::{Transport, Connection, Server, ErrorCode};
4pub use sync_lsp_derive::type_provider;
5use serde::de::DeserializeOwned;
6use serde::Serialize;
7use workspace::execute_command::Command;
8use std::fmt::Debug;
9
10mod connection;
11mod lifecycle;
12pub mod text_document;
13pub mod window;
14pub mod workspace;
15
16/// This trait is used to set type definitions for requests and notifications
17/// with dynamic parameters.
18/// 
19/// For simplicity, it is recommended to use the
20/// [`type_provider`] macro instead of implementing the default values manually.
21/// Even tough technically allowed by the spec, it is not recommended to use
22/// `()` as default types as some lsp clients may return undefined instead of null
23/// in their responses causing the a deserialisation error on the server.
24pub trait TypeProvider: 'static {
25    type Command: Command;
26    type CodeLensData: Serialize + DeserializeOwned;
27    type CompletionData: Serialize + DeserializeOwned + Debug;
28    type Configuration: DeserializeOwned;
29    type InitializeOptions: DeserializeOwned;
30    type ShowMessageRequestData: Serialize + DeserializeOwned + Default;
31    type ApplyEditData: Serialize + DeserializeOwned + Default;
32}
33
34//TODO
35//Implement dynamic registration support