settings_ui: Add maybe settings (#40724)
Closes #ISSUE Adds a `Maybe<T>` type to `settings_content`, that makes the distinction between `null` and omitted settings values explicit. This unlocks a few more settings in the settings UI Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -8,7 +8,7 @@ use settings_macros::MergeFrom;
|
||||
use util::serde::default_true;
|
||||
|
||||
use crate::{
|
||||
AllLanguageSettingsContent, DelayMs, ExtendingVec, ProjectTerminalSettingsContent,
|
||||
AllLanguageSettingsContent, DelayMs, ExtendingVec, Maybe, ProjectTerminalSettingsContent,
|
||||
SlashCommandSettings,
|
||||
};
|
||||
|
||||
@@ -56,11 +56,13 @@ pub struct ProjectSettingsContent {
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
|
||||
pub struct WorktreeSettingsContent {
|
||||
/// The displayed name of this project. If not set or empty, the root directory name
|
||||
/// The displayed name of this project. If not set or null, the root directory name
|
||||
/// will be displayed.
|
||||
///
|
||||
/// Default: ""
|
||||
pub project_name: Option<String>,
|
||||
/// Default: null
|
||||
#[serde(default)]
|
||||
#[serde(skip_serializing_if = "Maybe::is_unset")]
|
||||
pub project_name: Maybe<String>,
|
||||
|
||||
/// Completely ignore files matching globs from `file_scan_exclusions`. Overrides
|
||||
/// `file_scan_inclusions`.
|
||||
|
||||
@@ -134,7 +134,19 @@ pub struct TerminalSettingsContent {
|
||||
}
|
||||
|
||||
/// Shell configuration to open the terminal with.
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
PartialEq,
|
||||
Eq,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
strum::EnumDiscriminants,
|
||||
)]
|
||||
#[strum_discriminants(derive(strum::VariantArray, strum::VariantNames, strum::FromRepr))]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Shell {
|
||||
/// Use the system's default terminal configuration in /etc/passwd
|
||||
|
||||
Reference in New Issue
Block a user