Un serialize project search (#2857)
This is the first batch of improvements to current project search. There are few things we can do better still, but I want to get this out in next Preview. Most of the slowness at this point seems to stem from updating UI too often. Release Notes: - Improved project search by making it report results sooner. --------- Co-authored-by: Julia Risley <julia@zed.dev>
This commit is contained in:
parent
104f5ae9cd
commit
2495d6581e
6 changed files with 489 additions and 300 deletions
|
@ -3953,11 +3953,12 @@ async fn search(
|
|||
query: SearchQuery,
|
||||
cx: &mut gpui::TestAppContext,
|
||||
) -> Result<HashMap<String, Vec<Range<usize>>>> {
|
||||
let results = project
|
||||
.update(cx, |project, cx| project.search(query, cx))
|
||||
.await?;
|
||||
|
||||
Ok(results
|
||||
let mut search_rx = project.update(cx, |project, cx| project.search(query, cx));
|
||||
let mut result = HashMap::default();
|
||||
while let Some((buffer, range)) = search_rx.next().await {
|
||||
result.entry(buffer).or_insert(range);
|
||||
}
|
||||
Ok(result
|
||||
.into_iter()
|
||||
.map(|(buffer, ranges)| {
|
||||
buffer.read_with(cx, |buffer, _| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue