Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions assets/settings/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@
// Whether to fold directories automatically and show compact folders
// (e.g. "a/b/c" ) when a directory has only one subdirectory inside.
"auto_fold_dirs": true,
// Whether to show folder names with bold text in the project panel.
"bold_folder_labels": false,
// Scrollbar-related settings
"scrollbar": {
// When to show the scrollbar in the project panel.
Expand Down
20 changes: 15 additions & 5 deletions crates/project_panel/src/project_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ use git_ui::file_diff_view::FileDiffView;
use gpui::{
Action, AnyElement, App, AsyncWindowContext, Bounds, ClipboardItem, Context, CursorStyle,
DismissEvent, Div, DragMoveEvent, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable,
Hsla, InteractiveElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior,
Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, ParentElement, Pixels, Point,
PromptLevel, Render, ScrollStrategy, Stateful, Styled, Subscription, Task,
UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred, div, hsla,
linear_color_stop, linear_gradient, point, px, size, transparent_white, uniform_list,
FontWeight, Hsla, InteractiveElement, KeyContext, ListHorizontalSizingBehavior,
ListSizingBehavior, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent,
ParentElement, Pixels, Point, PromptLevel, Render, ScrollStrategy, Stateful, Styled,
Subscription, Task, UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred,
div, hsla, linear_color_stop, linear_gradient, point, px, size, transparent_white,
uniform_list,
};
use language::DiagnosticSeverity;
use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrevious};
Expand Down Expand Up @@ -5273,6 +5274,7 @@ impl ProjectPanel {
kind.is_file(),
is_active || is_marked,
settings.drag_and_drop,
settings.bold_folder_labels,
item_colors.drag_over,
folded_directory_drag_target,
filename_text_color,
Expand All @@ -5284,6 +5286,10 @@ impl ProjectPanel {
Label::new(file_name)
.single_line()
.color(filename_text_color)
.when(
settings.bold_folder_labels && kind.is_dir(),
|this| this.weight(FontWeight::SEMIBOLD),
)
.into_any_element(),
),
})
Expand Down Expand Up @@ -5337,6 +5343,7 @@ impl ProjectPanel {
is_file: bool,
is_active_or_marked: bool,
drag_and_drop_enabled: bool,
bold_folder_labels: bool,
drag_over_color: Hsla,
folded_directory_drag_target: Option<FoldedDirectoryDragTarget>,
filename_text_color: Color,
Expand Down Expand Up @@ -5446,6 +5453,9 @@ impl ProjectPanel {
Label::new(component)
.single_line()
.color(filename_text_color)
.when(bold_folder_labels && !is_file, |this| {
this.weight(FontWeight::SEMIBOLD)
})
.when(index == active_index && is_active_or_marked, |this| {
this.underline()
}),
Expand Down
2 changes: 2 additions & 0 deletions crates/project_panel/src/project_panel_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct ProjectPanelSettings {
pub sticky_scroll: bool,
pub auto_reveal_entries: bool,
pub auto_fold_dirs: bool,
pub bold_folder_labels: bool,
pub starts_open: bool,
pub scrollbar: ScrollbarSettings,
pub show_diagnostics: ShowDiagnostics,
Expand Down Expand Up @@ -106,6 +107,7 @@ impl Settings for ProjectPanelSettings {
sticky_scroll: project_panel.sticky_scroll.unwrap(),
auto_reveal_entries: project_panel.auto_reveal_entries.unwrap(),
auto_fold_dirs: project_panel.auto_fold_dirs.unwrap(),
bold_folder_labels: project_panel.bold_folder_labels.unwrap(),
starts_open: project_panel.starts_open.unwrap(),
scrollbar: ScrollbarSettings {
show: project_panel.scrollbar.unwrap().show.map(Into::into),
Expand Down
1 change: 1 addition & 0 deletions crates/settings/src/vscode_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ impl VsCodeSettings {
let mut project_panel_settings = ProjectPanelSettingsContent {
auto_fold_dirs: self.read_bool("explorer.compactFolders"),
auto_reveal_entries: self.read_bool("explorer.autoReveal"),
bold_folder_labels: None,
button: None,
default_width: None,
dock: None,
Expand Down
4 changes: 4 additions & 0 deletions crates/settings_content/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,10 @@ pub struct ProjectPanelSettingsContent {
///
/// Default: true
pub auto_fold_dirs: Option<bool>,
/// Whether to show folder names with bold text in the project panel.
///
/// Default: false
pub bold_folder_labels: Option<bool>,
/// Whether the project panel should open on startup.
///
/// Default: true
Expand Down
24 changes: 23 additions & 1 deletion crates/settings_ui/src/page_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4217,7 +4217,7 @@ fn window_and_layout_page() -> SettingsPage {
}

fn panels_page() -> SettingsPage {
fn project_panel_section() -> [SettingsPageItem; 20] {
fn project_panel_section() -> [SettingsPageItem; 21] {
[
SettingsPageItem::SectionHeader("Project Panel"),
SettingsPageItem::SettingItem(SettingItem {
Expand Down Expand Up @@ -4445,6 +4445,28 @@ fn panels_page() -> SettingsPage {
metadata: None,
files: USER,
}),
SettingsPageItem::SettingItem(SettingItem {
title: "Bold Folder Labels",
description: "Whether to show folder names with bold text in the project panel.",
field: Box::new(SettingField {
json_path: Some("project_panel.bold_folder_labels"),
pick: |settings_content| {
settings_content
.project_panel
.as_ref()?
.bold_folder_labels
.as_ref()
},
write: |settings_content, value| {
settings_content
.project_panel
.get_or_insert_default()
.bold_folder_labels = value;
},
}),
metadata: None,
files: USER,
}),
SettingsPageItem::SettingItem(SettingItem {
title: "Show Scrollbar",
description: "Show the scrollbar in the project panel.",
Expand Down
25 changes: 25 additions & 0 deletions docs/src/reference/all-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4376,6 +4376,7 @@ Run the {#action theme_selector::Toggle} action in the command palette to see a
"indent_size": 20,
"auto_reveal_entries": true,
"auto_fold_dirs": true,
"bold_folder_labels": false,
"drag_and_drop": true,
"scrollbar": {
"show": null
Expand Down Expand Up @@ -4528,6 +4529,30 @@ Run the {#action theme_selector::Toggle} action in the command palette to see a
}
```

### Bold Folder Labels

- Description: Whether to show folder names with bold text in the project panel.
- Setting: `bold_folder_labels`
- Default: `false`

**Options**

1. Enable bold folder labels

```json [settings]
{
"bold_folder_labels": true
}
```

2. Disable bold folder labels

```json [settings]
{
"bold_folder_labels": false
}
```

### Indent Size

- Description: Amount of indentation (in pixels) for nested items.
Expand Down
1 change: 1 addition & 0 deletions docs/src/visual-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ Project panel can be shown/hidden with {#action project_panel::ToggleFocus} ({#k
"indent_size": 20, // Pixels for each successive indent
"auto_reveal_entries": true, // Show file in panel when activating its buffer
"auto_fold_dirs": true, // Fold dirs with single subdir
"bold_folder_labels": false, // Show folder names with bold text
"sticky_scroll": true, // Stick parent directories at top of the project panel.
"drag_and_drop": true, // Whether drag and drop is enabled
"scrollbar": { // Project panel scrollbar settings
Expand Down