1use anyhow;
2use schemars::JsonSchema;
3use serde_derive::{Deserialize, Serialize};
4use settings::Setting;
5use workspace::dock::DockPosition;
6
7#[derive(Deserialize, Debug)]
8pub struct CollaborationPanelSettings {
9 pub button: bool,
10 pub dock: DockPosition,
11 pub default_width: f32,
12}
13
14#[derive(Deserialize, Debug)]
15pub struct ChatPanelSettings {
16 pub button: bool,
17 pub dock: DockPosition,
18 pub default_width: f32,
19}
20
21#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
22pub struct PanelSettingsContent {
23 pub button: Option<bool>,
24 pub dock: Option<DockPosition>,
25 pub default_width: Option<f32>,
26}
27
28impl Setting for CollaborationPanelSettings {
29 const KEY: Option<&'static str> = Some("collaboration_panel");
30
31 type FileContent = PanelSettingsContent;
32
33 fn load(
34 default_value: &Self::FileContent,
35 user_values: &[&Self::FileContent],
36 _: &gpui::AppContext,
37 ) -> anyhow::Result<Self> {
38 Self::load_via_json_merge(default_value, user_values)
39 }
40}
41
42impl Setting for ChatPanelSettings {
43 const KEY: Option<&'static str> = Some("chat_panel");
44
45 type FileContent = PanelSettingsContent;
46
47 fn load(
48 default_value: &Self::FileContent,
49 user_values: &[&Self::FileContent],
50 _: &gpui::AppContext,
51 ) -> anyhow::Result<Self> {
52 Self::load_via_json_merge(default_value, user_values)
53 }
54}