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 pub repl: Option<ReplSettingsContent>,
92
93 /// Whether or not to enable Helix mode.
94 ///
95 /// Default: false
96 pub helix_mode: Option<bool>,
97
98 pub journal: Option<JournalSettingsContent>,
99
100 /// A map of log scopes to the desired log level.
101 /// Useful for filtering out noisy logs or enabling more verbose logging.
102 ///
103 /// Example: {"log": {"client": "warn"}}
104 pub log: Option<HashMap<String, String>>,
105
106 pub line_indicator_format: Option<LineIndicatorFormat>,
107
108 pub language_models: Option<AllLanguageModelSettingsContent>,
109
110 pub outline_panel: Option<OutlinePanelSettingsContent>,
111
112 pub project_panel: Option<ProjectPanelSettingsContent>,
113
114 /// Configuration for the Message Editor
115 pub message_editor: Option<MessageEditorSettings>,
116
117 /// Configuration for Node-related features
118 pub node: Option<NodeBinarySettings>,
119
120 /// Configuration for the Notification Panel
121 pub notification_panel: Option<NotificationPanelSettingsContent>,
122
123 pub proxy: Option<String>,
124
125 /// The URL of the Zed server to connect to.
126 pub server_url: Option<String>,
127
128 /// Configuration for session-related features
129 pub session: Option<SessionSettingsContent>,
130 /// Control what info is collected by Zed.
131 pub telemetry: Option<TelemetrySettingsContent>,
132
133 /// Configuration of the terminal in Zed.
134 pub terminal: Option<TerminalSettingsContent>,
135
136 pub title_bar: Option<TitleBarSettingsContent>,
137
138 /// Whether or not to enable Vim mode.
139 ///
140 /// Default: false
141 pub vim_mode: Option<bool>,
142
143 // Settings related to calls in Zed
144 pub calls: Option<CallSettingsContent>,
145
146 /// Whether to disable all AI features in Zed.
147 ///
148 /// Default: false
149 pub disable_ai: Option<bool>,
150
151 /// Settings related to Vim mode in Zed.
152 pub vim: Option<VimSettingsContent>,
153}
154
155impl SettingsContent {
156 pub fn languages_mut(&mut self) -> &mut HashMap<SharedString, LanguageSettingsContent> {
157 &mut self.project.all_languages.languages.0
158 }
159}
160
161// todo!() what should this be?
162#[derive(Debug, Default, Serialize, Deserialize, JsonSchema)]
163pub struct ServerSettingsContent {
164 #[serde(flatten)]
165 pub project: ProjectSettingsContent,
166}
167
168#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize, JsonSchema)]
169pub struct UserSettingsContent {
170 #[serde(flatten)]
171 pub content: Box<SettingsContent>,
172
173 pub dev: Option<Box<SettingsContent>>,
174 pub nightly: Option<Box<SettingsContent>>,
175 pub preview: Option<Box<SettingsContent>>,
176 pub stable: Option<Box<SettingsContent>>,
177
178 pub macos: Option<Box<SettingsContent>>,
179 pub windows: Option<Box<SettingsContent>>,
180 pub linux: Option<Box<SettingsContent>>,
181
182 #[serde(default)]
183 pub profiles: HashMap<String, SettingsContent>,
184}
185
186pub struct ExtensionsSettingsContent {
187 pub all_languages: AllLanguageSettingsContent,
188}
189
190impl UserSettingsContent {
191 pub fn for_release_channel(&self) -> Option<&SettingsContent> {
192 match *release_channel::RELEASE_CHANNEL {
193 ReleaseChannel::Dev => self.dev.as_deref(),
194 ReleaseChannel::Nightly => self.nightly.as_deref(),
195 ReleaseChannel::Preview => self.preview.as_deref(),
196 ReleaseChannel::Stable => self.stable.as_deref(),
197 }
198 }
199
200 pub fn for_os(&self) -> Option<&SettingsContent> {
201 match env::consts::OS {
202 "macos" => self.macos.as_deref(),
203 "linux" => self.linux.as_deref(),
204 "windows" => self.windows.as_deref(),
205 _ => None,
206 }
207 }
208
209 pub fn for_profile(&self, cx: &App) -> Option<&SettingsContent> {
210 let Some(active_profile) = cx.try_global::<ActiveSettingsProfileName>() else {
211 return None;
212 };
213 self.profiles.get(&active_profile.0)
214 }
215}
216
217/// Base key bindings scheme. Base keymaps can be overridden with user keymaps.
218///
219/// Default: VSCode
220#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Default)]
221pub enum BaseKeymapContent {
222 #[default]
223 VSCode,
224 JetBrains,
225 SublimeText,
226 Atom,
227 TextMate,
228 Emacs,
229 Cursor,
230 None,
231}
232
233#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
234pub struct TitleBarSettingsContent {
235 /// Controls when the title bar is visible: "always" | "never" | "hide_in_full_screen".
236 ///
237 /// Default: "always"
238 pub show: Option<TitleBarVisibility>,
239 /// Whether to show the branch icon beside branch switcher in the title bar.
240 ///
241 /// Default: false
242 pub show_branch_icon: Option<bool>,
243 /// Whether to show onboarding banners in the title bar.
244 ///
245 /// Default: true
246 pub show_onboarding_banner: Option<bool>,
247 /// Whether to show user avatar in the title bar.
248 ///
249 /// Default: true
250 pub show_user_picture: Option<bool>,
251 /// Whether to show the branch name button in the titlebar.
252 ///
253 /// Default: true
254 pub show_branch_name: Option<bool>,
255 /// Whether to show the project host and name in the titlebar.
256 ///
257 /// Default: true
258 pub show_project_items: Option<bool>,
259 /// Whether to show the sign in button in the title bar.
260 ///
261 /// Default: true
262 pub show_sign_in: Option<bool>,
263 /// Whether to show the menus in the title bar.
264 ///
265 /// Default: false
266 pub show_menus: Option<bool>,
267}
268
269#[derive(Copy, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Debug)]
270#[serde(rename_all = "snake_case")]
271pub enum TitleBarVisibility {
272 Always,
273 Never,
274 HideInFullScreen,
275}
276
277/// Configuration of audio in Zed.
278#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
279pub struct AudioSettingsContent {
280 /// Opt into the new audio system.
281 #[serde(rename = "experimental.rodio_audio", default)]
282 pub rodio_audio: Option<bool>,
283 /// Requires 'rodio_audio: true'
284 ///
285 /// Use the new audio systems automatic gain control for your microphone.
286 /// This affects how loud you sound to others.
287 #[serde(rename = "experimental.control_input_volume", default)]
288 pub control_input_volume: Option<bool>,
289 /// Requires 'rodio_audio: true'
290 ///
291 /// Use the new audio systems automatic gain control on everyone in the
292 /// call. This makes call members who are too quite louder and those who are
293 /// too loud quieter. This only affects how things sound for you.
294 #[serde(rename = "experimental.control_output_volume", default)]
295 pub control_output_volume: Option<bool>,
296}
297
298/// Control what info is collected by Zed.
299#[derive(Default, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Debug)]
300pub struct TelemetrySettingsContent {
301 /// Send debug info like crash reports.
302 ///
303 /// Default: true
304 pub diagnostics: Option<bool>,
305 /// Send anonymized usage data like what languages you're using Zed with.
306 ///
307 /// Default: true
308 pub metrics: Option<bool>,
309}
310
311#[derive(Default, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Clone)]
312pub struct DebuggerSettingsContent {
313 /// Determines the stepping granularity.
314 ///
315 /// Default: line
316 pub stepping_granularity: Option<SteppingGranularity>,
317 /// Whether the breakpoints should be reused across Zed sessions.
318 ///
319 /// Default: true
320 pub save_breakpoints: Option<bool>,
321 /// Whether to show the debug button in the status bar.
322 ///
323 /// Default: true
324 pub button: Option<bool>,
325 /// Time in milliseconds until timeout error when connecting to a TCP debug adapter
326 ///
327 /// Default: 2000ms
328 pub timeout: Option<u64>,
329 /// Whether to log messages between active debug adapters and Zed
330 ///
331 /// Default: true
332 pub log_dap_communications: Option<bool>,
333 /// Whether to format dap messages in when adding them to debug adapter logger
334 ///
335 /// Default: true
336 pub format_dap_log_messages: Option<bool>,
337 /// The dock position of the debug panel
338 ///
339 /// Default: Bottom
340 pub dock: Option<DockPosition>,
341}
342
343/// The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and `stepBack`.
344#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Deserialize, Serialize, JsonSchema)]
345#[serde(rename_all = "snake_case")]
346pub enum SteppingGranularity {
347 /// The step should allow the program to run until the current statement has finished executing.
348 /// The meaning of a statement is determined by the adapter and it may be considered equivalent to a line.
349 /// For example 'for(int i = 0; i < 10; i++)' could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'.
350 Statement,
351 /// The step should allow the program to run until the current source line has executed.
352 Line,
353 /// The step should allow one instruction to execute (e.g. one x86 instruction).
354 Instruction,
355}
356
357#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
358#[serde(rename_all = "snake_case")]
359pub enum DockPosition {
360 Left,
361 Bottom,
362 Right,
363}
364
365/// Settings for slash commands.
366#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, PartialEq, Eq)]
367pub struct SlashCommandSettings {
368 /// Settings for the `/cargo-workspace` slash command.
369 pub cargo_workspace: Option<CargoWorkspaceCommandSettings>,
370}
371
372/// Settings for the `/cargo-workspace` slash command.
373#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, PartialEq, Eq)]
374pub struct CargoWorkspaceCommandSettings {
375 /// Whether `/cargo-workspace` is enabled.
376 pub enabled: Option<bool>,
377}
378
379/// Configuration of voice calls in Zed.
380#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
381pub struct CallSettingsContent {
382 /// Whether the microphone should be muted when joining a channel or a call.
383 ///
384 /// Default: false
385 pub mute_on_join: Option<bool>,
386
387 /// Whether your current project should be shared when joining an empty channel.
388 ///
389 /// Default: false
390 pub share_on_join: Option<bool>,
391}
392
393#[derive(Deserialize, Serialize, PartialEq, Debug, Default, Clone, JsonSchema)]
394pub struct ExtensionSettingsContent {
395 /// The extensions that should be automatically installed by Zed.
396 ///
397 /// This is used to make functionality provided by extensions (e.g., language support)
398 /// available out-of-the-box.
399 ///
400 /// Default: { "html": true }
401 #[serde(default)]
402 pub auto_install_extensions: HashMap<Arc<str>, bool>,
403 #[serde(default)]
404 pub auto_update_extensions: HashMap<Arc<str>, bool>,
405}
406
407#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, Debug)]
408pub struct GitPanelSettingsContent {
409 /// Whether to show the panel button in the status bar.
410 ///
411 /// Default: true
412 pub button: Option<bool>,
413 /// Where to dock the panel.
414 ///
415 /// Default: left
416 pub dock: Option<DockPosition>,
417 /// Default width of the panel in pixels.
418 ///
419 /// Default: 360
420 pub default_width: Option<f32>,
421 /// How entry statuses are displayed.
422 ///
423 /// Default: icon
424 pub status_style: Option<StatusStyle>,
425 /// How and when the scrollbar should be displayed.
426 ///
427 /// Default: inherits editor scrollbar settings
428 pub scrollbar: Option<ScrollbarSettings>,
429
430 /// What the default branch name should be when
431 /// `init.defaultBranch` is not set in git
432 ///
433 /// Default: main
434 pub fallback_branch_name: Option<String>,
435
436 /// Whether to sort entries in the panel by path
437 /// or by status (the default).
438 ///
439 /// Default: false
440 pub sort_by_path: Option<bool>,
441
442 /// Whether to collapse untracked files in the diff panel.
443 ///
444 /// Default: false
445 pub collapse_untracked_diff: Option<bool>,
446}
447
448#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
449#[serde(rename_all = "snake_case")]
450pub enum StatusStyle {
451 #[default]
452 Icon,
453 LabelColor,
454}
455
456#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
457pub struct ScrollbarSettings {
458 pub show: Option<ShowScrollbar>,
459}
460
461#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
462pub struct NotificationPanelSettingsContent {
463 /// Whether to show the panel button in the status bar.
464 ///
465 /// Default: true
466 pub button: Option<bool>,
467 /// Where to dock the panel.
468 ///
469 /// Default: right
470 pub dock: Option<DockPosition>,
471 /// Default width of the panel in pixels.
472 ///
473 /// Default: 300
474 pub default_width: Option<f32>,
475}
476
477#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
478pub struct PanelSettingsContent {
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: left
486 pub dock: Option<DockPosition>,
487 /// Default width of the panel in pixels.
488 ///
489 /// Default: 240
490 pub default_width: Option<f32>,
491}
492
493#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
494pub struct MessageEditorSettings {
495 /// Whether to automatically replace emoji shortcodes with emoji characters.
496 /// For example: typing `:wave:` gets replaced with `👋`.
497 ///
498 /// Default: false
499 pub auto_replace_emoji_shortcode: Option<bool>,
500}
501
502#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug, PartialEq)]
503pub struct FileFinderSettingsContent {
504 /// Whether to show file icons in the file finder.
505 ///
506 /// Default: true
507 pub file_icons: Option<bool>,
508 /// Determines how much space the file finder can take up in relation to the available window width.
509 ///
510 /// Default: small
511 pub modal_max_width: Option<FileFinderWidthContent>,
512 /// Determines whether the file finder should skip focus for the active file in search results.
513 ///
514 /// Default: true
515 pub skip_focus_for_active_in_search: Option<bool>,
516 /// Determines whether to show the git status in the file finder
517 ///
518 /// Default: true
519 pub git_status: Option<bool>,
520 /// Whether to use gitignored files when searching.
521 /// Only the file Zed had indexed will be used, not necessary all the gitignored files.
522 ///
523 /// Can accept 3 values:
524 /// * `Some(true)`: Use all gitignored files
525 /// * `Some(false)`: Use only the files Zed had indexed
526 /// * `None`: Be smart and search for ignored when called from a gitignored worktree
527 ///
528 /// Default: None
529 /// todo() -> Change this type to an enum
530 pub include_ignored: Option<Option<bool>>,
531}
532
533#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
534#[serde(rename_all = "lowercase")]
535pub enum FileFinderWidthContent {
536 #[default]
537 Small,
538 Medium,
539 Large,
540 XLarge,
541 Full,
542}
543
544#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Debug, JsonSchema)]
545pub struct VimSettingsContent {
546 pub default_mode: Option<ModeContent>,
547 pub toggle_relative_line_numbers: Option<bool>,
548 pub use_system_clipboard: Option<UseSystemClipboard>,
549 pub use_smartcase_find: Option<bool>,
550 pub custom_digraphs: Option<HashMap<String, Arc<str>>>,
551 pub highlight_on_yank_duration: Option<u64>,
552 pub cursor_shape: Option<CursorShapeSettings>,
553}
554
555#[derive(Copy, Clone, Default, Serialize, Deserialize, JsonSchema, PartialEq, Debug)]
556#[serde(rename_all = "snake_case")]
557pub enum ModeContent {
558 #[default]
559 Normal,
560 Insert,
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<DockSide>,
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 DockSide {
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}
767
768/// Settings for configuring REPL display and behavior.
769#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
770pub struct ReplSettingsContent {
771 /// Maximum number of lines to keep in REPL's scrollback buffer.
772 /// Clamped with [4, 256] range.
773 ///
774 /// Default: 32
775 pub max_lines: Option<usize>,
776 /// Maximum number of columns to keep in REPL's scrollback buffer.
777 /// Clamped with [20, 512] range.
778 ///
779 /// Default: 128
780 pub max_columns: Option<usize>,
781}