diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 37b7e01b25838a830b5d0f2f642edde3f8eb2a00..39bdf2a7af8b4f8b684469c5e6b78d17ea0ca6cf 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -11079,10 +11079,30 @@ impl<'a> fuzzy::PathMatchCandidateSet<'a> for PathMatchCandidateSet { } fn len(&self) -> usize { - if self.include_ignored { - self.snapshot.file_count() - } else { - self.snapshot.visible_file_count() + match self.candidates { + Candidates::Files => { + if self.include_ignored { + self.snapshot.file_count() + } else { + self.snapshot.visible_file_count() + } + } + + Candidates::Directories => { + if self.include_ignored { + self.snapshot.dir_count() + } else { + self.snapshot.visible_dir_count() + } + } + + Candidates::Entries => { + if self.include_ignored { + self.snapshot.entry_count() + } else { + self.snapshot.visible_entry_count() + } + } } } diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 6834e1017df2cb2c99df5e7189e4dd17bb851988..73c8a84a07805e4f5e5333fe9f98ac0dea5ec7bc 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -2118,6 +2118,24 @@ impl Snapshot { Ok(()) } + pub fn entry_count(&self) -> usize { + self.entries_by_path.summary().count + } + + pub fn visible_entry_count(&self) -> usize { + self.entries_by_path.summary().non_ignored_count + } + + pub fn dir_count(&self) -> usize { + let summary = self.entries_by_path.summary(); + summary.count - summary.file_count + } + + pub fn visible_dir_count(&self) -> usize { + let summary = self.entries_by_path.summary(); + summary.non_ignored_count - summary.non_ignored_file_count + } + pub fn file_count(&self) -> usize { self.entries_by_path.summary().file_count }