
Follow up to: https://github.com/zed-industries/zed/pull/18682 This PR tweaks the setting value, so it's clear we're referring to `max-width`, meaning the width will change up to a specific value depending on the available window size. Then, it also makes `Small` the default value, which, in practice, makes the modal size the same as it was before the original PR linked above. Release Notes: - N/A --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
use anyhow::Result;
|
|
use schemars::JsonSchema;
|
|
use serde_derive::{Deserialize, Serialize};
|
|
use settings::{Settings, SettingsSources};
|
|
|
|
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
|
pub struct FileFinderSettings {
|
|
pub file_icons: bool,
|
|
pub modal_max_width: Option<FileFinderWidth>,
|
|
}
|
|
|
|
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
|
pub struct FileFinderSettingsContent {
|
|
/// Whether to show file icons in the file finder.
|
|
///
|
|
/// Default: true
|
|
pub file_icons: Option<bool>,
|
|
/// Determines how much space the file finder can take up in relation to the available window width.
|
|
///
|
|
/// Default: small
|
|
pub modal_max_width: Option<FileFinderWidth>,
|
|
}
|
|
|
|
impl Settings for FileFinderSettings {
|
|
const KEY: Option<&'static str> = Some("file_finder");
|
|
|
|
type FileContent = FileFinderSettingsContent;
|
|
|
|
fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::AppContext) -> Result<Self> {
|
|
sources.json_merge()
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
|
|
#[serde(rename_all = "lowercase")]
|
|
pub enum FileFinderWidth {
|
|
#[default]
|
|
Small,
|
|
Medium,
|
|
Large,
|
|
XLarge,
|
|
Full,
|
|
}
|