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    #[serde(rename = "experimental.rodio_audio", default)]
292    pub rodio_audio: Option<bool>,
293    /// Requires 'rodio_audio: true'
294    ///
295    /// Use the new audio systems automatic gain control for your microphone.
296    /// This affects how loud you sound to others.
297    #[serde(rename = "experimental.control_input_volume", default)]
298    pub control_input_volume: Option<bool>,
299    /// Requires 'rodio_audio: true'
300    ///
301    /// Use the new audio systems automatic gain control on everyone in the
302    /// call. This makes call members who are too quite louder and those who are
303    /// too loud quieter. This only affects how things sound for you.
304    #[serde(rename = "experimental.control_output_volume", default)]
305    pub control_output_volume: Option<bool>,
306}
307
308/// Control what info is collected by Zed.
309#[skip_serializing_none]
310#[derive(Default, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Debug)]
311pub struct TelemetrySettingsContent {
312    /// Send debug info like crash reports.
313    ///
314    /// Default: true
315    pub diagnostics: Option<bool>,
316    /// Send anonymized usage data like what languages you're using Zed with.
317    ///
318    /// Default: true
319    pub metrics: Option<bool>,
320}
321
322#[skip_serializing_none]
323#[derive(Default, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Clone)]
324pub struct DebuggerSettingsContent {
325    /// Determines the stepping granularity.
326    ///
327    /// Default: line
328    pub stepping_granularity: Option<SteppingGranularity>,
329    /// Whether the breakpoints should be reused across Zed sessions.
330    ///
331    /// Default: true
332    pub save_breakpoints: Option<bool>,
333    /// Whether to show the debug button in the status bar.
334    ///
335    /// Default: true
336    pub button: Option<bool>,
337    /// Time in milliseconds until timeout error when connecting to a TCP debug adapter
338    ///
339    /// Default: 2000ms
340    pub timeout: Option<u64>,
341    /// Whether to log messages between active debug adapters and Zed
342    ///
343    /// Default: true
344    pub log_dap_communications: Option<bool>,
345    /// Whether to format dap messages in when adding them to debug adapter logger
346    ///
347    /// Default: true
348    pub format_dap_log_messages: Option<bool>,
349    /// The dock position of the debug panel
350    ///
351    /// Default: Bottom
352    pub dock: Option<DockPosition>,
353}
354
355/// The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and `stepBack`.
356#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Deserialize, Serialize, JsonSchema)]
357#[serde(rename_all = "snake_case")]
358pub enum SteppingGranularity {
359    /// The step should allow the program to run until the current statement has finished executing.
360    /// The meaning of a statement is determined by the adapter and it may be considered equivalent to a line.
361    /// For example 'for(int i = 0; i < 10; i++)' could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'.
362    Statement,
363    /// The step should allow the program to run until the current source line has executed.
364    Line,
365    /// The step should allow one instruction to execute (e.g. one x86 instruction).
366    Instruction,
367}
368
369#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
370#[serde(rename_all = "snake_case")]
371pub enum DockPosition {
372    Left,
373    Bottom,
374    Right,
375}
376
377/// Settings for slash commands.
378#[skip_serializing_none]
379#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, PartialEq, Eq)]
380pub struct SlashCommandSettings {
381    /// Settings for the `/cargo-workspace` slash command.
382    pub cargo_workspace: Option<CargoWorkspaceCommandSettings>,
383}
384
385/// Settings for the `/cargo-workspace` slash command.
386#[skip_serializing_none]
387#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, PartialEq, Eq)]
388pub struct CargoWorkspaceCommandSettings {
389    /// Whether `/cargo-workspace` is enabled.
390    pub enabled: Option<bool>,
391}
392
393/// Configuration of voice calls in Zed.
394#[skip_serializing_none]
395#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
396pub struct CallSettingsContent {
397    /// Whether the microphone should be muted when joining a channel or a call.
398    ///
399    /// Default: false
400    pub mute_on_join: Option<bool>,
401
402    /// Whether your current project should be shared when joining an empty channel.
403    ///
404    /// Default: false
405    pub share_on_join: Option<bool>,
406}
407
408#[skip_serializing_none]
409#[derive(Deserialize, Serialize, PartialEq, Debug, Default, Clone, JsonSchema)]
410pub struct ExtensionSettingsContent {
411    /// The extensions that should be automatically installed by Zed.
412    ///
413    /// This is used to make functionality provided by extensions (e.g., language support)
414    /// available out-of-the-box.
415    ///
416    /// Default: { "html": true }
417    #[serde(default)]
418    pub auto_install_extensions: HashMap<Arc<str>, bool>,
419    #[serde(default)]
420    pub auto_update_extensions: HashMap<Arc<str>, bool>,
421}
422
423#[skip_serializing_none]
424#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
425pub struct GitPanelSettingsContent {
426    /// Whether to show the panel button in the status bar.
427    ///
428    /// Default: true
429    pub button: Option<bool>,
430    /// Where to dock the panel.
431    ///
432    /// Default: left
433    pub dock: Option<DockPosition>,
434    /// Default width of the panel in pixels.
435    ///
436    /// Default: 360
437    pub default_width: Option<f32>,
438    /// How entry statuses are displayed.
439    ///
440    /// Default: icon
441    pub status_style: Option<StatusStyle>,
442    /// How and when the scrollbar should be displayed.
443    ///
444    /// Default: inherits editor scrollbar settings
445    pub scrollbar: Option<ScrollbarSettings>,
446
447    /// What the default branch name should be when
448    /// `init.defaultBranch` is not set in git
449    ///
450    /// Default: main
451    pub fallback_branch_name: Option<String>,
452
453    /// Whether to sort entries in the panel by path
454    /// or by status (the default).
455    ///
456    /// Default: false
457    pub sort_by_path: Option<bool>,
458
459    /// Whether to collapse untracked files in the diff panel.
460    ///
461    /// Default: false
462    pub collapse_untracked_diff: Option<bool>,
463}
464
465#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
466#[serde(rename_all = "snake_case")]
467pub enum StatusStyle {
468    #[default]
469    Icon,
470    LabelColor,
471}
472
473#[skip_serializing_none]
474#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
475pub struct ScrollbarSettings {
476    pub show: Option<ShowScrollbar>,
477}
478
479#[skip_serializing_none]
480#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
481pub struct NotificationPanelSettingsContent {
482    /// Whether to show the panel button in the status bar.
483    ///
484    /// Default: true
485    pub button: Option<bool>,
486    /// Where to dock the panel.
487    ///
488    /// Default: right
489    pub dock: Option<DockPosition>,
490    /// Default width of the panel in pixels.
491    ///
492    /// Default: 300
493    pub default_width: Option<f32>,
494}
495
496#[skip_serializing_none]
497#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
498pub struct PanelSettingsContent {
499    /// Whether to show the panel button in the status bar.
500    ///
501    /// Default: true
502    pub button: Option<bool>,
503    /// Where to dock the panel.
504    ///
505    /// Default: left
506    pub dock: Option<DockPosition>,
507    /// Default width of the panel in pixels.
508    ///
509    /// Default: 240
510    pub default_width: Option<f32>,
511}
512
513#[skip_serializing_none]
514#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
515pub struct MessageEditorSettings {
516    /// Whether to automatically replace emoji shortcodes with emoji characters.
517    /// For example: typing `:wave:` gets replaced with `👋`.
518    ///
519    /// Default: false
520    pub auto_replace_emoji_shortcode: Option<bool>,
521}
522
523#[skip_serializing_none]
524#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
525pub struct FileFinderSettingsContent {
526    /// Whether to show file icons in the file finder.
527    ///
528    /// Default: true
529    pub file_icons: Option<bool>,
530    /// Determines how much space the file finder can take up in relation to the available window width.
531    ///
532    /// Default: small
533    pub modal_max_width: Option<FileFinderWidthContent>,
534    /// Determines whether the file finder should skip focus for the active file in search results.
535    ///
536    /// Default: true
537    pub skip_focus_for_active_in_search: Option<bool>,
538    /// Determines whether to show the git status in the file finder
539    ///
540    /// Default: true
541    pub git_status: Option<bool>,
542    /// Whether to use gitignored files when searching.
543    /// Only the file Zed had indexed will be used, not necessary all the gitignored files.
544    ///
545    /// Can accept 3 values:
546    /// * `Some(true)`: Use all gitignored files
547    /// * `Some(false)`: Use only the files Zed had indexed
548    /// * `None`: Be smart and search for ignored when called from a gitignored worktree
549    ///
550    /// Default: None
551    /// todo() -> Change this type to an enum
552    pub include_ignored: Option<Option<bool>>,
553}
554
555#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
556#[serde(rename_all = "lowercase")]
557pub enum FileFinderWidthContent {
558    #[default]
559    Small,
560    Medium,
561    Large,
562    XLarge,
563    Full,
564}
565
566#[skip_serializing_none]
567#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Debug, JsonSchema)]
568pub struct VimSettingsContent {
569    pub default_mode: Option<ModeContent>,
570    pub toggle_relative_line_numbers: Option<bool>,
571    pub use_system_clipboard: Option<UseSystemClipboard>,
572    pub use_smartcase_find: Option<bool>,
573    pub custom_digraphs: Option<HashMap<String, Arc<str>>>,
574    pub highlight_on_yank_duration: Option<u64>,
575    pub cursor_shape: Option<CursorShapeSettings>,
576}
577
578#[derive(Copy, Clone, Default, Serialize, Deserialize, JsonSchema, PartialEq, Debug)]
579#[serde(rename_all = "snake_case")]
580pub enum ModeContent {
581    #[default]
582    Normal,
583    Insert,
584    HelixNormal,
585}
586
587/// Controls when to use system clipboard.
588#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
589#[serde(rename_all = "snake_case")]
590pub enum UseSystemClipboard {
591    /// Don't use system clipboard.
592    Never,
593    /// Use system clipboard.
594    Always,
595    /// Use system clipboard for yank operations.
596    OnYank,
597}
598
599/// The settings for cursor shape.
600#[skip_serializing_none]
601#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
602pub struct CursorShapeSettings {
603    /// Cursor shape for the normal mode.
604    ///
605    /// Default: block
606    pub normal: Option<CursorShape>,
607    /// Cursor shape for the replace mode.
608    ///
609    /// Default: underline
610    pub replace: Option<CursorShape>,
611    /// Cursor shape for the visual mode.
612    ///
613    /// Default: block
614    pub visual: Option<CursorShape>,
615    /// Cursor shape for the insert mode.
616    ///
617    /// The default value follows the primary cursor_shape.
618    pub insert: Option<CursorShape>,
619}
620
621/// Settings specific to journaling
622#[skip_serializing_none]
623#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
624pub struct JournalSettingsContent {
625    /// The path of the directory where journal entries are stored.
626    ///
627    /// Default: `~`
628    pub path: Option<String>,
629    /// What format to display the hours in.
630    ///
631    /// Default: hour12
632    pub hour_format: Option<HourFormat>,
633}
634
635#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
636#[serde(rename_all = "snake_case")]
637pub enum HourFormat {
638    #[default]
639    Hour12,
640    Hour24,
641}
642
643#[skip_serializing_none]
644#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
645pub struct OutlinePanelSettingsContent {
646    /// Whether to show the outline panel button in the status bar.
647    ///
648    /// Default: true
649    pub button: Option<bool>,
650    /// Customize default width (in pixels) taken by outline panel
651    ///
652    /// Default: 240
653    pub default_width: Option<f32>,
654    /// The position of outline panel
655    ///
656    /// Default: left
657    pub dock: Option<DockSide>,
658    /// Whether to show file icons in the outline panel.
659    ///
660    /// Default: true
661    pub file_icons: Option<bool>,
662    /// Whether to show folder icons or chevrons for directories in the outline panel.
663    ///
664    /// Default: true
665    pub folder_icons: Option<bool>,
666    /// Whether to show the git status in the outline panel.
667    ///
668    /// Default: true
669    pub git_status: Option<bool>,
670    /// Amount of indentation (in pixels) for nested items.
671    ///
672    /// Default: 20
673    pub indent_size: Option<f32>,
674    /// Whether to reveal it in the outline panel automatically,
675    /// when a corresponding project entry becomes active.
676    /// Gitignored entries are never auto revealed.
677    ///
678    /// Default: true
679    pub auto_reveal_entries: Option<bool>,
680    /// Whether to fold directories automatically
681    /// when directory has only one directory inside.
682    ///
683    /// Default: true
684    pub auto_fold_dirs: Option<bool>,
685    /// Settings related to indent guides in the outline panel.
686    pub indent_guides: Option<IndentGuidesSettingsContent>,
687    /// Scrollbar-related settings
688    pub scrollbar: Option<ScrollbarSettingsContent>,
689    /// Default depth to expand outline items in the current file.
690    /// The default depth to which outline entries are expanded on reveal.
691    /// - Set to 0 to collapse all items that have children
692    /// - Set to 1 or higher to collapse items at that depth or deeper
693    ///
694    /// Default: 100
695    pub expand_outlines_with_depth: Option<usize>,
696}
697
698#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Copy, PartialEq)]
699#[serde(rename_all = "snake_case")]
700pub enum DockSide {
701    Left,
702    Right,
703}
704
705#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize, JsonSchema)]
706#[serde(rename_all = "snake_case")]
707pub enum ShowIndentGuides {
708    Always,
709    Never,
710}
711
712#[skip_serializing_none]
713#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
714pub struct IndentGuidesSettingsContent {
715    /// When to show the scrollbar in the outline panel.
716    pub show: Option<ShowIndentGuides>,
717}
718
719#[derive(Clone, Copy, Default, PartialEq, Debug, JsonSchema, Deserialize, Serialize)]
720#[serde(rename_all = "snake_case")]
721pub enum LineIndicatorFormat {
722    Short,
723    #[default]
724    Long,
725}
726
727/// The settings for the image viewer.
728#[skip_serializing_none]
729#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Default, PartialEq)]
730pub struct ImageViewerSettingsContent {
731    /// The unit to use for displaying image file sizes.
732    ///
733    /// Default: "binary"
734    pub unit: Option<ImageFileSizeUnit>,
735}
736
737#[skip_serializing_none]
738#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema, Default, PartialEq)]
739#[serde(rename_all = "snake_case")]
740pub enum ImageFileSizeUnit {
741    /// Displays file size in binary units (e.g., KiB, MiB).
742    #[default]
743    Binary,
744    /// Displays file size in decimal units (e.g., KB, MB).
745    Decimal,
746}
747
748#[skip_serializing_none]
749#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
750pub struct RemoteSettingsContent {
751    pub ssh_connections: Option<Vec<SshConnection>>,
752    pub wsl_connections: Option<Vec<WslConnection>>,
753    pub read_ssh_config: Option<bool>,
754}
755
756#[skip_serializing_none]
757#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, JsonSchema)]
758pub struct SshConnection {
759    pub host: SharedString,
760    pub username: Option<String>,
761    pub port: Option<u16>,
762    #[serde(default)]
763    pub args: Vec<String>,
764    #[serde(default)]
765    pub projects: collections::BTreeSet<SshProject>,
766    /// Name to use for this server in UI.
767    pub nickname: Option<String>,
768    // By default Zed will download the binary to the host directly.
769    // If this is set to true, Zed will download the binary to your local machine,
770    // and then upload it over the SSH connection. Useful if your SSH server has
771    // limited outbound internet access.
772    pub upload_binary_over_ssh: Option<bool>,
773
774    pub port_forwards: Option<Vec<SshPortForwardOption>>,
775}
776
777#[derive(Clone, Default, Serialize, Deserialize, PartialEq, JsonSchema, Debug)]
778pub struct WslConnection {
779    pub distro_name: SharedString,
780    pub user: Option<String>,
781    #[serde(default)]
782    pub projects: BTreeSet<SshProject>,
783}
784
785#[skip_serializing_none]
786#[derive(
787    Clone, Debug, Default, Serialize, PartialEq, Eq, PartialOrd, Ord, Deserialize, JsonSchema,
788)]
789pub struct SshProject {
790    pub paths: Vec<String>,
791}
792
793#[skip_serializing_none]
794#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, JsonSchema)]
795pub struct SshPortForwardOption {
796    #[serde(skip_serializing_if = "Option::is_none")]
797    pub local_host: Option<String>,
798    pub local_port: u16,
799    #[serde(skip_serializing_if = "Option::is_none")]
800    pub remote_host: Option<String>,
801    pub remote_port: u16,
802}
803
804/// Settings for configuring REPL display and behavior.
805#[skip_serializing_none]
806#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
807pub struct ReplSettingsContent {
808    /// Maximum number of lines to keep in REPL's scrollback buffer.
809    /// Clamped with [4, 256] range.
810    ///
811    /// Default: 32
812    pub max_lines: Option<usize>,
813    /// Maximum number of columns to keep in REPL's scrollback buffer.
814    /// Clamped with [20, 512] range.
815    ///
816    /// Default: 128
817    pub max_columns: Option<usize>,
818}