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