Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

file_finder: Simplify removal of file name from file path (#7398)

Marshall Bowers21797bad4d93
diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs
index d222682e807..521682e6b3d 100644
--- a/crates/file_finder/src/file_finder.rs
+++ b/crates/file_finder/src/file_finder.rs
@@ -584,12 +584,7 @@ impl FileFinderDelegate {
})
.collect();
- // Trim file name from the full path
- let full_path = if full_path.len() > file_name.len() {
- full_path[..full_path.len() - file_name.len() - 1].to_string()
- } else {
- "".to_string()
- };
+ let full_path = full_path.trim_end_matches(&file_name).to_string();
path_positions.retain(|idx| *idx < full_path.len());
(file_name, file_name_positions, full_path, path_positions)