mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Fixed silly custom settings parsing
This commit is contained in:
parent
f54ab73b47
commit
c72b70d4ae
1 changed files with 0 additions and 31 deletions
|
@ -263,44 +263,13 @@ pub struct TerminalSettings {
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema, Default)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema, Default)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[serde(untagged)]
|
|
||||||
pub enum TerminalLineHeight {
|
pub enum TerminalLineHeight {
|
||||||
#[default]
|
#[default]
|
||||||
#[serde(deserialize_with = "comfortable")]
|
|
||||||
Comfortable,
|
Comfortable,
|
||||||
#[serde(deserialize_with = "standard")]
|
|
||||||
Standard,
|
Standard,
|
||||||
Custom(f32),
|
Custom(f32),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copied from: https://github.com/serde-rs/serde/issues/1158#issuecomment-365362959
|
|
||||||
fn comfortable<'de, D>(deserializer: D) -> Result<(), D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
enum Helper {
|
|
||||||
#[serde(rename = "comfortable")]
|
|
||||||
Variant,
|
|
||||||
}
|
|
||||||
Helper::deserialize(deserializer)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copied from: https://github.com/serde-rs/serde/issues/1158#issuecomment-365362959
|
|
||||||
fn standard<'de, D>(deserializer: D) -> Result<(), D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
enum Helper {
|
|
||||||
#[serde(rename = "standard")]
|
|
||||||
Variant,
|
|
||||||
}
|
|
||||||
Helper::deserialize(deserializer)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TerminalLineHeight {
|
impl TerminalLineHeight {
|
||||||
fn value(&self) -> f32 {
|
fn value(&self) -> f32 {
|
||||||
match self {
|
match self {
|
||||||
|
|
Loading…
Reference in a new issue