settings_content.rs

  1mod agent;
  2mod editor;
  3mod language;
  4mod language_model;
  5mod project;
  6mod terminal;
  7mod theme;
  8mod workspace;
  9
 10pub use agent::*;
 11pub use editor::*;
 12pub use language::*;
 13pub use language_model::*;
 14pub use project::*;
 15pub use terminal::*;
 16pub use theme::*;
 17pub use workspace::*;
 18
 19use collections::HashMap;
 20use gpui::{App, SharedString};
 21use release_channel::ReleaseChannel;
 22use schemars::JsonSchema;
 23use serde::{Deserialize, Serialize};
 24use std::env;
 25use std::sync::Arc;
 26pub use util::serde::default_true;
 27
 28use crate::ActiveSettingsProfileName;
 29
 30#[derive(Debug, PartialEq, Default, Clone, Serialize, Deserialize, JsonSchema)]
 31pub struct SettingsContent {
 32    #[serde(flatten)]
 33    pub project: ProjectSettingsContent,
 34
 35    #[serde(flatten)]
 36    pub theme: Box<ThemeSettingsContent>,
 37
 38    #[serde(flatten)]
 39    pub extension: ExtensionSettingsContent,
 40
 41    #[serde(flatten)]
 42    pub workspace: WorkspaceSettingsContent,
 43
 44    #[serde(flatten)]
 45    pub editor: EditorSettingsContent,
 46
 47    /// Settings related to the file finder.
 48    pub file_finder: Option<FileFinderSettingsContent>,
 49
 50    pub git_panel: Option<GitPanelSettingsContent>,
 51
 52    pub tabs: Option<ItemSettingsContent>,
 53    pub tab_bar: Option<TabBarSettingsContent>,
 54
 55    pub preview_tabs: Option<PreviewTabsSettingsContent>,
 56
 57    pub agent: Option<AgentSettingsContent>,
 58    pub agent_servers: Option<AllAgentServersSettings>,
 59
 60    /// Configuration of audio in Zed.
 61    pub audio: Option<AudioSettingsContent>,
 62
 63    /// Whether or not to automatically check for updates.
 64    ///
 65    /// Default: true
 66    pub auto_update: Option<bool>,
 67
 68    // todo!() comments?!
 69    pub base_keymap: Option<BaseKeymapContent>,
 70
 71    /// Configuration for the collab panel visual settings.
 72    pub collaboration_panel: Option<PanelSettingsContent>,
 73
 74    pub debugger: Option<DebuggerSettingsContent>,
 75
 76    /// Configuration for Diagnostics-related features.
 77    pub diagnostics: Option<DiagnosticsSettingsContent>,
 78
 79    /// Configuration for Git-related features
 80    pub git: Option<GitSettings>,
 81
 82    /// Common language server settings.
 83    pub global_lsp_settings: Option<GlobalLspSettingsContent>,
 84
 85    /// The settings for the image viewer.
 86    pub image_viewer: Option<ImageViewerSettingsContent>,
 87
 88    /// Whether or not to enable Helix mode.
 89    ///
 90    /// Default: false
 91    pub helix_mode: Option<bool>,
 92
 93    pub journal: Option<JournalSettingsContent>,
 94
 95    /// A map of log scopes to the desired log level.
 96    /// Useful for filtering out noisy logs or enabling more verbose logging.
 97    ///
 98    /// Example: {"log": {"client": "warn"}}
 99    pub log: Option<HashMap<String, String>>,
100
101    pub line_indicator_format: Option<LineIndicatorFormat>,
102
103    pub language_models: Option<AllLanguageModelSettingsContent>,
104
105    pub outline_panel: Option<OutlinePanelSettingsContent>,
106
107    /// Configuration for the Message Editor
108    pub message_editor: Option<MessageEditorSettings>,
109
110    /// Configuration for Node-related features
111    pub node: Option<NodeBinarySettings>,
112
113    /// Configuration for the Notification Panel
114    pub notification_panel: Option<NotificationPanelSettingsContent>,
115
116    pub proxy: Option<String>,
117
118    /// The URL of the Zed server to connect to.
119    pub server_url: Option<String>,
120
121    /// Configuration for session-related features
122    pub session: Option<SessionSettingsContent>,
123    /// Control what info is collected by Zed.
124    pub telemetry: Option<TelemetrySettingsContent>,
125
126    /// Configuration of the terminal in Zed.
127    pub terminal: Option<TerminalSettingsContent>,
128
129    pub title_bar: Option<TitleBarSettingsContent>,
130
131    /// Whether or not to enable Vim mode.
132    ///
133    /// Default: false
134    pub vim_mode: Option<bool>,
135
136    // Settings related to calls in Zed
137    pub calls: Option<CallSettingsContent>,
138
139    /// Whether to disable all AI features in Zed.
140    ///
141    /// Default: false
142    pub disable_ai: Option<bool>,
143
144    /// Settings related to Vim mode in Zed.
145    pub vim: Option<VimSettingsContent>,
146}
147
148impl SettingsContent {
149    pub fn languages_mut(&mut self) -> &mut HashMap<SharedString, LanguageSettingsContent> {
150        &mut self.project.all_languages.languages.0
151    }
152}
153
154// todo!() what should this be?
155#[derive(Debug, Default, Serialize, Deserialize, JsonSchema)]
156pub struct ServerSettingsContent {
157    #[serde(flatten)]
158    pub project: ProjectSettingsContent,
159}
160
161#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize, JsonSchema)]
162pub struct UserSettingsContent {
163    #[serde(flatten)]
164    pub content: Box<SettingsContent>,
165
166    pub dev: Option<Box<SettingsContent>>,
167    pub nightly: Option<Box<SettingsContent>>,
168    pub preview: Option<Box<SettingsContent>>,
169    pub stable: Option<Box<SettingsContent>>,
170
171    pub macos: Option<Box<SettingsContent>>,
172    pub windows: Option<Box<SettingsContent>>,
173    pub linux: Option<Box<SettingsContent>>,
174
175    #[serde(default)]
176    pub profiles: HashMap<String, SettingsContent>,
177}
178
179pub struct ExtensionsSettingsContent {
180    pub all_languages: AllLanguageSettingsContent,
181}
182
183impl UserSettingsContent {
184    pub fn for_release_channel(&self) -> Option<&SettingsContent> {
185        match *release_channel::RELEASE_CHANNEL {
186            ReleaseChannel::Dev => self.dev.as_deref(),
187            ReleaseChannel::Nightly => self.nightly.as_deref(),
188            ReleaseChannel::Preview => self.preview.as_deref(),
189            ReleaseChannel::Stable => self.stable.as_deref(),
190        }
191    }
192
193    pub fn for_os(&self) -> Option<&SettingsContent> {
194        match env::consts::OS {
195            "macos" => self.macos.as_deref(),
196            "linux" => self.linux.as_deref(),
197            "windows" => self.windows.as_deref(),
198            _ => None,
199        }
200    }
201
202    pub fn for_profile(&self, cx: &App) -> Option<&SettingsContent> {
203        let Some(active_profile) = cx.try_global::<ActiveSettingsProfileName>() else {
204            return None;
205        };
206        self.profiles.get(&active_profile.0)
207    }
208}
209
210/// Base key bindings scheme. Base keymaps can be overridden with user keymaps.
211///
212/// Default: VSCode
213#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Default)]
214pub enum BaseKeymapContent {
215    #[default]
216    VSCode,
217    JetBrains,
218    SublimeText,
219    Atom,
220    TextMate,
221    Emacs,
222    Cursor,
223    None,
224}
225
226#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
227pub struct TitleBarSettingsContent {
228    /// Controls when the title bar is visible: "always" | "never" | "hide_in_full_screen".
229    ///
230    /// Default: "always"
231    pub show: Option<TitleBarVisibility>,
232    /// Whether to show the branch icon beside branch switcher in the title bar.
233    ///
234    /// Default: false
235    pub show_branch_icon: Option<bool>,
236    /// Whether to show onboarding banners in the title bar.
237    ///
238    /// Default: true
239    pub show_onboarding_banner: Option<bool>,
240    /// Whether to show user avatar in the title bar.
241    ///
242    /// Default: true
243    pub show_user_picture: Option<bool>,
244    /// Whether to show the branch name button in the titlebar.
245    ///
246    /// Default: true
247    pub show_branch_name: Option<bool>,
248    /// Whether to show the project host and name in the titlebar.
249    ///
250    /// Default: true
251    pub show_project_items: Option<bool>,
252    /// Whether to show the sign in button in the title bar.
253    ///
254    /// Default: true
255    pub show_sign_in: Option<bool>,
256    /// Whether to show the menus in the title bar.
257    ///
258    /// Default: false
259    pub show_menus: Option<bool>,
260}
261
262#[derive(Copy, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Debug)]
263#[serde(rename_all = "snake_case")]
264pub enum TitleBarVisibility {
265    Always,
266    Never,
267    HideInFullScreen,
268}
269
270/// Configuration of audio in Zed.
271#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
272pub struct AudioSettingsContent {
273    /// Opt into the new audio system.
274    #[serde(rename = "experimental.rodio_audio", default)]
275    pub rodio_audio: Option<bool>,
276    /// Requires 'rodio_audio: true'
277    ///
278    /// Use the new audio systems automatic gain control for your microphone.
279    /// This affects how loud you sound to others.
280    #[serde(rename = "experimental.control_input_volume", default)]
281    pub control_input_volume: Option<bool>,
282    /// Requires 'rodio_audio: true'
283    ///
284    /// Use the new audio systems automatic gain control on everyone in the
285    /// call. This makes call members who are too quite louder and those who are
286    /// too loud quieter. This only affects how things sound for you.
287    #[serde(rename = "experimental.control_output_volume", default)]
288    pub control_output_volume: Option<bool>,
289}
290
291/// Control what info is collected by Zed.
292#[derive(Default, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Debug)]
293pub struct TelemetrySettingsContent {
294    /// Send debug info like crash reports.
295    ///
296    /// Default: true
297    pub diagnostics: Option<bool>,
298    /// Send anonymized usage data like what languages you're using Zed with.
299    ///
300    /// Default: true
301    pub metrics: Option<bool>,
302}
303
304#[derive(Default, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Clone)]
305pub struct DebuggerSettingsContent {
306    /// Determines the stepping granularity.
307    ///
308    /// Default: line
309    pub stepping_granularity: Option<SteppingGranularity>,
310    /// Whether the breakpoints should be reused across Zed sessions.
311    ///
312    /// Default: true
313    pub save_breakpoints: Option<bool>,
314    /// Whether to show the debug button in the status bar.
315    ///
316    /// Default: true
317    pub button: Option<bool>,
318    /// Time in milliseconds until timeout error when connecting to a TCP debug adapter
319    ///
320    /// Default: 2000ms
321    pub timeout: Option<u64>,
322    /// Whether to log messages between active debug adapters and Zed
323    ///
324    /// Default: true
325    pub log_dap_communications: Option<bool>,
326    /// Whether to format dap messages in when adding them to debug adapter logger
327    ///
328    /// Default: true
329    pub format_dap_log_messages: Option<bool>,
330    /// The dock position of the debug panel
331    ///
332    /// Default: Bottom
333    pub dock: Option<DockPosition>,
334}
335
336/// The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and `stepBack`.
337#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Deserialize, Serialize, JsonSchema)]
338#[serde(rename_all = "snake_case")]
339pub enum SteppingGranularity {
340    /// The step should allow the program to run until the current statement has finished executing.
341    /// The meaning of a statement is determined by the adapter and it may be considered equivalent to a line.
342    /// For example 'for(int i = 0; i < 10; i++)' could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'.
343    Statement,
344    /// The step should allow the program to run until the current source line has executed.
345    Line,
346    /// The step should allow one instruction to execute (e.g. one x86 instruction).
347    Instruction,
348}
349
350#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
351#[serde(rename_all = "snake_case")]
352pub enum DockPosition {
353    Left,
354    Bottom,
355    Right,
356}
357
358/// Settings for slash commands.
359#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, PartialEq, Eq)]
360pub struct SlashCommandSettings {
361    /// Settings for the `/cargo-workspace` slash command.
362    pub cargo_workspace: Option<CargoWorkspaceCommandSettings>,
363}
364
365/// Settings for the `/cargo-workspace` slash command.
366#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, PartialEq, Eq)]
367pub struct CargoWorkspaceCommandSettings {
368    /// Whether `/cargo-workspace` is enabled.
369    pub enabled: Option<bool>,
370}
371
372/// Configuration of voice calls in Zed.
373#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
374pub struct CallSettingsContent {
375    /// Whether the microphone should be muted when joining a channel or a call.
376    ///
377    /// Default: false
378    pub mute_on_join: Option<bool>,
379
380    /// Whether your current project should be shared when joining an empty channel.
381    ///
382    /// Default: false
383    pub share_on_join: Option<bool>,
384}
385
386#[derive(Deserialize, Serialize, PartialEq, Debug, Default, Clone, JsonSchema)]
387pub struct ExtensionSettingsContent {
388    /// The extensions that should be automatically installed by Zed.
389    ///
390    /// This is used to make functionality provided by extensions (e.g., language support)
391    /// available out-of-the-box.
392    ///
393    /// Default: { "html": true }
394    #[serde(default)]
395    pub auto_install_extensions: HashMap<Arc<str>, bool>,
396    #[serde(default)]
397    pub auto_update_extensions: HashMap<Arc<str>, bool>,
398}
399
400#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
401pub struct GitPanelSettingsContent {
402    /// Whether to show the panel button in the status bar.
403    ///
404    /// Default: true
405    pub button: Option<bool>,
406    /// Where to dock the panel.
407    ///
408    /// Default: left
409    pub dock: Option<DockPosition>,
410    /// Default width of the panel in pixels.
411    ///
412    /// Default: 360
413    pub default_width: Option<f32>,
414    /// How entry statuses are displayed.
415    ///
416    /// Default: icon
417    pub status_style: Option<StatusStyle>,
418    /// How and when the scrollbar should be displayed.
419    ///
420    /// Default: inherits editor scrollbar settings
421    pub scrollbar: Option<ScrollbarSettings>,
422
423    /// What the default branch name should be when
424    /// `init.defaultBranch` is not set in git
425    ///
426    /// Default: main
427    pub fallback_branch_name: Option<String>,
428
429    /// Whether to sort entries in the panel by path
430    /// or by status (the default).
431    ///
432    /// Default: false
433    pub sort_by_path: Option<bool>,
434
435    /// Whether to collapse untracked files in the diff panel.
436    ///
437    /// Default: false
438    pub collapse_untracked_diff: Option<bool>,
439}
440
441#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
442#[serde(rename_all = "snake_case")]
443pub enum StatusStyle {
444    #[default]
445    Icon,
446    LabelColor,
447}
448
449#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
450pub struct ScrollbarSettings {
451    pub show: Option<ShowScrollbar>,
452}
453
454#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
455pub struct NotificationPanelSettingsContent {
456    /// Whether to show the panel button in the status bar.
457    ///
458    /// Default: true
459    pub button: Option<bool>,
460    /// Where to dock the panel.
461    ///
462    /// Default: right
463    pub dock: Option<DockPosition>,
464    /// Default width of the panel in pixels.
465    ///
466    /// Default: 300
467    pub default_width: Option<f32>,
468}
469
470#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
471pub struct PanelSettingsContent {
472    /// Whether to show the panel button in the status bar.
473    ///
474    /// Default: true
475    pub button: Option<bool>,
476    /// Where to dock the panel.
477    ///
478    /// Default: left
479    pub dock: Option<DockPosition>,
480    /// Default width of the panel in pixels.
481    ///
482    /// Default: 240
483    pub default_width: Option<f32>,
484}
485
486#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
487pub struct MessageEditorSettings {
488    /// Whether to automatically replace emoji shortcodes with emoji characters.
489    /// For example: typing `:wave:` gets replaced with `👋`.
490    ///
491    /// Default: false
492    pub auto_replace_emoji_shortcode: Option<bool>,
493}
494
495#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
496pub struct FileFinderSettingsContent {
497    /// Whether to show file icons in the file finder.
498    ///
499    /// Default: true
500    pub file_icons: Option<bool>,
501    /// Determines how much space the file finder can take up in relation to the available window width.
502    ///
503    /// Default: small
504    pub modal_max_width: Option<FileFinderWidthContent>,
505    /// Determines whether the file finder should skip focus for the active file in search results.
506    ///
507    /// Default: true
508    pub skip_focus_for_active_in_search: Option<bool>,
509    /// Determines whether to show the git status in the file finder
510    ///
511    /// Default: true
512    pub git_status: Option<bool>,
513    /// Whether to use gitignored files when searching.
514    /// Only the file Zed had indexed will be used, not necessary all the gitignored files.
515    ///
516    /// Can accept 3 values:
517    /// * `Some(true)`: Use all gitignored files
518    /// * `Some(false)`: Use only the files Zed had indexed
519    /// * `None`: Be smart and search for ignored when called from a gitignored worktree
520    ///
521    /// Default: None
522    /// todo!() -> Change this type to an enum
523    pub include_ignored: Option<Option<bool>>,
524}
525
526#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
527#[serde(rename_all = "lowercase")]
528pub enum FileFinderWidthContent {
529    #[default]
530    Small,
531    Medium,
532    Large,
533    XLarge,
534    Full,
535}
536
537#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Debug, JsonSchema)]
538pub struct VimSettingsContent {
539    pub default_mode: Option<ModeContent>,
540    pub toggle_relative_line_numbers: Option<bool>,
541    pub use_system_clipboard: Option<UseSystemClipboard>,
542    pub use_smartcase_find: Option<bool>,
543    pub custom_digraphs: Option<HashMap<String, Arc<str>>>,
544    pub highlight_on_yank_duration: Option<u64>,
545    pub cursor_shape: Option<CursorShapeSettings>,
546}
547
548#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, PartialEq, Debug)]
549#[serde(rename_all = "snake_case")]
550pub enum ModeContent {
551    #[default]
552    Normal,
553    Insert,
554    Replace,
555    Visual,
556    VisualLine,
557    VisualBlock,
558    HelixNormal,
559}
560
561/// Controls when to use system clipboard.
562#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
563#[serde(rename_all = "snake_case")]
564pub enum UseSystemClipboard {
565    /// Don't use system clipboard.
566    Never,
567    /// Use system clipboard.
568    Always,
569    /// Use system clipboard for yank operations.
570    OnYank,
571}
572
573/// The settings for cursor shape.
574#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
575pub struct CursorShapeSettings {
576    /// Cursor shape for the normal mode.
577    ///
578    /// Default: block
579    pub normal: Option<CursorShape>,
580    /// Cursor shape for the replace mode.
581    ///
582    /// Default: underline
583    pub replace: Option<CursorShape>,
584    /// Cursor shape for the visual mode.
585    ///
586    /// Default: block
587    pub visual: Option<CursorShape>,
588    /// Cursor shape for the insert mode.
589    ///
590    /// The default value follows the primary cursor_shape.
591    pub insert: Option<CursorShape>,
592}
593
594/// Settings specific to journaling
595#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
596pub struct JournalSettingsContent {
597    /// The path of the directory where journal entries are stored.
598    ///
599    /// Default: `~`
600    pub path: Option<String>,
601    /// What format to display the hours in.
602    ///
603    /// Default: hour12
604    pub hour_format: Option<HourFormat>,
605}
606
607#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
608#[serde(rename_all = "snake_case")]
609pub enum HourFormat {
610    #[default]
611    Hour12,
612    Hour24,
613}
614
615#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
616pub struct OutlinePanelSettingsContent {
617    /// Whether to show the outline panel button in the status bar.
618    ///
619    /// Default: true
620    pub button: Option<bool>,
621    /// Customize default width (in pixels) taken by outline panel
622    ///
623    /// Default: 240
624    pub default_width: Option<f32>,
625    /// The position of outline panel
626    ///
627    /// Default: left
628    pub dock: Option<OutlinePanelDockPosition>,
629    /// Whether to show file icons in the outline panel.
630    ///
631    /// Default: true
632    pub file_icons: Option<bool>,
633    /// Whether to show folder icons or chevrons for directories in the outline panel.
634    ///
635    /// Default: true
636    pub folder_icons: Option<bool>,
637    /// Whether to show the git status in the outline panel.
638    ///
639    /// Default: true
640    pub git_status: Option<bool>,
641    /// Amount of indentation (in pixels) for nested items.
642    ///
643    /// Default: 20
644    pub indent_size: Option<f32>,
645    /// Whether to reveal it in the outline panel automatically,
646    /// when a corresponding project entry becomes active.
647    /// Gitignored entries are never auto revealed.
648    ///
649    /// Default: true
650    pub auto_reveal_entries: Option<bool>,
651    /// Whether to fold directories automatically
652    /// when directory has only one directory inside.
653    ///
654    /// Default: true
655    pub auto_fold_dirs: Option<bool>,
656    /// Settings related to indent guides in the outline panel.
657    pub indent_guides: Option<IndentGuidesSettingsContent>,
658    /// Scrollbar-related settings
659    pub scrollbar: Option<ScrollbarSettingsContent>,
660    /// Default depth to expand outline items in the current file.
661    /// The default depth to which outline entries are expanded on reveal.
662    /// - Set to 0 to collapse all items that have children
663    /// - Set to 1 or higher to collapse items at that depth or deeper
664    ///
665    /// Default: 100
666    pub expand_outlines_with_depth: Option<usize>,
667}
668
669#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Copy, PartialEq)]
670#[serde(rename_all = "snake_case")]
671pub enum OutlinePanelDockPosition {
672    Left,
673    Right,
674}
675
676#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize, JsonSchema)]
677#[serde(rename_all = "snake_case")]
678pub enum ShowIndentGuides {
679    Always,
680    Never,
681}
682
683#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
684pub struct IndentGuidesSettingsContent {
685    /// When to show the scrollbar in the outline panel.
686    pub show: Option<ShowIndentGuides>,
687}
688
689#[derive(Clone, Copy, Default, PartialEq, Debug, JsonSchema, Deserialize, Serialize)]
690#[serde(rename_all = "snake_case")]
691pub enum LineIndicatorFormat {
692    Short,
693    #[default]
694    Long,
695}
696
697/// The settings for the image viewer.
698#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Default, PartialEq)]
699pub struct ImageViewerSettingsContent {
700    /// The unit to use for displaying image file sizes.
701    ///
702    /// Default: "binary"
703    pub unit: Option<ImageFileSizeUnit>,
704}
705
706#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema, Default, PartialEq)]
707#[serde(rename_all = "snake_case")]
708pub enum ImageFileSizeUnit {
709    /// Displays file size in binary units (e.g., KiB, MiB).
710    #[default]
711    Binary,
712    /// Displays file size in decimal units (e.g., KB, MB).
713    Decimal,
714}