diff options
Diffstat (limited to 'support/texlab/crates/jsonrpc/src/types.rs')
-rw-r--r-- | support/texlab/crates/jsonrpc/src/types.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/support/texlab/crates/jsonrpc/src/types.rs b/support/texlab/crates/jsonrpc/src/types.rs index 90116ac793..30036d1c7f 100644 --- a/support/texlab/crates/jsonrpc/src/types.rs +++ b/support/texlab/crates/jsonrpc/src/types.rs @@ -28,8 +28,8 @@ pub struct Error { pub code: ErrorCode, pub message: String, - #[serde(skip_serializing_if = "serde_json::Value::is_null")] - pub data: serde_json::Value, + #[serde(skip_serializing_if = "Option::is_none")] + pub data: Option<serde_json::Value>, } impl Error { @@ -37,7 +37,7 @@ impl Error { Self { code: ErrorCode::ParseError, message: "Could not parse the input".to_owned(), - data: serde_json::Value::Null, + data: None, } } @@ -45,7 +45,7 @@ impl Error { Self { code: ErrorCode::MethodNotFound, message: "Method not found".to_owned(), - data: serde_json::Value::Null, + data: None, } } @@ -53,7 +53,7 @@ impl Error { Self { code: ErrorCode::InvalidParams, message: "Could not deserialize parameter object".to_owned(), - data: serde_json::Value::Null, + data: None, } } @@ -61,7 +61,7 @@ impl Error { Self { code: ErrorCode::InternalError, message, - data: serde_json::Value::Null, + data: None, } } } @@ -76,7 +76,7 @@ pub struct Request { impl Request { pub fn new(method: String, params: serde_json::Value, id: Id) -> Self { - Request { + Self { jsonrpc: PROTOCOL_VERSION.to_owned(), method, params, @@ -100,7 +100,7 @@ pub struct Response { impl Response { pub fn result(result: serde_json::Value, id: Id) -> Self { - Response { + Self { jsonrpc: PROTOCOL_VERSION.to_owned(), result: Some(result), error: None, @@ -109,7 +109,7 @@ impl Response { } pub fn error(error: Error, id: Option<Id>) -> Self { - Response { + Self { jsonrpc: PROTOCOL_VERSION.to_owned(), result: None, error: Some(error), @@ -127,7 +127,7 @@ pub struct Notification { impl Notification { pub fn new(method: String, params: serde_json::Value) -> Self { - Notification { + Self { jsonrpc: PROTOCOL_VERSION.to_owned(), method, params, |