mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Try serde_path_to_error for LSP InitializeParams
This commit is contained in:
parent
85a2875161
commit
4e89c2a664
3 changed files with 12 additions and 1 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -1358,6 +1358,7 @@ dependencies = [
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"serde_path_to_error",
|
||||||
"ssr",
|
"ssr",
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
|
@ -1526,6 +1527,15 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_path_to_error"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42f6109f0506e20f7e0f910e51a0079acf41da8e0694e6442527c4ddf5a2b158"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_repr"
|
name = "serde_repr"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
|
|
@ -28,6 +28,7 @@ oorandom = "11.1.2"
|
||||||
rustc-hash = "1.1.0"
|
rustc-hash = "1.1.0"
|
||||||
serde = { version = "1.0.106", features = ["derive"] }
|
serde = { version = "1.0.106", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.48", features = ["preserve_order"] }
|
serde_json = { version = "1.0.48", features = ["preserve_order"] }
|
||||||
|
serde_path_to_error = "0.1"
|
||||||
threadpool = "1.7.1"
|
threadpool = "1.7.1"
|
||||||
rayon = "1.5"
|
rayon = "1.5"
|
||||||
mimalloc = { version = "0.1.19", default-features = false, optional = true }
|
mimalloc = { version = "0.1.19", default-features = false, optional = true }
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||||
pub type Result<T, E = Error> = std::result::Result<T, E>;
|
pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||||
|
|
||||||
pub fn from_json<T: DeserializeOwned>(what: &'static str, json: serde_json::Value) -> Result<T> {
|
pub fn from_json<T: DeserializeOwned>(what: &'static str, json: serde_json::Value) -> Result<T> {
|
||||||
let res = T::deserialize(&json)
|
let res = serde_path_to_error::deserialize(&json)
|
||||||
.map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?;
|
.map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?;
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue