recent_projects: Perform fuzzy search on compacted paths. (#2703)

Match highlighting for recent projects picker was off, because the path
representation was compacted - for a path '/Users/hiro/Projects/zed' we
compact it to use a tilde instead of home directory. However, the
highlight positions were always calculated for a full path, leading to a
mismatch in highlights. This commit addresses this by running fuzzy
search on compacted paths instead of using long paths. This might lead
to a slight performance hit, but given that recent projects modal
shouldn't have that many items in the first place, it should be okay.

Z-2546

Release Notes:

- Fixed result highlighting in "Recent projects" modal.
This commit is contained in:
Piotr Osiewicz 2023-07-12 11:47:28 +02:00 committed by GitHub
commit b9f5cb0301
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,7 +134,7 @@ impl PickerDelegate for RecentProjectsDelegate {
let combined_string = location let combined_string = location
.paths() .paths()
.iter() .iter()
.map(|path| path.to_string_lossy().to_owned()) .map(|path| util::paths::compact(&path).to_string_lossy().into_owned())
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(""); .join("");
StringMatchCandidate::new(id, combined_string) StringMatchCandidate::new(id, combined_string)