workspace.rs

  1use std::num::NonZeroUsize;
  2
  3use collections::HashMap;
  4use schemars::JsonSchema;
  5use serde::{Deserialize, Serialize};
  6use settings_macros::{MergeFrom, with_fallible_options};
  7
  8use crate::{
  9    CenteredPaddingSettings, DelayMs, DockPosition, DockSide, InactiveOpacity, ShowIndentGuides,
 10    ShowScrollbar, serialize_optional_f32_with_two_decimal_places,
 11};
 12
 13#[with_fallible_options]
 14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
 15pub struct WorkspaceSettingsContent {
 16    /// Active pane styling settings.
 17    pub active_pane_modifiers: Option<ActivePaneModifiers>,
 18    /// The text rendering mode to use.
 19    ///
 20    /// Default: platform_default
 21    pub text_rendering_mode: Option<TextRenderingMode>,
 22    /// Layout mode for the bottom dock
 23    ///
 24    /// Default: contained
 25    pub bottom_dock_layout: Option<BottomDockLayout>,
 26    /// Direction to split horizontally.
 27    ///
 28    /// Default: "up"
 29    pub pane_split_direction_horizontal: Option<PaneSplitDirectionHorizontal>,
 30    /// Direction to split vertically.
 31    ///
 32    /// Default: "left"
 33    pub pane_split_direction_vertical: Option<PaneSplitDirectionVertical>,
 34    /// Centered layout related settings.
 35    pub centered_layout: Option<CenteredLayoutSettings>,
 36    /// Whether or not to prompt the user to confirm before closing the application.
 37    ///
 38    /// Default: false
 39    pub confirm_quit: Option<bool>,
 40    /// Whether or not to show the call status icon in the status bar.
 41    ///
 42    /// Default: true
 43    pub show_call_status_icon: Option<bool>,
 44    /// When to automatically save edited buffers.
 45    ///
 46    /// Default: off
 47    pub autosave: Option<AutosaveSetting>,
 48    /// Controls previous session restoration in freshly launched Zed instance.
 49    /// Values: empty_tab, last_workspace, last_session, launchpad
 50    /// Default: last_session
 51    pub restore_on_startup: Option<RestoreOnStartupBehavior>,
 52    /// Whether to attempt to restore previous file's state when opening it again.
 53    /// The state is stored per pane.
 54    /// When disabled, defaults are applied instead of the state restoration.
 55    ///
 56    /// E.g. for editors, selections, folds and scroll positions are restored, if the same file is closed and, later, opened again in the same pane.
 57    /// When disabled, a single selection in the very beginning of the file, zero scroll position and no folds state is used as a default.
 58    ///
 59    /// Default: true
 60    pub restore_on_file_reopen: Option<bool>,
 61    /// The size of the workspace split drop targets on the outer edges.
 62    /// Given as a fraction that will be multiplied by the smaller dimension of the workspace.
 63    ///
 64    /// Default: `0.2` (20% of the smaller dimension of the workspace)
 65    #[serde(serialize_with = "serialize_optional_f32_with_two_decimal_places")]
 66    pub drop_target_size: Option<f32>,
 67    /// Whether to close the window when using 'close active item' on a workspace with no tabs
 68    ///
 69    /// Default: auto ("on" on macOS, "off" otherwise)
 70    pub when_closing_with_no_tabs: Option<CloseWindowWhenNoItems>,
 71    /// Whether to use the system provided dialogs for Open and Save As.
 72    /// When set to false, Zed will use the built-in keyboard-first pickers.
 73    ///
 74    /// Default: true
 75    pub use_system_path_prompts: Option<bool>,
 76    /// Whether to use the system provided prompts.
 77    /// When set to false, Zed will use the built-in prompts.
 78    /// Note that this setting has no effect on Linux, where Zed will always
 79    /// use the built-in prompts.
 80    ///
 81    /// Default: true
 82    pub use_system_prompts: Option<bool>,
 83    /// Aliases for the command palette. When you type a key in this map,
 84    /// it will be assumed to equal the value.
 85    ///
 86    /// Default: true
 87    #[serde(default)]
 88    pub command_aliases: HashMap<String, String>,
 89    /// Maximum open tabs in a pane. Will not close an unsaved
 90    /// tab. Set to `None` for unlimited tabs.
 91    ///
 92    /// Default: none
 93    pub max_tabs: Option<NonZeroUsize>,
 94    /// What to do when the last window is closed
 95    ///
 96    /// Default: auto (nothing on macOS, "app quit" otherwise)
 97    pub on_last_window_closed: Option<OnLastWindowClosed>,
 98    /// Whether to resize all the panels in a dock when resizing the dock.
 99    ///
100    /// Default: ["left"]
101    pub resize_all_panels_in_dock: Option<Vec<DockPosition>>,
102    /// Whether to automatically close files that have been deleted on disk.
103    ///
104    /// Default: false
105    pub close_on_file_delete: Option<bool>,
106    /// Whether to allow windows to tab together based on the user’s tabbing preference (macOS only).
107    ///
108    /// Default: false
109    pub use_system_window_tabs: Option<bool>,
110    /// Whether to show padding for zoomed panels.
111    /// When enabled, zoomed bottom panels will have some top padding,
112    /// while zoomed left/right panels will have padding to the right/left (respectively).
113    ///
114    /// Default: true
115    pub zoomed_padding: Option<bool>,
116    /// Whether toggling a panel (e.g. with its keyboard shortcut) also closes
117    /// the panel when it is already focused, instead of just moving focus back
118    /// to the editor.
119    ///
120    /// Default: false
121    pub close_panel_on_toggle: Option<bool>,
122    /// What draws window decorations/titlebar, the client application (Zed) or display server
123    /// Default: client
124    pub window_decorations: Option<WindowDecorations>,
125    /// Whether the focused panel follows the mouse location
126    /// Default: false
127    pub focus_follows_mouse: Option<FocusFollowsMouse>,
128}
129
130#[with_fallible_options]
131#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
132pub struct ItemSettingsContent {
133    /// Whether to show the Git file status on a tab item.
134    ///
135    /// Default: false
136    pub git_status: Option<bool>,
137    /// Position of the close button in a tab.
138    ///
139    /// Default: right
140    pub close_position: Option<ClosePosition>,
141    /// Whether to show the file icon for a tab.
142    ///
143    /// Default: false
144    pub file_icons: Option<bool>,
145    /// What to do after closing the current tab.
146    ///
147    /// Default: history
148    pub activate_on_close: Option<ActivateOnClose>,
149    /// Which files containing diagnostic errors/warnings to mark in the tabs.
150    /// This setting can take the following three values:
151    ///
152    /// Default: off
153    pub show_diagnostics: Option<ShowDiagnostics>,
154    /// Whether to always show the close button on tabs.
155    ///
156    /// Default: false
157    pub show_close_button: Option<ShowCloseButton>,
158}
159
160#[with_fallible_options]
161#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
162pub struct PreviewTabsSettingsContent {
163    /// Whether to show opened editors as preview tabs.
164    /// Preview tabs do not stay open, are reused until explicitly set to be kept open opened (via double-click or editing) and show file names in italic.
165    ///
166    /// Default: true
167    pub enabled: Option<bool>,
168    /// Whether to open tabs in preview mode when opened from the project panel with a single click.
169    ///
170    /// Default: true
171    pub enable_preview_from_project_panel: Option<bool>,
172    /// Whether to open tabs in preview mode when selected from the file finder.
173    ///
174    /// Default: false
175    pub enable_preview_from_file_finder: Option<bool>,
176    /// Whether to open tabs in preview mode when opened from a multibuffer.
177    ///
178    /// Default: true
179    pub enable_preview_from_multibuffer: Option<bool>,
180    /// Whether to open tabs in preview mode when code navigation is used to open a multibuffer.
181    ///
182    /// Default: false
183    pub enable_preview_multibuffer_from_code_navigation: Option<bool>,
184    /// Whether to open tabs in preview mode when code navigation is used to open a single file.
185    ///
186    /// Default: true
187    pub enable_preview_file_from_code_navigation: Option<bool>,
188    /// Whether to keep tabs in preview mode when code navigation is used to navigate away from them.
189    /// If `enable_preview_file_from_code_navigation` or `enable_preview_multibuffer_from_code_navigation` is also true, the new tab may replace the existing one.
190    ///
191    /// Default: false
192    pub enable_keep_preview_on_code_navigation: Option<bool>,
193}
194
195#[derive(
196    Copy,
197    Clone,
198    Debug,
199    PartialEq,
200    Default,
201    Serialize,
202    Deserialize,
203    JsonSchema,
204    MergeFrom,
205    strum::VariantArray,
206    strum::VariantNames,
207)]
208#[serde(rename_all = "lowercase")]
209pub enum ClosePosition {
210    Left,
211    #[default]
212    Right,
213}
214
215#[derive(
216    Copy,
217    Clone,
218    Debug,
219    PartialEq,
220    Default,
221    Serialize,
222    Deserialize,
223    JsonSchema,
224    MergeFrom,
225    strum::VariantArray,
226    strum::VariantNames,
227)]
228#[serde(rename_all = "lowercase")]
229pub enum ShowCloseButton {
230    Always,
231    #[default]
232    Hover,
233    Hidden,
234}
235
236#[derive(
237    Copy,
238    Clone,
239    Debug,
240    Default,
241    Serialize,
242    Deserialize,
243    JsonSchema,
244    MergeFrom,
245    PartialEq,
246    Eq,
247    strum::VariantArray,
248    strum::VariantNames,
249)]
250#[serde(rename_all = "snake_case")]
251pub enum ShowDiagnostics {
252    #[default]
253    Off,
254    Errors,
255    All,
256}
257
258#[derive(
259    Copy,
260    Clone,
261    Debug,
262    PartialEq,
263    Default,
264    Serialize,
265    Deserialize,
266    JsonSchema,
267    MergeFrom,
268    strum::VariantArray,
269    strum::VariantNames,
270)]
271#[serde(rename_all = "snake_case")]
272pub enum ActivateOnClose {
273    #[default]
274    History,
275    Neighbour,
276    LeftNeighbour,
277}
278
279#[with_fallible_options]
280#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
281#[serde(rename_all = "snake_case")]
282pub struct ActivePaneModifiers {
283    /// Size of the border surrounding the active pane.
284    /// When set to 0, the active pane doesn't have any border.
285    /// The border is drawn inset.
286    ///
287    /// Default: `0.0`
288    #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
289    pub border_size: Option<f32>,
290    /// Opacity of inactive panels.
291    /// When set to 1.0, the inactive panes have the same opacity as the active one.
292    /// If set to 0, the inactive panes content will not be visible at all.
293    /// Values are clamped to the [0.0, 1.0] range.
294    ///
295    /// Default: `1.0`
296    #[schemars(range(min = 0.0, max = 1.0))]
297    pub inactive_opacity: Option<InactiveOpacity>,
298}
299
300#[derive(
301    Copy,
302    Clone,
303    Debug,
304    Default,
305    Serialize,
306    Deserialize,
307    PartialEq,
308    JsonSchema,
309    MergeFrom,
310    strum::VariantArray,
311    strum::VariantNames,
312)]
313#[serde(rename_all = "snake_case")]
314pub enum BottomDockLayout {
315    /// Contained between the left and right docks
316    #[default]
317    Contained,
318    /// Takes up the full width of the window
319    Full,
320    /// Extends under the left dock while snapping to the right dock
321    LeftAligned,
322    /// Extends under the right dock while snapping to the left dock
323    RightAligned,
324}
325
326#[derive(
327    Copy,
328    Clone,
329    Default,
330    Debug,
331    Serialize,
332    Deserialize,
333    PartialEq,
334    JsonSchema,
335    MergeFrom,
336    strum::VariantArray,
337    strum::VariantNames,
338)]
339#[serde(rename_all = "snake_case")]
340pub enum WindowDecorations {
341    /// Zed draws its own window decorations/titlebar (client-side decoration)
342    #[default]
343    Client,
344    /// Show system's window titlebar (server-side decoration; not supported by GNOME Wayland)
345    Server,
346}
347
348#[derive(
349    Copy,
350    Clone,
351    PartialEq,
352    Default,
353    Serialize,
354    Deserialize,
355    JsonSchema,
356    MergeFrom,
357    Debug,
358    strum::VariantArray,
359    strum::VariantNames,
360)]
361#[serde(rename_all = "snake_case")]
362pub enum CloseWindowWhenNoItems {
363    /// Match platform conventions by default, so "on" on macOS and "off" everywhere else
364    #[default]
365    PlatformDefault,
366    /// Close the window when there are no tabs
367    CloseWindow,
368    /// Leave the window open when there are no tabs
369    KeepWindowOpen,
370}
371
372impl CloseWindowWhenNoItems {
373    pub fn should_close(&self) -> bool {
374        match self {
375            CloseWindowWhenNoItems::PlatformDefault => cfg!(target_os = "macos"),
376            CloseWindowWhenNoItems::CloseWindow => true,
377            CloseWindowWhenNoItems::KeepWindowOpen => false,
378        }
379    }
380}
381
382#[derive(
383    Copy,
384    Clone,
385    PartialEq,
386    Eq,
387    Default,
388    Serialize,
389    Deserialize,
390    JsonSchema,
391    MergeFrom,
392    Debug,
393    strum::VariantArray,
394    strum::VariantNames,
395)]
396#[serde(rename_all = "snake_case")]
397pub enum RestoreOnStartupBehavior {
398    /// Always start with an empty editor tab
399    #[serde(alias = "none")]
400    EmptyTab,
401    /// Restore the workspace that was closed last.
402    LastWorkspace,
403    /// Restore all workspaces that were open when quitting Zed.
404    #[default]
405    LastSession,
406    /// Show the launchpad with recent projects (no tabs).
407    Launchpad,
408}
409
410#[with_fallible_options]
411#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug, PartialEq)]
412pub struct TabBarSettingsContent {
413    /// Whether or not to show the tab bar in the editor.
414    ///
415    /// Default: true
416    pub show: Option<bool>,
417    /// Whether or not to show the navigation history buttons in the tab bar.
418    ///
419    /// Default: true
420    pub show_nav_history_buttons: Option<bool>,
421    /// Whether or not to show the tab bar buttons.
422    ///
423    /// Default: true
424    pub show_tab_bar_buttons: Option<bool>,
425    /// Whether or not to show pinned tabs in a separate row.
426    /// When enabled, pinned tabs appear in a top row and unpinned tabs in a bottom row.
427    ///
428    /// Default: false
429    pub show_pinned_tabs_in_separate_row: Option<bool>,
430}
431
432#[with_fallible_options]
433#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug, PartialEq, Eq)]
434pub struct StatusBarSettingsContent {
435    /// Whether to show the status bar.
436    ///
437    /// Default: true
438    #[serde(rename = "experimental.show")]
439    pub show: Option<bool>,
440    /// Whether to display the active language button in the status bar.
441    ///
442    /// Default: true
443    pub active_language_button: Option<bool>,
444    /// Whether to show the cursor position button in the status bar.
445    ///
446    /// Default: true
447    pub cursor_position_button: Option<bool>,
448    /// Whether to show active line endings button in the status bar.
449    ///
450    /// Default: false
451    pub line_endings_button: Option<bool>,
452    /// Whether to show the active encoding button in the status bar.
453    ///
454    /// Default: non_utf8
455    pub active_encoding_button: Option<EncodingDisplayOptions>,
456}
457
458#[derive(
459    Copy,
460    Clone,
461    Debug,
462    Eq,
463    PartialEq,
464    Default,
465    Serialize,
466    Deserialize,
467    JsonSchema,
468    MergeFrom,
469    strum::VariantNames,
470    strum::VariantArray,
471)]
472#[serde(rename_all = "snake_case")]
473pub enum EncodingDisplayOptions {
474    Enabled,
475    Disabled,
476    #[default]
477    NonUtf8,
478}
479impl EncodingDisplayOptions {
480    pub fn should_show(&self, is_utf8: bool, has_bom: bool) -> bool {
481        match self {
482            Self::Disabled => false,
483            Self::Enabled => true,
484            Self::NonUtf8 => {
485                let is_standard_utf8 = is_utf8 && !has_bom;
486                !is_standard_utf8
487            }
488        }
489    }
490}
491
492#[derive(
493    Copy,
494    Clone,
495    Debug,
496    Serialize,
497    Deserialize,
498    PartialEq,
499    Eq,
500    JsonSchema,
501    MergeFrom,
502    strum::EnumDiscriminants,
503)]
504#[strum_discriminants(derive(strum::VariantArray, strum::VariantNames, strum::FromRepr))]
505#[serde(rename_all = "snake_case")]
506pub enum AutosaveSetting {
507    /// Disable autosave.
508    Off,
509    /// Save after inactivity period of `milliseconds`.
510    AfterDelay { milliseconds: DelayMs },
511    /// Autosave when focus changes.
512    OnFocusChange,
513    /// Autosave when the active window changes.
514    OnWindowChange,
515}
516
517impl AutosaveSetting {
518    pub fn should_save_on_close(&self) -> bool {
519        matches!(
520            &self,
521            AutosaveSetting::OnFocusChange
522                | AutosaveSetting::OnWindowChange
523                | AutosaveSetting::AfterDelay { .. }
524        )
525    }
526}
527
528#[derive(
529    Copy,
530    Clone,
531    Debug,
532    Serialize,
533    Deserialize,
534    PartialEq,
535    Eq,
536    JsonSchema,
537    MergeFrom,
538    strum::VariantArray,
539    strum::VariantNames,
540)]
541#[serde(rename_all = "snake_case")]
542pub enum PaneSplitDirectionHorizontal {
543    Up,
544    Down,
545}
546
547#[derive(
548    Copy,
549    Clone,
550    Debug,
551    Serialize,
552    Deserialize,
553    PartialEq,
554    Eq,
555    JsonSchema,
556    MergeFrom,
557    strum::VariantArray,
558    strum::VariantNames,
559)]
560#[serde(rename_all = "snake_case")]
561pub enum PaneSplitDirectionVertical {
562    Left,
563    Right,
564}
565
566#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
567#[serde(rename_all = "snake_case")]
568#[with_fallible_options]
569pub struct CenteredLayoutSettings {
570    /// The relative width of the left padding of the central pane from the
571    /// workspace when the centered layout is used.
572    ///
573    /// Default: 0.2
574    pub left_padding: Option<CenteredPaddingSettings>,
575    // The relative width of the right padding of the central pane from the
576    // workspace when the centered layout is used.
577    ///
578    /// Default: 0.2
579    pub right_padding: Option<CenteredPaddingSettings>,
580}
581
582#[derive(
583    Copy,
584    Clone,
585    Default,
586    Serialize,
587    Deserialize,
588    JsonSchema,
589    MergeFrom,
590    PartialEq,
591    Debug,
592    strum::VariantArray,
593    strum::VariantNames,
594)]
595#[serde(rename_all = "snake_case")]
596pub enum OnLastWindowClosed {
597    /// Match platform conventions by default, so don't quit on macOS, and quit on other platforms
598    #[default]
599    PlatformDefault,
600    /// Quit the application the last window is closed
601    QuitApp,
602}
603
604#[derive(
605    Copy,
606    Clone,
607    Default,
608    Serialize,
609    Deserialize,
610    JsonSchema,
611    MergeFrom,
612    PartialEq,
613    Eq,
614    Debug,
615    strum::VariantArray,
616    strum::VariantNames,
617)]
618#[serde(rename_all = "snake_case")]
619pub enum TextRenderingMode {
620    /// Use platform default behavior.
621    #[default]
622    PlatformDefault,
623    /// Use subpixel (ClearType-style) text rendering.
624    Subpixel,
625    /// Use grayscale text rendering.
626    Grayscale,
627}
628
629impl OnLastWindowClosed {
630    pub fn is_quit_app(&self) -> bool {
631        match self {
632            OnLastWindowClosed::PlatformDefault => false,
633            OnLastWindowClosed::QuitApp => true,
634        }
635    }
636}
637
638#[with_fallible_options]
639#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug)]
640pub struct ProjectPanelAutoOpenSettings {
641    /// Whether to automatically open newly created files in the editor.
642    ///
643    /// Default: true
644    pub on_create: Option<bool>,
645    /// Whether to automatically open files after pasting or duplicating them.
646    ///
647    /// Default: true
648    pub on_paste: Option<bool>,
649    /// Whether to automatically open files dropped from external sources.
650    ///
651    /// Default: true
652    pub on_drop: Option<bool>,
653}
654
655#[with_fallible_options]
656#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug)]
657pub struct ProjectPanelSettingsContent {
658    /// Whether to show the project panel button in the status bar.
659    ///
660    /// Default: true
661    pub button: Option<bool>,
662    /// Whether to hide gitignore files in the project panel.
663    ///
664    /// Default: false
665    pub hide_gitignore: Option<bool>,
666    /// Customize default width (in pixels) taken by project panel
667    ///
668    /// Default: 240
669    #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
670    pub default_width: Option<f32>,
671    /// The position of project panel
672    ///
673    /// Default: left
674    pub dock: Option<DockSide>,
675    /// Spacing between worktree entries in the project panel.
676    ///
677    /// Default: comfortable
678    pub entry_spacing: Option<ProjectPanelEntrySpacing>,
679    /// Whether to show file icons in the project panel.
680    ///
681    /// Default: true
682    pub file_icons: Option<bool>,
683    /// Whether to show folder icons or chevrons for directories in the project panel.
684    ///
685    /// Default: true
686    pub folder_icons: Option<bool>,
687    /// Whether to show the git status in the project panel.
688    ///
689    /// Default: true
690    pub git_status: Option<bool>,
691    /// Amount of indentation (in pixels) for nested items.
692    ///
693    /// Default: 20
694    #[serde(serialize_with = "serialize_optional_f32_with_two_decimal_places")]
695    pub indent_size: Option<f32>,
696    /// Whether to reveal it in the project panel automatically,
697    /// when a corresponding project entry becomes active.
698    /// Gitignored entries are never auto revealed.
699    ///
700    /// Default: true
701    pub auto_reveal_entries: Option<bool>,
702    /// Whether to fold directories automatically
703    /// when directory has only one directory inside.
704    ///
705    /// Default: true
706    pub auto_fold_dirs: Option<bool>,
707    /// Whether to show folder names with bold text in the project panel.
708    ///
709    /// Default: false
710    pub bold_folder_labels: Option<bool>,
711    /// Whether the project panel should open on startup.
712    ///
713    /// Default: true
714    pub starts_open: Option<bool>,
715    /// Scrollbar-related settings
716    pub scrollbar: Option<ProjectPanelScrollbarSettingsContent>,
717    /// Which files containing diagnostic errors/warnings to mark in the project panel.
718    ///
719    /// Default: all
720    pub show_diagnostics: Option<ShowDiagnostics>,
721    /// Settings related to indent guides in the project panel.
722    pub indent_guides: Option<ProjectPanelIndentGuidesSettings>,
723    /// Whether to hide the root entry when only one folder is open in the window.
724    ///
725    /// Default: false
726    pub hide_root: Option<bool>,
727    /// Whether to hide the hidden entries in the project panel.
728    ///
729    /// Default: false
730    pub hide_hidden: Option<bool>,
731    /// Whether to stick parent directories at top of the project panel.
732    ///
733    /// Default: true
734    pub sticky_scroll: Option<bool>,
735    /// Whether to enable drag-and-drop operations in the project panel.
736    ///
737    /// Default: true
738    pub drag_and_drop: Option<bool>,
739    /// Settings for automatically opening files.
740    pub auto_open: Option<ProjectPanelAutoOpenSettings>,
741    /// How to order sibling entries in the project panel.
742    ///
743    /// Default: directories_first
744    pub sort_mode: Option<ProjectPanelSortMode>,
745    /// Whether to show error and warning count badges next to file names in the project panel.
746    ///
747    /// Default: true
748    pub diagnostic_badges: Option<bool>,
749}
750
751#[derive(
752    Copy,
753    Clone,
754    Debug,
755    Default,
756    Serialize,
757    Deserialize,
758    JsonSchema,
759    MergeFrom,
760    PartialEq,
761    Eq,
762    strum::VariantArray,
763    strum::VariantNames,
764)]
765#[serde(rename_all = "snake_case")]
766pub enum ProjectPanelEntrySpacing {
767    /// Comfortable spacing of entries.
768    #[default]
769    Comfortable,
770    /// The standard spacing of entries.
771    Standard,
772}
773
774#[derive(
775    Copy,
776    Clone,
777    Debug,
778    Default,
779    Serialize,
780    Deserialize,
781    JsonSchema,
782    MergeFrom,
783    PartialEq,
784    Eq,
785    strum::VariantArray,
786    strum::VariantNames,
787)]
788#[serde(rename_all = "snake_case")]
789pub enum ProjectPanelSortMode {
790    /// Show directories first, then files
791    #[default]
792    DirectoriesFirst,
793    /// Mix directories and files together
794    Mixed,
795    /// Show files first, then directories
796    FilesFirst,
797}
798
799#[with_fallible_options]
800#[derive(
801    Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq, Default,
802)]
803pub struct ProjectPanelScrollbarSettingsContent {
804    /// When to show the scrollbar in the project panel.
805    ///
806    /// Default: inherits editor scrollbar settings
807    pub show: Option<ShowScrollbar>,
808    /// Whether to allow horizontal scrolling in the project panel.
809    /// When false, the view is locked to the leftmost position and
810    /// long file names are clipped.
811    ///
812    /// Default: true
813    pub horizontal_scroll: Option<bool>,
814}
815
816#[with_fallible_options]
817#[derive(
818    Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq, Default,
819)]
820pub struct ProjectPanelIndentGuidesSettings {
821    pub show: Option<ShowIndentGuides>,
822}
823
824/// Controls how semantic tokens from language servers are used for syntax highlighting.
825#[derive(
826    Debug,
827    PartialEq,
828    Eq,
829    Clone,
830    Copy,
831    Default,
832    Serialize,
833    Deserialize,
834    JsonSchema,
835    MergeFrom,
836    strum::VariantArray,
837    strum::VariantNames,
838    strum::EnumMessage,
839)]
840#[serde(rename_all = "snake_case")]
841pub enum SemanticTokens {
842    /// Do not request semantic tokens from language servers.
843    #[default]
844    Off,
845    /// Use LSP semantic tokens together with tree-sitter highlighting.
846    Combined,
847    /// Use LSP semantic tokens exclusively, replacing tree-sitter highlighting.
848    Full,
849}
850
851impl SemanticTokens {
852    /// Returns true if semantic tokens should be requested from language servers.
853    pub fn enabled(&self) -> bool {
854        self != &Self::Off
855    }
856
857    /// Returns true if tree-sitter syntax highlighting should be used.
858    /// In `full` mode, tree-sitter is disabled in favor of LSP semantic tokens.
859    pub fn use_tree_sitter(&self) -> bool {
860        self != &Self::Full
861    }
862}
863
864#[derive(
865    Debug,
866    PartialEq,
867    Eq,
868    Clone,
869    Copy,
870    Default,
871    Serialize,
872    Deserialize,
873    JsonSchema,
874    MergeFrom,
875    strum::VariantArray,
876    strum::VariantNames,
877)]
878#[serde(rename_all = "snake_case")]
879pub enum DocumentFoldingRanges {
880    /// Do not request folding ranges from language servers; use tree-sitter and indent-based folding.
881    #[default]
882    Off,
883    /// Use LSP folding wherever possible, falling back to tree-sitter and indent-based folding when no results were returned by the server.
884    On,
885}
886
887impl DocumentFoldingRanges {
888    /// Returns true if LSP folding ranges should be requested from language servers.
889    pub fn enabled(&self) -> bool {
890        self != &Self::Off
891    }
892}
893
894#[derive(
895    Debug,
896    PartialEq,
897    Eq,
898    Clone,
899    Copy,
900    Default,
901    Serialize,
902    Deserialize,
903    JsonSchema,
904    MergeFrom,
905    strum::VariantArray,
906    strum::VariantNames,
907)]
908#[serde(rename_all = "snake_case")]
909pub enum DocumentSymbols {
910    /// Use tree-sitter queries to compute document symbols for outlines and breadcrumbs (default).
911    #[default]
912    #[serde(alias = "tree_sitter")]
913    Off,
914    /// Use the language server's `textDocument/documentSymbol` LSP response for outlines and
915    /// breadcrumbs. When enabled, tree-sitter is not used for document symbols.
916    #[serde(alias = "language_server")]
917    On,
918}
919
920impl DocumentSymbols {
921    /// Returns true if LSP document symbols should be used instead of tree-sitter.
922    pub fn lsp_enabled(&self) -> bool {
923        self == &Self::On
924    }
925}
926
927#[with_fallible_options]
928#[derive(Copy, Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug)]
929pub struct FocusFollowsMouse {
930    pub enabled: Option<bool>,
931    pub debounce_ms: Option<u64>,
932}