diff --git a/Cargo.lock b/Cargo.lock index 9da817877e..3f041b7acd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5835,6 +5835,7 @@ dependencies = [ "seahash", "serde 1.0.125", "serde_json 1.0.64", + "serde_path_to_error", "similar", "simplelog", "smallvec", diff --git a/zed/Cargo.toml b/zed/Cargo.toml index a9cdb77675..b77ed8caff 100644 --- a/zed/Cargo.toml +++ b/zed/Cargo.toml @@ -42,6 +42,7 @@ rust-embed = "5.9.0" seahash = "4.1" serde = { version = "1", features = ["derive"] } serde_json = { version = "1.0.64", features = ["preserve_order"] } +serde_path_to_error = "0.1.4" similar = "1.3" simplelog = "0.9" smallvec = { version = "1.6", features = ["union"] } diff --git a/zed/src/theme/theme_registry.rs b/zed/src/theme/theme_registry.rs index da6d097c31..0808281f09 100644 --- a/zed/src/theme/theme_registry.rs +++ b/zed/src/theme/theme_registry.rs @@ -1,8 +1,7 @@ use anyhow::{anyhow, Context, Result}; use gpui::{fonts, AssetSource, FontCache}; -use json::{Map, Value}; use parking_lot::Mutex; -use serde_json as json; +use serde_json::{Map, Value}; use std::{collections::HashMap, fmt, mem, sync::Arc}; use super::Theme; @@ -71,8 +70,8 @@ impl ThemeRegistry { } let theme_data = self.load(name, true)?; - let mut theme = fonts::with_font_cache(self.font_cache.clone(), || { - serde_json::from_value::(theme_data.as_ref().clone()) + let mut theme: Theme = fonts::with_font_cache(self.font_cache.clone(), || { + serde_path_to_error::deserialize(theme_data.as_ref()) })?; theme.name = name.into();