settings_ui: Correct stepper increment and enforce max value for Centered Layout Padding (#40751)

Closes #40748

This PR improves the Centered Layout Padding in settings ui by limiting the numeric stepper to be within valid values and adding a custom schema generated to improve the JSON LSP completions and warnings when editing the setting field manually.

Release Notes:

- settings ui: limit stepper increment for centered padding between 0 and 0.4 and increment by 0.05 now

---------

Co-authored by: Anthony Eid <anthony@zed.dev>
This commit is contained in:
Delvin
2025-10-21 19:20:42 +00:00
committed by GitHub
parent a398f80ba6
commit 4b429033e7
5 changed files with 89 additions and 16 deletions
+9 -1
View File
@@ -8,7 +8,7 @@ use std::{
use editor::{Editor, EditorStyle};
use gpui::{ClickEvent, Entity, FocusHandle, Focusable, FontWeight, Modifiers};
use settings::{CodeFade, DelayMs, InactiveOpacity, MinimumContrast};
use settings::{CenteredPaddingSettings, CodeFade, DelayMs, InactiveOpacity, MinimumContrast};
use ui::prelude::*;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
@@ -71,6 +71,14 @@ impl_newtype_numeric_stepper!(CodeFade, 0.1, 0.2, 0.05, 0.0, 0.9);
impl_newtype_numeric_stepper!(InactiveOpacity, 0.1, 0.2, 0.05, 0.0, 1.0);
impl_newtype_numeric_stepper!(MinimumContrast, 1., 10., 0.5, 0.0, 106.0);
impl_newtype_numeric_stepper!(DelayMs, 100, 500, 10, 0, 2000);
impl_newtype_numeric_stepper!(
CenteredPaddingSettings,
0.05,
0.2,
0.1,
CenteredPaddingSettings::MIN_PADDING,
CenteredPaddingSettings::MAX_PADDING
);
macro_rules! impl_numeric_stepper_int {
($type:ident) => {