Future-proof indent guides settings for panels (#19878)

This PR ensures that we do not have to break the indent guides settings
for the project/outline panel. In the future we might want to have a
more granular way to control when to show indent guides, or control
other indent guide properties, like its width.

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2024-10-29 09:52:36 +01:00 committed by GitHub
parent 719a7f7890
commit b5c41eeb98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 117 additions and 34 deletions

View file

@ -30,7 +30,7 @@ use project::{
relativize_path, Entry, EntryKind, Fs, Project, ProjectEntryId, ProjectPath, Worktree,
WorktreeId,
};
use project_panel_settings::{ProjectPanelDockPosition, ProjectPanelSettings};
use project_panel_settings::{ProjectPanelDockPosition, ProjectPanelSettings, ShowIndentGuides};
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use std::{
@ -3043,7 +3043,8 @@ impl Render for ProjectPanel {
let has_worktree = !self.visible_entries.is_empty();
let project = self.project.read(cx);
let indent_size = ProjectPanelSettings::get_global(cx).indent_size;
let indent_guides = ProjectPanelSettings::get_global(cx).indent_guides;
let show_indent_guides =
ProjectPanelSettings::get_global(cx).indent_guides.show == ShowIndentGuides::Always;
let is_local = project.is_local();
if has_worktree {
@ -3147,7 +3148,7 @@ impl Render for ProjectPanel {
items
}
})
.when(indent_guides, |list| {
.when(show_indent_guides, |list| {
list.with_decoration(
ui::indent_guides(
cx.view().clone(),