diff --git a/Cargo.lock b/Cargo.lock index 02b27566e42f29eccd5b4a0ca145567e885cf36b..e24d7a9e6010ae0568935a7163a303b0179193af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5014,6 +5014,7 @@ dependencies = [ "settings", "smol", "text", + "util", "workspace", ] diff --git a/crates/recent_projects/Cargo.toml b/crates/recent_projects/Cargo.toml index e8d851fa083ab85ef6a05f53c3a5eb07ab8e4667..c056b6885250822be9e877226cdf89c0db2ed5e3 100644 --- a/crates/recent_projects/Cargo.toml +++ b/crates/recent_projects/Cargo.toml @@ -21,3 +21,4 @@ workspace = { path = "../workspace" } ordered-float = "2.1.1" postage = { workspace = true } smol = "1.2" +util = { path = "../util"} diff --git a/crates/recent_projects/src/highlighted_workspace_location.rs b/crates/recent_projects/src/highlighted_workspace_location.rs index 8e75b291a0748627ce47c570c607eb2d2163358d..b414b84f4ab2bc84887c93393c7908a413d7ada1 100644 --- a/crates/recent_projects/src/highlighted_workspace_location.rs +++ b/crates/recent_projects/src/highlighted_workspace_location.rs @@ -1,4 +1,4 @@ -use std::path::Path; +use std::path::{Path, PathBuf}; use fuzzy::StringMatch; use gpui::{ @@ -61,8 +61,16 @@ impl HighlightedWorkspaceLocation { .paths() .iter() .map(|path| { + let mut full_path = PathBuf::new(); + if path.starts_with(util::paths::HOME.as_path()) { + full_path.push("~"); + full_path.push(path.strip_prefix(util::paths::HOME.as_path()).unwrap()); + } else { + full_path.push(path) + } + let highlighted_text = Self::highlights_for_path( - path.as_ref(), + full_path.as_ref(), &string_match.positions, path_start_offset, );