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