settings ui: Add numeric steppers to settings UI (#39491)
This PR adds the numeric stepper component to the settings ui and
implements some settings that rely on this component as well.
I also switched {buffer/ui}_font_weight to the `gpui::FontWeight` type
and added a manual implementation of the Schemars trait. This allows Zed
to send min, max, and default information to the JSON LSP when a user is
manually editing the settings file.
The numeric stepper elements added to the settings ui are below:
- ui font size
- ui font weight
- Buffer font size
- Buffer font weight
- Scroll sensitivity
- Fast scroll sensitivity
- Vertical scroll margin
- Horizontal scroll margin
- Inline blame padding
- Inline blame delay
- Inline blame min column
- Unnecessary code fade
- Tab Size
- Hover popover delay
Release Notes:
- N/A
This commit is contained in:
@@ -817,7 +817,7 @@ impl settings::Settings for ThemeSettings {
|
||||
family: content.ui_font_family.as_ref().unwrap().0.clone().into(),
|
||||
features: content.ui_font_features.clone().unwrap(),
|
||||
fallbacks: font_fallbacks_from_settings(content.ui_font_fallbacks.clone()),
|
||||
weight: clamp_font_weight(content.ui_font_weight.unwrap()),
|
||||
weight: clamp_font_weight(content.ui_font_weight.unwrap().0),
|
||||
style: Default::default(),
|
||||
},
|
||||
buffer_font: Font {
|
||||
@@ -830,7 +830,7 @@ impl settings::Settings for ThemeSettings {
|
||||
.into(),
|
||||
features: content.buffer_font_features.clone().unwrap(),
|
||||
fallbacks: font_fallbacks_from_settings(content.buffer_font_fallbacks.clone()),
|
||||
weight: clamp_font_weight(content.buffer_font_weight.unwrap()),
|
||||
weight: clamp_font_weight(content.buffer_font_weight.unwrap().0),
|
||||
style: FontStyle::default(),
|
||||
},
|
||||
buffer_font_size: clamp_font_size(content.buffer_font_size.unwrap().into()),
|
||||
@@ -850,15 +850,15 @@ impl settings::Settings for ThemeSettings {
|
||||
.unwrap(),
|
||||
icon_theme_selection: Some(icon_theme_selection),
|
||||
ui_density: content.ui_density.unwrap_or_default().into(),
|
||||
unnecessary_code_fade: content.unnecessary_code_fade.unwrap().clamp(0.0, 0.9),
|
||||
unnecessary_code_fade: content.unnecessary_code_fade.unwrap().0.clamp(0.0, 0.9),
|
||||
};
|
||||
this.apply_theme_overrides();
|
||||
this
|
||||
}
|
||||
|
||||
fn import_from_vscode(vscode: &settings::VsCodeSettings, current: &mut SettingsContent) {
|
||||
vscode.f32_setting("editor.fontWeight", &mut current.theme.buffer_font_weight);
|
||||
vscode.f32_setting("editor.fontSize", &mut current.theme.buffer_font_size);
|
||||
vscode.from_f32_setting("editor.fontWeight", &mut current.theme.buffer_font_weight);
|
||||
vscode.from_f32_setting("editor.fontSize", &mut current.theme.buffer_font_size);
|
||||
if let Some(font) = vscode.read_string("editor.font") {
|
||||
current.theme.buffer_font_family = Some(FontFamilyName(font.into()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user