Don't try to make project search and outline order match project panel (#20513)

A straight alphabetical order is arguably clearer, and avoids a large
initial delay when searching large repos.

Release Notes:

- Fixed a long initial delay when performing a project search in a large
repository.
This commit is contained in:
Max Brunsfeld 2024-11-11 12:20:04 -08:00 committed by GitHub
parent 97b542b22a
commit 149e5fde36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 63 deletions

View file

@ -23,7 +23,7 @@ use smol::{
stream::StreamExt,
};
use text::ReplicaId;
use util::{paths::compare_paths, ResultExt};
use util::ResultExt;
use worktree::{Entry, ProjectEntryId, Worktree, WorktreeId, WorktreeSettings};
use crate::{search::SearchQuery, ProjectPath};
@ -725,9 +725,7 @@ impl WorktreeStore {
!metadata.is_dir,
))
}
results.sort_by(|(a_path, a_is_file), (b_path, b_is_file)| {
compare_paths((a_path, *a_is_file), (b_path, *b_is_file))
});
results.sort_by(|(a_path, _), (b_path, _)| a_path.cmp(b_path));
for (path, is_file) in results {
if is_file {
if query.filters_path() {
@ -782,9 +780,7 @@ impl WorktreeStore {
) -> Result<()> {
let include_root = snapshots.len() > 1;
for (snapshot, settings) in snapshots {
let mut entries: Vec<_> = snapshot.entries(query.include_ignored(), 0).collect();
entries.sort_by(|a, b| compare_paths((&a.path, a.is_file()), (&b.path, b.is_file())));
for entry in entries {
for entry in snapshot.entries(query.include_ignored(), 0) {
if entry.is_dir() && entry.is_ignored {
if !settings.is_path_excluded(&entry.path) {
Self::scan_ignored_dir(