Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
settings.json: Suggest font names for buffer_font_family
Piotr Osiewicz8d294211db81
diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rsindex 2d3cc34f3fc..d80c9163a99 100644--- a/crates/gpui/src/text_system.rs+++ b/crates/gpui/src/text_system.rs@@ -65,6 +65,9 @@ impl TextSystem {}}+ pub fn all_font_families(&self) -> Vec<String> {+ self.platform_text_system.all_font_families()+ }pub fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()> {self.platform_text_system.add_fonts(fonts)}diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rsindex 3ecf1935a47..e51ff81b012 100644--- a/crates/theme/src/settings.rs+++ b/crates/theme/src/settings.rs@@ -194,9 +194,21 @@ impl settings::Settings for ThemeSettings {..Default::default()};- root_schema- .definitions- .extend([("ThemeName".into(), theme_name_schema.into())]);+ let available_fonts = cx+ .text_system()+ .all_font_families()+ .into_iter()+ .map(Value::String)+ .collect();+ let fonts_schema = SchemaObject {+ instance_type: Some(InstanceType::String.into()),+ enum_values: Some(available_fonts),+ ..Default::default()+ };+ root_schema.definitions.extend([+ ("ThemeName".into(), theme_name_schema.into()),+ ("FontFamilies".into(), fonts_schema.into()),+ ]);root_schema.schema@@ -204,10 +216,16 @@ impl settings::Settings for ThemeSettings {.as_mut().unwrap().properties- .extend([(- "theme".to_owned(),- Schema::new_ref("#/definitions/ThemeName".into()),- )]);+ .extend([+ (+ "theme".to_owned(),+ Schema::new_ref("#/definitions/ThemeName".into()),+ ),+ (+ "buffer_font_family".to_owned(),+ Schema::new_ref("#/definitions/FontFamilies".into()),+ ),+ ]);root_schema}