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