Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Shorten full paths with ~
Kirill Bulatov5fda9e934d55
diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rsindex d00704d6b9a..73e7ca6eaa1 100644--- a/crates/file_finder/src/file_finder.rs+++ b/crates/file_finder/src/file_finder.rs@@ -285,7 +285,7 @@ impl FileFinderDelegate {cx: &AppContext,ix: usize,) -> (String, Vec<usize>, String, Vec<usize>) {- match path_match {+ let (file_name, file_name_positions, full_path, full_path_positions) = match path_match {Match::History(found_path) => {let worktree_id = found_path.project.worktree_id;let project_relative_path = &found_path.project.path;@@ -328,7 +328,30 @@ impl FileFinderDelegate {})}Match::Search(path_match) => self.labels_for_path_match(path_match),+ };++ if file_name_positions.is_empty() {+ if let Some(user_home_path) = std::env::var("HOME").ok() {+ let user_home_path = user_home_path.trim();+ if !user_home_path.is_empty() {+ if (&full_path).starts_with(user_home_path) {+ return (+ file_name,+ file_name_positions,+ full_path.replace(user_home_path, "~"),+ full_path_positions,+ );+ }+ }+ }}++ (+ file_name,+ file_name_positions,+ full_path,+ full_path_positions,+ )}fn labels_for_path_match(