recent project: Fix highlighting for matches in SSH projs (#18332)

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-09-25 12:59:22 +02:00 committed by GitHub
parent 300bf87f77
commit 4e2ae06ca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -259,23 +259,12 @@ impl PickerDelegate for RecentProjectsDelegate {
dev_server_project.paths.join("") dev_server_project.paths.join("")
) )
} }
SerializedWorkspaceLocation::Ssh(ssh_project) => { SerializedWorkspaceLocation::Ssh(ssh_project) => ssh_project
format!( .ssh_urls()
"{}{}{}{}", .iter()
ssh_project.host, .map(|path| path.to_string_lossy().to_string())
ssh_project .collect::<Vec<_>>()
.port .join(""),
.as_ref()
.map(|port| port.to_string())
.unwrap_or_default(),
ssh_project.paths.join(","),
ssh_project
.user
.as_ref()
.map(|user| user.to_string())
.unwrap_or_default()
)
}
}; };
StringMatchCandidate::new(id, combined_string) StringMatchCandidate::new(id, combined_string)
@ -458,6 +447,7 @@ impl PickerDelegate for RecentProjectsDelegate {
.order() .order()
.iter() .iter()
.filter_map(|i| paths.paths().get(*i).cloned()) .filter_map(|i| paths.paths().get(*i).cloned())
.map(|path| path.compact())
.collect(), .collect(),
), ),
SerializedWorkspaceLocation::Ssh(ssh_project) => Arc::new(ssh_project.ssh_urls()), SerializedWorkspaceLocation::Ssh(ssh_project) => Arc::new(ssh_project.ssh_urls()),
@ -473,7 +463,6 @@ impl PickerDelegate for RecentProjectsDelegate {
let (match_labels, paths): (Vec<_>, Vec<_>) = paths let (match_labels, paths): (Vec<_>, Vec<_>) = paths
.iter() .iter()
.map(|path| { .map(|path| {
let path = path.compact();
let highlighted_text = let highlighted_text =
highlights_for_path(path.as_ref(), &hit.positions, path_start_offset); highlights_for_path(path.as_ref(), &hit.positions, path_start_offset);
@ -704,7 +693,6 @@ fn highlights_for_path(
}, },
) )
} }
impl RecentProjectsDelegate { impl RecentProjectsDelegate {
fn delete_recent_project(&self, ix: usize, cx: &mut ViewContext<Picker<Self>>) { fn delete_recent_project(&self, ix: usize, cx: &mut ViewContext<Picker<Self>>) {
if let Some(selected_match) = self.matches.get(ix) { if let Some(selected_match) = self.matches.get(ix) {