diff options
| author | Aleksey Kladov <[email protected]> | 2018-09-01 15:40:45 +0100 |
|---|---|---|
| committer | Aleksey Kladov <[email protected]> | 2018-09-01 15:40:45 +0100 |
| commit | 8f1ce8275347e915b1cc824567e96369875cefd4 (patch) | |
| tree | 1d7b56d7947a5c6a20a6547b5342e3363e6c0e0f /crates/gen_lsp_server/src | |
| parent | 3588d6b2da6e63730cc560c9986ba7fda5de816e (diff) | |
move to gen-server impl
Diffstat (limited to 'crates/gen_lsp_server/src')
| -rw-r--r-- | crates/gen_lsp_server/src/lib.rs | 2 | ||||
| -rw-r--r-- | crates/gen_lsp_server/src/msg.rs | 10 |
2 files changed, 11 insertions, 1 deletions
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::{ | |||
| 21 | 21 | ||
| 22 | pub type Result<T> = ::std::result::Result<T, failure::Error>; | 22 | pub type Result<T> = ::std::result::Result<T, failure::Error>; |
| 23 | pub use { | 23 | pub use { |
| 24 | msg::{RawMessage, RawRequest, RawResponse, RawResponseError, RawNotification}, | 24 | msg::{RawMessage, RawRequest, RawResponse, RawResponseError, RawNotification, ErrorCode}, |
| 25 | stdio::{stdio_transport, Threads}, | 25 | stdio::{stdio_transport, Threads}, |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
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 { | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | impl RawNotification { | 122 | impl RawNotification { |
| 123 | pub fn new<N>(params: N::Params) -> RawNotification | ||
| 124 | where | ||
| 125 | N: Notification, | ||
| 126 | N::Params: Serialize, | ||
| 127 | { | ||
| 128 | RawNotification { | ||
| 129 | method: N::METHOD.to_string(), | ||
| 130 | params: to_value(¶ms).unwrap(), | ||
| 131 | } | ||
| 132 | } | ||
| 123 | pub fn cast<N>(self) -> ::std::result::Result<N::Params, RawNotification> | 133 | pub fn cast<N>(self) -> ::std::result::Result<N::Params, RawNotification> |
| 124 | where | 134 | where |
| 125 | N: Notification, | 135 | N: Notification, |
