From 44ee328691c2ff02bf785bf81fc3dd4d12a68063 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 13 Apr 2026 14:37:42 +0300 Subject: [PATCH] Remove the stale code --- crates/multi_buffer/src/multi_buffer.rs | 2 +- crates/search/Cargo.toml | 1 - crates/search/src/project_search.rs | 61 ++++++------------------- 3 files changed, 15 insertions(+), 49 deletions(-) diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 419941da308f4502211991e0f2eba79b7f3bdaf4..724f659e44e8153a9ef5b1a01b6b66529ab3a3e2 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -1762,7 +1762,7 @@ impl MultiBuffer { } #[instrument(skip_all)] - pub fn merge_excerpt_ranges<'a>( + fn merge_excerpt_ranges<'a>( expanded_ranges: impl IntoIterator> + 'a, ) -> Vec> { let mut sorted: Vec<_> = expanded_ranges.into_iter().collect(); diff --git a/crates/search/Cargo.toml b/crates/search/Cargo.toml index f3dcd1f3b7837e69e1979408a5abe2d644a22062..4213aa39a046e944cd34f9a1530bd15d1c442863 100644 --- a/crates/search/Cargo.toml +++ b/crates/search/Cargo.toml @@ -53,7 +53,6 @@ editor = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] } lsp.workspace = true -multi_buffer.workspace = true pretty_assertions.workspace = true unindent.workspace = true workspace = { workspace = true, features = ["test-support"] } diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index f91765069680451d65985b63b53fdfe9271d68dc..557d5e48bbd38b4af018767a8b41d99e12eea78b 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -9,7 +9,7 @@ use crate::{ }, }; use anyhow::Context as _; -use collections::{HashMap, HashSet}; +use collections::HashMap; use editor::{ Anchor, Editor, EditorEvent, EditorSettings, MAX_TAB_TITLE_LEN, MultiBuffer, PathKey, SelectionEffects, @@ -333,6 +333,7 @@ impl ProjectSearch { } }) } + fn subscribe_to_excerpts( excerpts: &Entity, cx: &mut Context, @@ -433,7 +434,6 @@ impl ProjectSearch { } let mut limit_reached = false; - let mut seen_paths = HashSet::default(); while let Some(results) = matches.next().await { let (buffers_with_ranges, has_reached_limit) = cx .background_executor() @@ -456,14 +456,14 @@ impl ProjectSearch { limit_reached |= has_reached_limit; if incremental { - let buffers_with_ranges: Vec<_> = buffers_with_ranges + let buffers_with_ranges = buffers_with_ranges .into_iter() .filter(|(_, ranges)| !ranges.is_empty()) - .collect(); + .collect::>(); if buffers_with_ranges.is_empty() { continue; } - let (mut chunk_ranges, chunk_paths) = project_search + let (mut chunk_ranges, _) = project_search .update(cx, |project_search, cx| { let mut paths = Vec::new(); let futures = project_search.excerpts.update(cx, |excerpts, cx| { @@ -485,7 +485,6 @@ impl ProjectSearch { (futures, paths) }) .ok()?; - seen_paths.extend(chunk_paths); while let Some(ranges) = chunk_ranges.next().await { smol::future::yield_now().await; project_search @@ -529,44 +528,14 @@ impl ProjectSearch { } } - if incremental { - project_search - .update(cx, |project_search, cx| { - if seen_paths.is_empty() { - project_search - .excerpts - .update(cx, |excerpts, cx| excerpts.clear(cx)); - } else { - // TODO kb - // project_search.excerpts.update(cx, |excerpts, cx| { - // let stale = excerpts - // .paths() - // .filter(|path| !seen_paths.contains(*path)) - // .cloned() - // .collect::>(); - // for path in stale { - // excerpts.remove_excerpts_for_path(path, cx); - // } - // }); - } - project_search.no_results = Some(project_search.match_ranges.is_empty()); - project_search.limit_reached = limit_reached; - project_search.pending_search.take(); - cx.notify(); - }) - .ok()?; - } else { - project_search - .update(cx, |project_search, cx| { - if !project_search.match_ranges.is_empty() { - project_search.no_results = Some(false); - } - project_search.limit_reached = limit_reached; - project_search.pending_search.take(); - cx.notify(); - }) - .ok()?; - } + project_search + .update(cx, |project_search, cx| { + project_search.no_results = Some(project_search.match_ranges.is_empty()); + project_search.limit_reached = limit_reached; + project_search.pending_search.take(); + cx.notify(); + }) + .ok()?; None })); @@ -1037,8 +1006,7 @@ impl ProjectSearchView { } } - let search_settings = &EditorSettings::get_global(cx).search; - if search_settings.search_on_input { + if EditorSettings::get_global(cx).search.search_on_input { if this.query_editor.read(cx).is_empty(cx) { this.entity.update(cx, |model, cx| { model.pending_search = None; @@ -1692,7 +1660,6 @@ impl ProjectSearchView { let editor = match kind { SearchInputKind::Query => &self.query_editor, SearchInputKind::Include => &self.included_files_editor, - SearchInputKind::Exclude => &self.excluded_files_editor, }; editor.update(cx, |editor, cx| {