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