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