:facepalm: Fixed test_search test.

Piotr Osiewicz and Smit Barmase created

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

Change summary

crates/project/src/project.rs        | 46 -----------------------------
crates/project/src/project_search.rs |  5 +-
2 files changed, 2 insertions(+), 49 deletions(-)

Detailed changes

crates/project/src/project.rs 🔗

@@ -4016,7 +4016,6 @@ impl Project {
             fs: self.fs.clone(),
             buffer_store: self.buffer_store.clone(),
             snapshots,
-            open_buffers: Default::default(),
         };
         searcher.into_results(query, cx)
     }
@@ -4024,51 +4023,6 @@ impl Project {
         self.search_impl(query, cx).results(cx)
     }
 
-    fn find_search_candidates_remote(
-        &mut self,
-        query: &SearchQuery,
-        limit: usize,
-        cx: &mut Context<Project>,
-    ) -> Receiver<Entity<Buffer>> {
-        let (tx, rx) = smol::channel::unbounded();
-
-        let (client, remote_id): (AnyProtoClient, _) = if let Some(ssh_client) = &self.remote_client
-        {
-            (ssh_client.read(cx).proto_client(), 0)
-        } else if let Some(remote_id) = self.remote_id() {
-            (self.collab_client.clone().into(), remote_id)
-        } else {
-            return rx;
-        };
-
-        let request = client.request(proto::FindSearchCandidates {
-            project_id: remote_id,
-            query: Some(query.to_proto()),
-            limit: limit as _,
-        });
-        let guard = self.retain_remotely_created_models(cx);
-
-        cx.spawn(async move |project, cx| {
-            let response = request.await?;
-            for buffer_id in response.buffer_ids {
-                let buffer_id = BufferId::new(buffer_id)?;
-                let buffer = project
-                    .update(cx, |project, cx| {
-                        project.buffer_store.update(cx, |buffer_store, cx| {
-                            buffer_store.wait_for_remote_buffer(buffer_id, cx)
-                        })
-                    })?
-                    .await?;
-                let _ = tx.send(buffer).await;
-            }
-
-            drop(guard);
-            anyhow::Ok(())
-        })
-        .detach_and_log_err(cx);
-        rx
-    }
-
     pub fn request_lsp<R: LspCommand>(
         &mut self,
         buffer_handle: Entity<Buffer>,

crates/project/src/project_search.rs 🔗

@@ -29,7 +29,6 @@ pub(crate) struct Search {
     pub(crate) fs: Arc<dyn Fs>,
     pub(crate) buffer_store: Entity<BufferStore>,
     pub(crate) snapshots: Vec<(Snapshot, WorktreeSettings)>,
-    pub(crate) open_buffers: HashSet<ProjectEntryId>,
 }
 
 const MAX_SEARCH_RESULT_FILES: usize = 5_000;
@@ -98,7 +97,7 @@ impl Search {
                     for _ in 0..executor.num_cpus() {
                         let worker = Worker {
                             query: &query,
-                            open_buffers: &self.open_buffers,
+                            open_buffers: &open_buffers,
                             matched_buffer_count: &matched_buffer_count,
                             matches_count: &matches_count,
                             fs: &*self.fs,
@@ -286,7 +285,7 @@ impl Worker<'_> {
                     let Some(matches) = find_all_matches else {
                         self.publish_matches = bounded(1).0;
                         continue;
-                        };
+                    };
                     let result = handler.handle_find_all_matches(matches).await;
                     if let Some(_should_bail) = result {
                         self.publish_matches = bounded(1).0;