From 4e67d33d8803e674cafa36cf91a093fa8ca8163c Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 28 Aug 2024 13:39:53 +0200 Subject: [PATCH] project search: Fix filtering when buffers are open (#16997) This fixes a little bug that has snuck in #16923 Release Notes: - N/A --- crates/project/src/worktree_store.rs | 41 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index 56a054cd97..c87ff4e64f 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -471,17 +471,6 @@ impl WorktreeStore { continue; } - if open_entries.contains(&entry.id) { - let (mut tx, rx) = oneshot::channel(); - tx.send(ProjectPath { - worktree_id: snapshot.id(), - path: entry.path.clone(), - }) - .await?; - output_tx.send(rx).await?; - continue; - } - if query.filters_path() { let matched_path = if include_root { let mut full_path = PathBuf::from(snapshot.root_name()); @@ -495,18 +484,28 @@ impl WorktreeStore { } } - let (tx, rx) = oneshot::channel(); - output_tx.send(rx).await?; - filter_tx - .send(MatchingEntry { - respond: tx, - worktree_path: snapshot.abs_path().clone(), - path: ProjectPath { - worktree_id: snapshot.id(), - path: entry.path.clone(), - }, + let (mut tx, rx) = oneshot::channel(); + + if open_entries.contains(&entry.id) { + tx.send(ProjectPath { + worktree_id: snapshot.id(), + path: entry.path.clone(), }) .await?; + } else { + filter_tx + .send(MatchingEntry { + respond: tx, + worktree_path: snapshot.abs_path().clone(), + path: ProjectPath { + worktree_id: snapshot.id(), + path: entry.path.clone(), + }, + }) + .await?; + } + + output_tx.send(rx).await?; } } Ok(())