Fix a bug where directories were not matching in the fuzzy matcher, when query contains the worktree root name (#16242)
Release Notes: - N/A Co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
e8bae839ed
commit
271e774713
3 changed files with 19 additions and 21 deletions
|
@ -3164,6 +3164,7 @@ pub struct Entry {
|
|||
pub git_status: Option<GitFileStatus>,
|
||||
/// Whether this entry is considered to be a `.env` file.
|
||||
pub is_private: bool,
|
||||
pub char_bag: CharBag,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
|
@ -3171,7 +3172,7 @@ pub enum EntryKind {
|
|||
UnloadedDir,
|
||||
PendingDir,
|
||||
Dir,
|
||||
File(CharBag),
|
||||
File,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
|
@ -3206,12 +3207,13 @@ impl Entry {
|
|||
root_char_bag: CharBag,
|
||||
canonical_path: Option<Box<Path>>,
|
||||
) -> Self {
|
||||
let char_bag = char_bag_for_path(root_char_bag, &path);
|
||||
Self {
|
||||
id: ProjectEntryId::new(next_entry_id),
|
||||
kind: if metadata.is_dir {
|
||||
EntryKind::PendingDir
|
||||
} else {
|
||||
EntryKind::File(char_bag_for_path(root_char_bag, &path))
|
||||
EntryKind::File
|
||||
},
|
||||
path,
|
||||
inode: metadata.inode,
|
||||
|
@ -3222,6 +3224,7 @@ impl Entry {
|
|||
is_external: false,
|
||||
is_private: false,
|
||||
git_status: None,
|
||||
char_bag,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3255,7 +3258,7 @@ impl EntryKind {
|
|||
}
|
||||
|
||||
pub fn is_file(&self) -> bool {
|
||||
matches!(self, EntryKind::File(_))
|
||||
matches!(self, EntryKind::File)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5093,11 +5096,10 @@ impl<'a> TryFrom<(&'a CharBag, proto::Entry)> for Entry {
|
|||
let kind = if entry.is_dir {
|
||||
EntryKind::Dir
|
||||
} else {
|
||||
let mut char_bag = *root_char_bag;
|
||||
char_bag.extend(entry.path.chars().map(|c| c.to_ascii_lowercase()));
|
||||
EntryKind::File(char_bag)
|
||||
EntryKind::File
|
||||
};
|
||||
let path: Arc<Path> = PathBuf::from(entry.path).into();
|
||||
let char_bag = char_bag_for_path(*root_char_bag, &path);
|
||||
Ok(Entry {
|
||||
id: ProjectEntryId::from_proto(entry.id),
|
||||
kind,
|
||||
|
@ -5110,6 +5112,7 @@ impl<'a> TryFrom<(&'a CharBag, proto::Entry)> for Entry {
|
|||
git_status: git_status_from_proto(entry.git_status),
|
||||
is_private: false,
|
||||
is_symlink: entry.is_symlink,
|
||||
char_bag,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue