Allow configuring spacing of project panel entries (#16255)
Release Notes: - Added `project_panel.entry_spacing` setting to configure spacing between entries in the project panel. ### Comfortable (default) ```json "project_panel": { "entry_spacing": "comfortable", ``` <img width="1582" alt="Screenshot 2024-08-14 at 5 50 41 PM" src="https://github.com/user-attachments/assets/3411a82e-7517-4095-bf4a-bbf40000a7cb"> ### Standard ```json "project_panel": { "entry_spacing": "standard", ``` <img width="1582" alt="Screenshot 2024-08-14 at 5 50 54 PM" src="https://github.com/user-attachments/assets/2c13d799-c405-4301-8214-1cb3cc641c92"> --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
35d3d29bcf
commit
9ea7ed8e0a
5 changed files with 52 additions and 2 deletions
|
@ -54,8 +54,8 @@ use std::{
|
|||
use theme::ThemeSettings;
|
||||
use ui::{
|
||||
prelude::*, v_flex, ContextMenu, DecoratedIcon, Icon, IconDecoration, IconDecorationKind,
|
||||
IndentGuideColors, IndentGuideLayout, KeyBinding, Label, ListItem, Scrollbar, ScrollbarState,
|
||||
Tooltip,
|
||||
IndentGuideColors, IndentGuideLayout, KeyBinding, Label, ListItem, ListItemSpacing, Scrollbar,
|
||||
ScrollbarState, Tooltip,
|
||||
};
|
||||
use util::{maybe, paths::compare_paths, ResultExt, TakeUntilExt, TryFutureExt};
|
||||
use workspace::{
|
||||
|
@ -3447,6 +3447,12 @@ impl ProjectPanel {
|
|||
ListItem::new(entry_id.to_proto() as usize)
|
||||
.indent_level(depth)
|
||||
.indent_step_size(px(settings.indent_size))
|
||||
.spacing(match settings.entry_spacing {
|
||||
project_panel_settings::EntrySpacing::Comfortable => ListItemSpacing::Dense,
|
||||
project_panel_settings::EntrySpacing::Standard => {
|
||||
ListItemSpacing::ExtraDense
|
||||
}
|
||||
})
|
||||
.selectable(false)
|
||||
.when_some(canonical_path, |this, path| {
|
||||
this.end_slot::<AnyElement>(
|
||||
|
|
|
@ -18,11 +18,22 @@ pub enum ShowIndentGuides {
|
|||
Never,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EntrySpacing {
|
||||
/// Comfortable spacing of entries.
|
||||
#[default]
|
||||
Comfortable,
|
||||
/// The standard spacing of entries.
|
||||
Standard,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct ProjectPanelSettings {
|
||||
pub button: bool,
|
||||
pub default_width: Pixels,
|
||||
pub dock: ProjectPanelDockPosition,
|
||||
pub entry_spacing: EntrySpacing,
|
||||
pub file_icons: bool,
|
||||
pub folder_icons: bool,
|
||||
pub git_status: bool,
|
||||
|
@ -90,6 +101,10 @@ pub struct ProjectPanelSettingsContent {
|
|||
///
|
||||
/// Default: left
|
||||
pub dock: Option<ProjectPanelDockPosition>,
|
||||
/// Spacing between worktree entries in the project panel.
|
||||
///
|
||||
/// Default: comfortable
|
||||
pub entry_spacing: Option<EntrySpacing>,
|
||||
/// Whether to show file icons in the project panel.
|
||||
///
|
||||
/// Default: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue