Remove old project search code path, bump min-supported zed version for collaboration (#18404)
Release Notes: - N/A
This commit is contained in:
parent
71da81c743
commit
c1a039a5d7
6 changed files with 22 additions and 157 deletions
|
@ -558,7 +558,6 @@ impl Project {
|
|||
client.add_model_message_handler(Self::handle_update_worktree);
|
||||
client.add_model_request_handler(Self::handle_synchronize_buffers);
|
||||
|
||||
client.add_model_request_handler(Self::handle_search_project);
|
||||
client.add_model_request_handler(Self::handle_search_candidate_buffers);
|
||||
client.add_model_request_handler(Self::handle_open_buffer_by_id);
|
||||
client.add_model_request_handler(Self::handle_open_buffer_by_path);
|
||||
|
@ -2692,9 +2691,9 @@ impl Project {
|
|||
let (result_tx, result_rx) = smol::channel::unbounded();
|
||||
|
||||
let matching_buffers_rx = if query.is_opened_only() {
|
||||
self.sort_candidate_buffers(&query, cx)
|
||||
self.sort_search_candidates(&query, cx)
|
||||
} else {
|
||||
self.search_for_candidate_buffers(&query, MAX_SEARCH_RESULT_FILES + 1, cx)
|
||||
self.find_search_candidate_buffers(&query, MAX_SEARCH_RESULT_FILES + 1, cx)
|
||||
};
|
||||
|
||||
cx.spawn(|_, cx| async move {
|
||||
|
@ -2757,7 +2756,7 @@ impl Project {
|
|||
result_rx
|
||||
}
|
||||
|
||||
fn search_for_candidate_buffers(
|
||||
fn find_search_candidate_buffers(
|
||||
&mut self,
|
||||
query: &SearchQuery,
|
||||
limit: usize,
|
||||
|
@ -2769,11 +2768,11 @@ impl Project {
|
|||
buffer_store.find_search_candidates(query, limit, fs, cx)
|
||||
})
|
||||
} else {
|
||||
self.search_for_candidate_buffers_remote(query, limit, cx)
|
||||
self.find_search_candidates_remote(query, limit, cx)
|
||||
}
|
||||
}
|
||||
|
||||
fn sort_candidate_buffers(
|
||||
fn sort_search_candidates(
|
||||
&mut self,
|
||||
search_query: &SearchQuery,
|
||||
cx: &mut ModelContext<Project>,
|
||||
|
@ -2815,7 +2814,7 @@ impl Project {
|
|||
rx
|
||||
}
|
||||
|
||||
fn search_for_candidate_buffers_remote(
|
||||
fn find_search_candidates_remote(
|
||||
&mut self,
|
||||
query: &SearchQuery,
|
||||
limit: usize,
|
||||
|
@ -3656,46 +3655,6 @@ impl Project {
|
|||
Ok(proto::TaskTemplatesResponse { templates })
|
||||
}
|
||||
|
||||
async fn handle_search_project(
|
||||
this: Model<Self>,
|
||||
envelope: TypedEnvelope<proto::SearchProject>,
|
||||
mut cx: AsyncAppContext,
|
||||
) -> Result<proto::SearchProjectResponse> {
|
||||
let peer_id = envelope.original_sender_id()?;
|
||||
let query = SearchQuery::from_proto_v1(envelope.payload)?;
|
||||
let mut result = this.update(&mut cx, |this, cx| this.search(query, cx))?;
|
||||
|
||||
cx.spawn(move |mut cx| async move {
|
||||
let mut locations = Vec::new();
|
||||
let mut limit_reached = false;
|
||||
while let Some(result) = result.next().await {
|
||||
match result {
|
||||
SearchResult::Buffer { buffer, ranges } => {
|
||||
for range in ranges {
|
||||
let start = serialize_anchor(&range.start);
|
||||
let end = serialize_anchor(&range.end);
|
||||
let buffer_id = this.update(&mut cx, |this, cx| {
|
||||
this.create_buffer_for_peer(&buffer, peer_id, cx).into()
|
||||
})?;
|
||||
locations.push(proto::Location {
|
||||
buffer_id,
|
||||
start: Some(start),
|
||||
end: Some(end),
|
||||
});
|
||||
}
|
||||
}
|
||||
SearchResult::LimitReached => limit_reached = true,
|
||||
}
|
||||
}
|
||||
Ok(proto::SearchProjectResponse {
|
||||
locations,
|
||||
limit_reached,
|
||||
// will restart
|
||||
})
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
async fn handle_search_candidate_buffers(
|
||||
this: Model<Self>,
|
||||
envelope: TypedEnvelope<proto::FindSearchCandidates>,
|
||||
|
@ -3709,7 +3668,7 @@ impl Project {
|
|||
.ok_or_else(|| anyhow!("missing query field"))?,
|
||||
)?;
|
||||
let mut results = this.update(&mut cx, |this, cx| {
|
||||
this.search_for_candidate_buffers(&query, message.limit as _, cx)
|
||||
this.find_search_candidate_buffers(&query, message.limit as _, cx)
|
||||
})?;
|
||||
|
||||
let mut response = proto::FindSearchCandidatesResponse {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue