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.

agent_ui: Match project name in archive-view search (#58214)

KevinLavetodf9c9f055e55
diff --git a/crates/agent_ui/src/threads_archive_view.rs b/crates/agent_ui/src/threads_archive_view.rs
index 75cf1bf9934..f2c325a6bda 100644
--- a/crates/agent_ui/src/threads_archive_view.rs
+++ b/crates/agent_ui/src/threads_archive_view.rs
@@ -300,16 +300,27 @@ impl ThreadsArchiveView {
for session in sessions {
let highlight_positions = if !query.is_empty() {
- match fuzzy_match_positions(
- &query,
- session
- .title
- .as_ref()
- .map(|t| t.as_ref())
- .unwrap_or(DEFAULT_THREAD_TITLE),
- ) {
- Some(positions) => positions,
- None => continue,
+ let title = session
+ .title
+ .as_ref()
+ .map(|t| t.as_ref())
+ .unwrap_or(DEFAULT_THREAD_TITLE);
+ if let Some(positions) = fuzzy_match_positions(&query, title) {
+ positions
+ } else {
+ // If title didn't match, also try matching the project name
+ // (the basename of any of the thread's worktree paths), so
+ // typing a project name surfaces its threads here too.
+ let worktree_matched = session.folder_paths().paths().iter().any(|p| {
+ p.as_path()
+ .file_name()
+ .and_then(|name| name.to_str())
+ .is_some_and(|name| fuzzy_match_positions(&query, name).is_some())
+ });
+ if !worktree_matched {
+ continue;
+ }
+ Vec::new()
}
} else {
Vec::new()