diff options
author | Aleksey Kladov <[email protected]> | 2018-09-02 10:34:06 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-02 10:34:06 +0100 |
commit | 7fad13de73ded5b8a332c5f50c18671d612bd1e3 (patch) | |
tree | 6179708a92b8fbaa8d5fdfa13b2db1f310836bd9 /crates/gen_lsp_server/src | |
parent | d7524556375f2b37e61fe85f17c0e4940e9e4d40 (diff) |
store messages in tests
Diffstat (limited to 'crates/gen_lsp_server/src')
-rw-r--r-- | crates/gen_lsp_server/src/msg.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs index d2ce20a11..42241194d 100644 --- a/crates/gen_lsp_server/src/msg.rs +++ b/crates/gen_lsp_server/src/msg.rs | |||
@@ -9,7 +9,7 @@ use languageserver_types::{ | |||
9 | 9 | ||
10 | use Result; | 10 | use Result; |
11 | 11 | ||
12 | #[derive(Debug, Serialize, Deserialize)] | 12 | #[derive(Debug, Serialize, Deserialize, Clone)] |
13 | #[serde(untagged)] | 13 | #[serde(untagged)] |
14 | pub enum RawMessage { | 14 | pub enum RawMessage { |
15 | Request(RawRequest), | 15 | Request(RawRequest), |
@@ -17,14 +17,14 @@ pub enum RawMessage { | |||
17 | Response(RawResponse), | 17 | Response(RawResponse), |
18 | } | 18 | } |
19 | 19 | ||
20 | #[derive(Debug, Serialize, Deserialize)] | 20 | #[derive(Debug, Serialize, Deserialize, Clone)] |
21 | pub struct RawRequest { | 21 | pub struct RawRequest { |
22 | pub id: u64, | 22 | pub id: u64, |
23 | pub method: String, | 23 | pub method: String, |
24 | pub params: Value, | 24 | pub params: Value, |
25 | } | 25 | } |
26 | 26 | ||
27 | #[derive(Debug, Serialize, Deserialize)] | 27 | #[derive(Debug, Serialize, Deserialize, Clone)] |
28 | pub struct RawResponse { | 28 | pub struct RawResponse { |
29 | // JSON RPC allows this to be null if it was impossible | 29 | // JSON RPC allows this to be null if it was impossible |
30 | // to decode the request's id. Ignore this special case | 30 | // to decode the request's id. Ignore this special case |
@@ -36,7 +36,7 @@ pub struct RawResponse { | |||
36 | pub error: Option<RawResponseError>, | 36 | pub error: Option<RawResponseError>, |
37 | } | 37 | } |
38 | 38 | ||
39 | #[derive(Debug, Serialize, Deserialize)] | 39 | #[derive(Debug, Serialize, Deserialize, Clone)] |
40 | pub struct RawResponseError { | 40 | pub struct RawResponseError { |
41 | pub code: i32, | 41 | pub code: i32, |
42 | pub message: String, | 42 | pub message: String, |
@@ -44,6 +44,7 @@ pub struct RawResponseError { | |||
44 | pub data: Option<Value>, | 44 | pub data: Option<Value>, |
45 | } | 45 | } |
46 | 46 | ||
47 | #[derive(Clone, Copy, Debug)] | ||
47 | #[allow(unused)] | 48 | #[allow(unused)] |
48 | pub enum ErrorCode { | 49 | pub enum ErrorCode { |
49 | ParseError = -32700, | 50 | ParseError = -32700, |
@@ -58,7 +59,7 @@ pub enum ErrorCode { | |||
58 | RequestCancelled = -32800, | 59 | RequestCancelled = -32800, |
59 | } | 60 | } |
60 | 61 | ||
61 | #[derive(Debug, Serialize, Deserialize)] | 62 | #[derive(Debug, Serialize, Deserialize, Clone)] |
62 | pub struct RawNotification { | 63 | pub struct RawNotification { |
63 | pub method: String, | 64 | pub method: String, |
64 | pub params: Value, | 65 | pub params: Value, |