Fix Auto folded dirs performance issues (#8556)

Fixed auto folded dirs which caused significant performance issues #8476
(#7674)

Moved from iterating over snapshot entries to use `child_entries`
function from `worktree.rs` by making it public

@maxbrunsfeld 

Release Notes:

- Fixed a bug where project panel settings changes would not be applied
immediately.
- Added a `project_panel.auto_fold_dirs` setting which collapses the
nesting in the project panel when there is a chain of folders containing
a single folder.
<img width="288" alt="Screenshot 2024-04-12 at 11 10 58 AM"
src="https://github.com/zed-industries/zed/assets/2280405/efd61e75-026c-464d-ba4d-90db5f68bad3">

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Yury Abykhodau 2024-04-12 21:26:26 +03:00 committed by GitHub
parent 28586060a1
commit 8bca9cea26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 324 additions and 13 deletions

View file

@ -2079,7 +2079,7 @@ impl Snapshot {
.map(|entry| &entry.path)
}
fn child_entries<'a>(&'a self, parent_path: &'a Path) -> ChildEntriesIter<'a> {
pub fn child_entries<'a>(&'a self, parent_path: &'a Path) -> ChildEntriesIter<'a> {
let mut cursor = self.entries_by_path.cursor();
cursor.seek(&TraversalTarget::Path(parent_path), Bias::Right, &());
let traversal = Traversal {
@ -4706,7 +4706,7 @@ impl<'a, 'b> SeekTarget<'a, EntrySummary, (TraversalProgress<'a>, GitStatuses)>
}
}
struct ChildEntriesIter<'a> {
pub struct ChildEntriesIter<'a> {
parent_path: &'a Path,
traversal: Traversal<'a>,
}