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