From 8f1ce8275347e915b1cc824567e96369875cefd4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Sep 2018 17:40:45 +0300 Subject: move to gen-server impl --- crates/gen_lsp_server/src/lib.rs | 2 +- crates/gen_lsp_server/src/msg.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'crates/gen_lsp_server/src') diff --git a/crates/gen_lsp_server/src/lib.rs b/crates/gen_lsp_server/src/lib.rs index a31e90f35..b47db0df4 100644 --- a/crates/gen_lsp_server/src/lib.rs +++ b/crates/gen_lsp_server/src/lib.rs @@ -21,7 +21,7 @@ use languageserver_types::{ pub type Result = ::std::result::Result; pub use { - msg::{RawMessage, RawRequest, RawResponse, RawResponseError, RawNotification}, + msg::{RawMessage, RawRequest, RawResponse, RawResponseError, RawNotification, ErrorCode}, stdio::{stdio_transport, Threads}, }; diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs index 9426e98ec..533d7da3e 100644 --- a/crates/gen_lsp_server/src/msg.rs +++ b/crates/gen_lsp_server/src/msg.rs @@ -120,6 +120,16 @@ impl RawResponse { } impl RawNotification { + pub fn new(params: N::Params) -> RawNotification + where + N: Notification, + N::Params: Serialize, + { + RawNotification { + method: N::METHOD.to_string(), + params: to_value(¶ms).unwrap(), + } + } pub fn cast(self) -> ::std::result::Result where N: Notification, -- cgit v1.2.3