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