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