diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 341bb8b7cb71b08526fb159b3043c56f44f21ead..d6f7901915b7af590c6895fc7a9b9a57d3125e48 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -1758,12 +1758,10 @@ mod tests { DisplayPoint, Editor, ExcerptRange, MultiBuffer, SearchSettings, SelectionEffects, display_map::DisplayRow, test::editor_test_context::EditorTestContext, }; - use futures::channel::mpsc::UnboundedReceiver; use gpui::{Hsla, TestAppContext, UpdateGlobal, VisualTestContext}; use language::{Buffer, Point}; - use settings::{SearchSettingsContent, SettingsStore, initial_local_debug_tasks_content}; + use settings::{SearchSettingsContent, SettingsStore}; use smol::stream::StreamExt as _; - use tracing::instrument::WithSubscriber; use unindent::Unindent as _; use util_macros::perf; @@ -3280,7 +3278,7 @@ mod tests { editor.unfold_all(&UnfoldAll, window, cx); }); - let is_collapsed = search_bar.read_with(cx, |search_bar, cx| search_bar.is_collapsed); + let is_collapsed = search_bar.read_with(cx, |search_bar, _| search_bar.is_collapsed); assert!(!is_collapsed); } diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 74d35bd8b04d264e9dd7a20cc18dcbd8c57d75cc..ae484da33a3325f6c4c40365a25b174a62a5e8f3 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -10,7 +10,7 @@ use collections::HashMap; use editor::{ Anchor, Editor, EditorEvent, EditorSettings, MAX_TAB_TITLE_LEN, MultiBuffer, PathKey, SelectionEffects, - actions::{Backtab, FoldAll, SelectAll, Tab, ToggleFoldAll, UnfoldAll}, + actions::{Backtab, FoldAll, SelectAll, Tab, UnfoldAll}, items::active_match_index, multibuffer_context_lines, scroll::Autoscroll, @@ -42,7 +42,7 @@ use util::{ResultExt as _, paths::PathMatcher, rel_path::RelPath}; use workspace::{ DeploySearch, ItemNavHistory, NewSearch, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, - item::{BreadcrumbText, Item, ItemEvent, ItemHandle, SaveOptions}, + item::{Item, ItemEvent, ItemHandle, SaveOptions}, searchable::{CollapseDirection, Direction, SearchEvent, SearchableItem, SearchableItemHandle}, }; @@ -2699,6 +2699,32 @@ pub mod tests { (dp(5, 6)..dp(5, 9), "match"), ], ); + search_view + .update(cx, |search_view, window, cx| { + search_view.results_editor.update(cx, |editor, cx| { + editor.fold_all(&FoldAll, window, cx); + }) + }) + .expect("Should fold fine"); + + let results_collapsed = search_view + .read_with(cx, |search_view, _| search_view.results_collapsed) + .expect("got results_collapsed"); + + assert!(results_collapsed); + search_view + .update(cx, |search_view, window, cx| { + search_view.results_editor.update(cx, |editor, cx| { + editor.unfold_all(&UnfoldAll, window, cx); + }) + }) + .expect("Should unfold fine"); + + let results_collapsed = search_view + .read_with(cx, |search_view, _| search_view.results_collapsed) + .expect("got results_collapsed"); + + assert!(!results_collapsed); } #[perf]