@@ -23,16 +23,15 @@ use gpui::{App, SharedString};
2323use release_channel:: ReleaseChannel ;
2424use schemars:: JsonSchema ;
2525use serde:: { Deserialize , Serialize } ;
26- use serde_with:: skip_serializing_none;
27- use settings_macros:: MergeFrom ;
26+ use settings_macros:: { MergeFrom , with_fallible_options} ;
2827use std:: collections:: BTreeSet ;
2928use std:: env;
3029use std:: sync:: Arc ;
3130pub use util:: serde:: default_true;
3231
3332use crate :: { ActiveSettingsProfileName , merge_from} ;
3433
35- #[ skip_serializing_none ]
34+ #[ with_fallible_options ]
3635#[ derive( Debug , PartialEq , Default , Clone , Serialize , Deserialize , JsonSchema , MergeFrom ) ]
3736pub struct SettingsContent {
3837 #[ serde( flatten) ]
@@ -169,7 +168,7 @@ impl SettingsContent {
169168 }
170169}
171170
172- #[ skip_serializing_none ]
171+ #[ with_fallible_options ]
173172#[ derive( Debug , Default , PartialEq , Clone , Serialize , Deserialize , JsonSchema , MergeFrom ) ]
174173pub struct UserSettingsContent {
175174 #[ serde( flatten) ]
@@ -260,7 +259,7 @@ impl strum::VariantNames for BaseKeymapContent {
260259 ] ;
261260}
262261
263- #[ skip_serializing_none ]
262+ #[ with_fallible_options ]
264263#[ derive( Clone , PartialEq , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug ) ]
265264pub struct TitleBarSettingsContent {
266265 /// Whether to show the branch icon beside branch switcher in the title bar.
@@ -294,7 +293,7 @@ pub struct TitleBarSettingsContent {
294293}
295294
296295/// Configuration of audio in Zed.
297- #[ skip_serializing_none ]
296+ #[ with_fallible_options ]
298297#[ derive( Clone , PartialEq , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug ) ]
299298pub struct AudioSettingsContent {
300299 /// Opt into the new audio system.
@@ -338,7 +337,7 @@ pub struct AudioSettingsContent {
338337}
339338
340339/// Control what info is collected by Zed.
341- #[ skip_serializing_none ]
340+ #[ with_fallible_options ]
342341#[ derive( Clone , PartialEq , Eq , Serialize , Deserialize , JsonSchema , Debug , MergeFrom ) ]
343342pub struct TelemetrySettingsContent {
344343 /// Send debug info like crash reports.
@@ -360,7 +359,7 @@ impl Default for TelemetrySettingsContent {
360359 }
361360}
362361
363- #[ skip_serializing_none ]
362+ #[ with_fallible_options ]
364363#[ derive( Default , Debug , PartialEq , Eq , Serialize , Deserialize , JsonSchema , Clone , MergeFrom ) ]
365364pub struct DebuggerSettingsContent {
366365 /// Determines the stepping granularity.
@@ -441,23 +440,23 @@ pub enum DockPosition {
441440}
442441
443442/// Settings for slash commands.
444- #[ skip_serializing_none ]
443+ #[ with_fallible_options ]
445444#[ derive( Deserialize , Serialize , Debug , Default , Clone , JsonSchema , MergeFrom , PartialEq , Eq ) ]
446445pub struct SlashCommandSettings {
447446 /// Settings for the `/cargo-workspace` slash command.
448447 pub cargo_workspace : Option < CargoWorkspaceCommandSettings > ,
449448}
450449
451450/// Settings for the `/cargo-workspace` slash command.
452- #[ skip_serializing_none ]
451+ #[ with_fallible_options ]
453452#[ derive( Deserialize , Serialize , Debug , Default , Clone , JsonSchema , MergeFrom , PartialEq , Eq ) ]
454453pub struct CargoWorkspaceCommandSettings {
455454 /// Whether `/cargo-workspace` is enabled.
456455 pub enabled : Option < bool > ,
457456}
458457
459458/// Configuration of voice calls in Zed.
460- #[ skip_serializing_none ]
459+ #[ with_fallible_options ]
461460#[ derive( Clone , PartialEq , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug ) ]
462461pub struct CallSettingsContent {
463462 /// Whether the microphone should be muted when joining a channel or a call.
@@ -471,7 +470,7 @@ pub struct CallSettingsContent {
471470 pub share_on_join : Option < bool > ,
472471}
473472
474- #[ skip_serializing_none ]
473+ #[ with_fallible_options ]
475474#[ derive( Clone , PartialEq , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug ) ]
476475pub struct GitPanelSettingsContent {
477476 /// Whether to show the panel button in the status bar.
@@ -535,15 +534,15 @@ pub enum StatusStyle {
535534 LabelColor ,
536535}
537536
538- #[ skip_serializing_none ]
537+ #[ with_fallible_options ]
539538#[ derive(
540539 Copy , Clone , Default , Debug , Serialize , Deserialize , JsonSchema , MergeFrom , PartialEq , Eq ,
541540) ]
542541pub struct ScrollbarSettings {
543542 pub show : Option < ShowScrollbar > ,
544543}
545544
546- #[ skip_serializing_none ]
545+ #[ with_fallible_options ]
547546#[ derive( Clone , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug , PartialEq ) ]
548547pub struct NotificationPanelSettingsContent {
549548 /// Whether to show the panel button in the status bar.
@@ -561,7 +560,7 @@ pub struct NotificationPanelSettingsContent {
561560 pub default_width : Option < f32 > ,
562561}
563562
564- #[ skip_serializing_none ]
563+ #[ with_fallible_options ]
565564#[ derive( Clone , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug , PartialEq ) ]
566565pub struct PanelSettingsContent {
567566 /// Whether to show the panel button in the status bar.
@@ -579,7 +578,7 @@ pub struct PanelSettingsContent {
579578 pub default_width : Option < f32 > ,
580579}
581580
582- #[ skip_serializing_none ]
581+ #[ with_fallible_options ]
583582#[ derive( Clone , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug , PartialEq ) ]
584583pub struct MessageEditorSettings {
585584 /// Whether to automatically replace emoji shortcodes with emoji characters.
@@ -589,7 +588,7 @@ pub struct MessageEditorSettings {
589588 pub auto_replace_emoji_shortcode : Option < bool > ,
590589}
591590
592- #[ skip_serializing_none ]
591+ #[ with_fallible_options ]
593592#[ derive( Clone , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug , PartialEq ) ]
594593pub struct FileFinderSettingsContent {
595594 /// Whether to show file icons in the file finder.
@@ -664,7 +663,7 @@ pub enum FileFinderWidthContent {
664663 Full ,
665664}
666665
667- #[ skip_serializing_none ]
666+ #[ with_fallible_options ]
668667#[ derive( Clone , Default , Serialize , Deserialize , PartialEq , Debug , JsonSchema , MergeFrom ) ]
669668pub struct VimSettingsContent {
670669 pub default_mode : Option < ModeContent > ,
@@ -697,7 +696,7 @@ pub enum UseSystemClipboard {
697696}
698697
699698/// The settings for cursor shape.
700- #[ skip_serializing_none ]
699+ #[ with_fallible_options ]
701700#[ derive( Copy , Clone , Debug , Serialize , Deserialize , PartialEq , Eq , JsonSchema , MergeFrom ) ]
702701pub struct CursorShapeSettings {
703702 /// Cursor shape for the normal mode.
@@ -719,7 +718,7 @@ pub struct CursorShapeSettings {
719718}
720719
721720/// Settings specific to journaling
722- #[ skip_serializing_none ]
721+ #[ with_fallible_options ]
723722#[ derive( Clone , Debug , Serialize , Deserialize , JsonSchema , MergeFrom , PartialEq ) ]
724723pub struct JournalSettingsContent {
725724 /// The path of the directory where journal entries are stored.
@@ -740,7 +739,7 @@ pub enum HourFormat {
740739 Hour24 ,
741740}
742741
743- #[ skip_serializing_none ]
742+ #[ with_fallible_options ]
744743#[ derive( Clone , Default , Serialize , Deserialize , JsonSchema , MergeFrom , Debug , PartialEq ) ]
745744pub struct OutlinePanelSettingsContent {
746745 /// Whether to show the outline panel button in the status bar.
@@ -835,7 +834,7 @@ pub enum ShowIndentGuides {
835834 Never ,
836835}
837836
838- #[ skip_serializing_none ]
837+ #[ with_fallible_options ]
839838#[ derive(
840839 Copy , Clone , Debug , Serialize , Deserialize , JsonSchema , MergeFrom , PartialEq , Eq , Default ,
841840) ]
@@ -853,7 +852,7 @@ pub enum LineIndicatorFormat {
853852}
854853
855854/// The settings for the image viewer.
856- #[ skip_serializing_none ]
855+ #[ with_fallible_options ]
857856#[ derive( Clone , Debug , Serialize , Deserialize , JsonSchema , MergeFrom , Default , PartialEq ) ]
858857pub struct ImageViewerSettingsContent {
859858 /// The unit to use for displaying image file sizes.
@@ -862,7 +861,7 @@ pub struct ImageViewerSettingsContent {
862861 pub unit : Option < ImageFileSizeUnit > ,
863862}
864863
865- #[ skip_serializing_none ]
864+ #[ with_fallible_options ]
866865#[ derive(
867866 Clone ,
868867 Copy ,
@@ -885,15 +884,15 @@ pub enum ImageFileSizeUnit {
885884 Decimal ,
886885}
887886
888- #[ skip_serializing_none ]
887+ #[ with_fallible_options ]
889888#[ derive( Clone , Debug , Default , Serialize , Deserialize , JsonSchema , MergeFrom , PartialEq ) ]
890889pub struct RemoteSettingsContent {
891890 pub ssh_connections : Option < Vec < SshConnection > > ,
892891 pub wsl_connections : Option < Vec < WslConnection > > ,
893892 pub read_ssh_config : Option < bool > ,
894893}
895894
896- #[ skip_serializing_none ]
895+ #[ with_fallible_options ]
897896#[ derive( Clone , Debug , Default , Serialize , Deserialize , PartialEq , JsonSchema , MergeFrom ) ]
898897pub struct SshConnection {
899898 pub host : SharedString ,
@@ -922,27 +921,25 @@ pub struct WslConnection {
922921 pub projects : BTreeSet < SshProject > ,
923922}
924923
925- #[ skip_serializing_none ]
924+ #[ with_fallible_options ]
926925#[ derive(
927926 Clone , Debug , Default , Serialize , PartialEq , Eq , PartialOrd , Ord , Deserialize , JsonSchema ,
928927) ]
929928pub struct SshProject {
930929 pub paths : Vec < String > ,
931930}
932931
933- #[ skip_serializing_none ]
932+ #[ with_fallible_options ]
934933#[ derive( Debug , Clone , PartialEq , Eq , Hash , Deserialize , Serialize , JsonSchema , MergeFrom ) ]
935934pub struct SshPortForwardOption {
936- #[ serde( skip_serializing_if = "Option::is_none" ) ]
937935 pub local_host : Option < String > ,
938936 pub local_port : u16 ,
939- #[ serde( skip_serializing_if = "Option::is_none" ) ]
940937 pub remote_host : Option < String > ,
941938 pub remote_port : u16 ,
942939}
943940
944941/// Settings for configuring REPL display and behavior.
945- #[ skip_serializing_none ]
942+ #[ with_fallible_options ]
946943#[ derive( Clone , Debug , PartialEq , Serialize , Deserialize , JsonSchema , MergeFrom ) ]
947944pub struct ReplSettingsContent {
948945 /// Maximum number of lines to keep in REPL's scrollback buffer.
0 commit comments