From 0bea4d5fa6fdb744665fe411a5d70224b22fc9d5 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 19 Aug 2024 10:55:25 -0400 Subject: [PATCH] theme: Change autocomplete value for `ui_font_features` and `buffer_font_features` (#16466) This PR changes the default value used when autocompleting the `ui_font_features` and `ui_font_features` settings from `null` to `{}`. Release Notes: - N/A --- crates/theme/src/settings.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rs index dce30ec0e86c1abd87ad0a9aa8a745b59c2ea71a..487f8e973c29ad6011577cce536a67debcbb4eb6 100644 --- a/crates/theme/src/settings.rs +++ b/crates/theme/src/settings.rs @@ -249,6 +249,7 @@ pub struct ThemeSettingsContent { pub ui_font_fallbacks: Option>, /// The OpenType features to enable for text in the UI. #[serde(default)] + #[schemars(default = "default_font_features")] pub ui_font_features: Option, /// The weight of the UI font in CSS units from 100 to 900. #[serde(default)] @@ -270,6 +271,7 @@ pub struct ThemeSettingsContent { pub buffer_line_height: Option, /// The OpenType features to enable for rendering in text buffers. #[serde(default)] + #[schemars(default = "default_font_features")] pub buffer_font_features: Option, /// The name of the Zed theme to use. #[serde(default)] @@ -288,6 +290,10 @@ pub struct ThemeSettingsContent { pub theme_overrides: Option, } +fn default_font_features() -> Option { + Some(FontFeatures::default()) +} + impl ThemeSettingsContent { /// Sets the theme for the given appearance to the theme with the specified name. pub fn set_theme(&mut self, theme_name: String, appearance: Appearance) {