ZIm/crates/git_ui/src/settings.rs
Nate Butler 8e0ae441f3
Initial git panel refinements (#21912)
- Wire up settings
- Update static Panel impl
- Tidy up renders

Release Notes:

- N/A
2024-12-12 09:13:40 -05:00

41 lines
1 KiB
Rust

use gpui::Pixels;
use schemars::JsonSchema;
use serde_derive::{Deserialize, Serialize};
use settings::{Settings, SettingsSources};
use workspace::dock::DockPosition;
#[derive(Deserialize, Debug)]
pub struct GitPanelSettings {
pub button: bool,
pub dock: DockPosition,
pub default_width: Pixels,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
pub struct PanelSettingsContent {
/// Whether to show the panel button in the status bar.
///
/// Default: true
pub button: Option<bool>,
/// Where to dock the panel.
///
/// Default: left
pub dock: Option<DockPosition>,
/// Default width of the panel in pixels.
///
/// Default: 360
pub default_width: Option<f32>,
}
impl Settings for GitPanelSettings {
const KEY: Option<&'static str> = Some("git_panel");
type FileContent = PanelSettingsContent;
fn load(
sources: SettingsSources<Self::FileContent>,
_: &mut gpui::AppContext,
) -> anyhow::Result<Self> {
sources.json_merge()
}
}