editor_settings.rs

 1use schemars::JsonSchema;
 2use serde::{Deserialize, Serialize};
 3use settings::Setting;
 4
 5#[derive(Deserialize)]
 6pub struct EditorSettings {
 7    pub cursor_blink: bool,
 8    pub hover_popover_enabled: bool,
 9    pub show_completions_on_input: bool,
10}
11
12#[derive(Clone, Serialize, Deserialize, JsonSchema)]
13pub struct EditorSettingsContent {
14    pub cursor_blink: Option<bool>,
15    pub hover_popover_enabled: Option<bool>,
16    pub show_completions_on_input: Option<bool>,
17}
18
19impl Setting for EditorSettings {
20    const KEY: Option<&'static str> = None;
21
22    type FileContent = EditorSettingsContent;
23
24    fn load(
25        default_value: &Self::FileContent,
26        user_values: &[&Self::FileContent],
27        _: &gpui::AppContext,
28    ) -> anyhow::Result<Self> {
29        Self::load_via_json_merge(default_value, user_values)
30    }
31}