From b16f5e2e34579f2c1cc694274583b1da4a1aef55 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 20 Oct 2025 16:09:52 +0200 Subject: [PATCH] A couple of styling changes --- crates/project/src/project.rs | 2 +- crates/project/src/project_search.rs | 11 ++++++++--- crates/remote_server/src/headless_project.rs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index ad182b2f6cdf1686dad0afedc3726b554c188103..5c6fc4170b12f33f741d5af0975e271b972c3055 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -4037,7 +4037,7 @@ impl Project { ), } }; - searcher.into_results(query, cx) + searcher.into_handle(query, cx) } pub fn search(&mut self, query: SearchQuery, cx: &mut Context) -> Receiver { diff --git a/crates/project/src/project_search.rs b/crates/project/src/project_search.rs index f5da339c8cec8f847afe65622450627b7866ccc1..25fe578bd7dc2302645dcfb4fd557de1f2b22081 100644 --- a/crates/project/src/project_search.rs +++ b/crates/project/src/project_search.rs @@ -40,21 +40,26 @@ pub struct Search { kind: SearchKind, } +/// Represents search setup, before it is actually kicked off with Search::into_results enum SearchKind { + /// Search for candidates by inspecting file contents on file system, avoiding loading the buffer unless we know that a given file contains a match. Local { fs: Arc, worktrees: Vec>, }, + /// Query remote host for candidates. As of writing, the host runs a local search in "buffers with matches only" mode. Remote { client: AnyProtoClient, remote_id: u64, models: Arc>, }, + /// Run search against a known set of candidates. Even when working with a remote host, this won't round-trip to host. OpenBuffersOnly, } /// Represents results of project search and allows one to either obtain match positions OR -/// just the handles to buffers that may match the search. +/// just the handles to buffers that may match the search. Grabbing the handles is cheaper than obtaining full match positions, because in that case we'll look for +/// at most one match in each file. #[must_use] pub struct SearchResultsHandle { results: Receiver, @@ -145,9 +150,9 @@ impl Search { pub(crate) const MAX_SEARCH_RESULT_FILES: usize = 5_000; pub(crate) const MAX_SEARCH_RESULT_RANGES: usize = 10_000; - /// Prepares a project search run. The result has to be used to specify whether you're interested in matching buffers + /// Prepares a project search run. The resulting [`SearchResultsHandle`] has to be used to specify whether you're interested in matching buffers /// or full search results. - pub fn into_results(mut self, query: SearchQuery, cx: &mut App) -> SearchResultsHandle { + pub fn into_handle(mut self, query: SearchQuery, cx: &mut App) -> SearchResultsHandle { let mut open_buffers = HashSet::default(); let mut unnamed_buffers = Vec::new(); const MAX_CONCURRENT_BUFFER_OPENS: usize = 64; diff --git a/crates/remote_server/src/headless_project.rs b/crates/remote_server/src/headless_project.rs index 73e933c185eeb00431b36368f27c00d7929b8459..caec0f5c1a4829ad0117469d705567ccf557ef46 100644 --- a/crates/remote_server/src/headless_project.rs +++ b/crates/remote_server/src/headless_project.rs @@ -647,7 +647,7 @@ impl HeadlessProject { message.limit as _, cx, ) - .into_results(query, cx) + .into_handle(query, cx) .matching_buffers(cx) })?;