1use anyhow;
2use gpui::Pixels;
3use schemars::JsonSchema;
4use serde_derive::{Deserialize, Serialize};
5use settings::{Settings, SettingsSources};
6use workspace::dock::DockPosition;
7
8#[derive(Deserialize, Debug)]
9pub struct CollaborationPanelSettings {
10 pub button: bool,
11 pub dock: DockPosition,
12 pub default_width: Pixels,
13}
14
15#[derive(Deserialize, Debug)]
16pub struct ChatPanelSettings {
17 pub button: bool,
18 pub dock: DockPosition,
19 pub default_width: Pixels,
20}
21
22#[derive(Deserialize, Debug)]
23pub struct NotificationPanelSettings {
24 pub button: bool,
25 pub dock: DockPosition,
26 pub default_width: Pixels,
27}
28
29#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
30pub struct PanelSettingsContent {
31 /// Whether to show the panel button in the status bar.
32 ///
33 /// Default: true
34 pub button: Option<bool>,
35 /// Where to dock the panel.
36 ///
37 /// Default: left
38 pub dock: Option<DockPosition>,
39 /// Default width of the panel in pixels.
40 ///
41 /// Default: 240
42 pub default_width: Option<f32>,
43}
44
45#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
46pub struct MessageEditorSettings {
47 /// Whether to automatically replace emoji shortcodes with emoji characters.
48 /// For example: typing `:wave:` gets replaced with `👋`.
49 ///
50 /// Default: false
51 pub auto_replace_emoji_shortcode: Option<bool>,
52}
53
54impl Settings for CollaborationPanelSettings {
55 const KEY: Option<&'static str> = Some("collaboration_panel");
56
57 type FileContent = PanelSettingsContent;
58
59 fn load(
60 sources: SettingsSources<Self::FileContent>,
61 _: &mut gpui::AppContext,
62 ) -> anyhow::Result<Self> {
63 sources.json_merge()
64 }
65}
66
67impl Settings for ChatPanelSettings {
68 const KEY: Option<&'static str> = Some("chat_panel");
69
70 type FileContent = PanelSettingsContent;
71
72 fn load(
73 sources: SettingsSources<Self::FileContent>,
74 _: &mut gpui::AppContext,
75 ) -> anyhow::Result<Self> {
76 sources.json_merge()
77 }
78}
79
80impl Settings for NotificationPanelSettings {
81 const KEY: Option<&'static str> = Some("notification_panel");
82
83 type FileContent = PanelSettingsContent;
84
85 fn load(
86 sources: SettingsSources<Self::FileContent>,
87 _: &mut gpui::AppContext,
88 ) -> anyhow::Result<Self> {
89 sources.json_merge()
90 }
91}
92
93impl Settings for MessageEditorSettings {
94 const KEY: Option<&'static str> = Some("message_editor");
95
96 type FileContent = MessageEditorSettings;
97
98 fn load(
99 sources: SettingsSources<Self::FileContent>,
100 _: &mut gpui::AppContext,
101 ) -> anyhow::Result<Self> {
102 sources.json_merge()
103 }
104}