1use gpui::Pixels;
2use schemars::JsonSchema;
3use serde::{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(Clone, Copy, Default, Serialize, Deserialize, JsonSchema, Debug)]
15#[serde(rename_all = "snake_case")]
16pub enum ChatPanelButton {
17 Never,
18 Always,
19 #[default]
20 WhenInCall,
21}
22
23#[derive(Deserialize, Debug)]
24pub struct ChatPanelSettings {
25 pub button: ChatPanelButton,
26 pub dock: DockPosition,
27 pub default_width: Pixels,
28}
29
30#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
31#[schemars(deny_unknown_fields)]
32pub struct ChatPanelSettingsContent {
33 /// When to show the panel button in the status bar.
34 ///
35 /// Default: only when in a call
36 pub button: Option<ChatPanelButton>,
37 /// Where to dock the panel.
38 ///
39 /// Default: right
40 pub dock: Option<DockPosition>,
41 /// Default width of the panel in pixels.
42 ///
43 /// Default: 240
44 pub default_width: Option<f32>,
45}
46
47#[derive(Deserialize, Debug)]
48pub struct NotificationPanelSettings {
49 pub button: bool,
50 pub dock: DockPosition,
51 pub default_width: Pixels,
52}
53
54#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
55#[schemars(deny_unknown_fields)]
56pub struct PanelSettingsContent {
57 /// Whether to show the panel button in the status bar.
58 ///
59 /// Default: true
60 pub button: Option<bool>,
61 /// Where to dock the panel.
62 ///
63 /// Default: left
64 pub dock: Option<DockPosition>,
65 /// Default width of the panel in pixels.
66 ///
67 /// Default: 240
68 pub default_width: Option<f32>,
69}
70
71#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
72#[schemars(deny_unknown_fields)]
73pub struct MessageEditorSettings {
74 /// Whether to automatically replace emoji shortcodes with emoji characters.
75 /// For example: typing `:wave:` gets replaced with `👋`.
76 ///
77 /// Default: false
78 pub auto_replace_emoji_shortcode: Option<bool>,
79}
80
81impl Settings for CollaborationPanelSettings {
82 const KEY: Option<&'static str> = Some("collaboration_panel");
83
84 type FileContent = PanelSettingsContent;
85
86 fn load(
87 sources: SettingsSources<Self::FileContent>,
88 _: &mut gpui::App,
89 ) -> anyhow::Result<Self> {
90 sources.json_merge()
91 }
92
93 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
94}
95
96impl Settings for ChatPanelSettings {
97 const KEY: Option<&'static str> = Some("chat_panel");
98
99 type FileContent = ChatPanelSettingsContent;
100
101 fn load(
102 sources: SettingsSources<Self::FileContent>,
103 _: &mut gpui::App,
104 ) -> anyhow::Result<Self> {
105 sources.json_merge()
106 }
107
108 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
109}
110
111impl Settings for NotificationPanelSettings {
112 const KEY: Option<&'static str> = Some("notification_panel");
113
114 type FileContent = PanelSettingsContent;
115
116 fn load(
117 sources: SettingsSources<Self::FileContent>,
118 _: &mut gpui::App,
119 ) -> anyhow::Result<Self> {
120 sources.json_merge()
121 }
122
123 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
124}
125
126impl Settings for MessageEditorSettings {
127 const KEY: Option<&'static str> = Some("message_editor");
128
129 type FileContent = MessageEditorSettings;
130
131 fn load(
132 sources: SettingsSources<Self::FileContent>,
133 _: &mut gpui::App,
134 ) -> anyhow::Result<Self> {
135 sources.json_merge()
136 }
137
138 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
139}