Skip to content

Commit b16f5e2

Browse files
committed
A couple of styling changes
1 parent f0f8109 commit b16f5e2

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

crates/project/src/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4037,7 +4037,7 @@ impl Project {
40374037
),
40384038
}
40394039
};
4040-
searcher.into_results(query, cx)
4040+
searcher.into_handle(query, cx)
40414041
}
40424042

40434043
pub fn search(&mut self, query: SearchQuery, cx: &mut Context<Self>) -> Receiver<SearchResult> {

crates/project/src/project_search.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,26 @@ pub struct Search {
4040
kind: SearchKind,
4141
}
4242

43+
/// Represents search setup, before it is actually kicked off with Search::into_results
4344
enum SearchKind {
45+
/// Search for candidates by inspecting file contents on file system, avoiding loading the buffer unless we know that a given file contains a match.
4446
Local {
4547
fs: Arc<dyn Fs>,
4648
worktrees: Vec<Entity<Worktree>>,
4749
},
50+
/// Query remote host for candidates. As of writing, the host runs a local search in "buffers with matches only" mode.
4851
Remote {
4952
client: AnyProtoClient,
5053
remote_id: u64,
5154
models: Arc<Mutex<RemotelyCreatedModels>>,
5255
},
56+
/// Run search against a known set of candidates. Even when working with a remote host, this won't round-trip to host.
5357
OpenBuffersOnly,
5458
}
5559

5660
/// Represents results of project search and allows one to either obtain match positions OR
57-
/// just the handles to buffers that may match the search.
61+
/// 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
62+
/// at most one match in each file.
5863
#[must_use]
5964
pub struct SearchResultsHandle {
6065
results: Receiver<SearchResult>,
@@ -145,9 +150,9 @@ impl Search {
145150

146151
pub(crate) const MAX_SEARCH_RESULT_FILES: usize = 5_000;
147152
pub(crate) const MAX_SEARCH_RESULT_RANGES: usize = 10_000;
148-
/// Prepares a project search run. The result has to be used to specify whether you're interested in matching buffers
153+
/// Prepares a project search run. The resulting [`SearchResultsHandle`] has to be used to specify whether you're interested in matching buffers
149154
/// or full search results.
150-
pub fn into_results(mut self, query: SearchQuery, cx: &mut App) -> SearchResultsHandle {
155+
pub fn into_handle(mut self, query: SearchQuery, cx: &mut App) -> SearchResultsHandle {
151156
let mut open_buffers = HashSet::default();
152157
let mut unnamed_buffers = Vec::new();
153158
const MAX_CONCURRENT_BUFFER_OPENS: usize = 64;

crates/remote_server/src/headless_project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ impl HeadlessProject {
647647
message.limit as _,
648648
cx,
649649
)
650-
.into_results(query, cx)
650+
.into_handle(query, cx)
651651
.matching_buffers(cx)
652652
})?;
653653

0 commit comments

Comments
 (0)