diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index e0819aa14a54babedd518507684895d9127675e8..24721f1fa2e5cf0814cc79baa251a0d9ec5d0708 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -779,9 +779,7 @@ impl FileFinderDelegate { let worktree = worktree.read(cx); PathMatchCandidateSet { snapshot: worktree.snapshot(), - include_ignored: worktree - .root_entry() - .map_or(false, |entry| entry.is_ignored), + include_ignored: true, include_root_name, candidates: project::Candidates::Files, } diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs index 71bfef2685e204cca867f2af0224acda0dd4d638..3c6e5b93dd5611e87195c5fd4620f1278c06a56c 100644 --- a/crates/file_finder/src/file_finder_tests.rs +++ b/crates/file_finder/src/file_finder_tests.rs @@ -7,7 +7,7 @@ use menu::{Confirm, SelectNext, SelectPrevious}; use project::{FS_WATCH_LATENCY, RemoveOptions}; use serde_json::json; use util::path; -use workspace::{AppState, OpenOptions, ToggleFileFinder, Workspace}; +use workspace::{AppState, CloseActiveItem, OpenOptions, ToggleFileFinder, Workspace}; #[ctor::ctor] fn init_logger() { @@ -615,9 +615,13 @@ async fn test_ignored_root(cx: &mut TestAppContext) { "hiccup": "", }, "tracked-root": { - ".gitignore": "height", + ".gitignore": "height*", "happiness": "", "height": "", + "heights": { + "height_1": "", + "height_2": "", + }, "hi": "", "hiccup": "", }, @@ -628,15 +632,63 @@ async fn test_ignored_root(cx: &mut TestAppContext) { let project = Project::test( app_state.fs.clone(), [ - "/ancestor/tracked-root".as_ref(), - "/ancestor/ignored-root".as_ref(), + Path::new(path!("/ancestor/tracked-root")), + Path::new(path!("/ancestor/ignored-root")), ], cx, ) .await; + let (picker, workspace, cx) = build_find_picker(project, cx); - let (picker, _, cx) = build_find_picker(project, cx); + picker + .update_in(cx, |picker, window, cx| { + picker + .delegate + .spawn_search(test_path_position("hi"), window, cx) + }) + .await; + picker.update(cx, |picker, _| { + let matches = collect_search_matches(picker); + assert_eq!(matches.history.len(), 0); + assert_eq!( + matches.search, + vec![ + PathBuf::from("ignored-root/hi"), + PathBuf::from("tracked-root/hi"), + PathBuf::from("ignored-root/hiccup"), + PathBuf::from("tracked-root/hiccup"), + PathBuf::from("ignored-root/height"), + PathBuf::from("tracked-root/height"), + PathBuf::from("ignored-root/happiness"), + PathBuf::from("tracked-root/happiness"), + ], + "All ignored files that were indexed are found" + ); + }); + workspace + .update_in(cx, |workspace, window, cx| { + workspace.open_abs_path( + PathBuf::from(path!("/ancestor/tracked-root/heights/height_1")), + OpenOptions { + visible: Some(OpenVisible::None), + ..OpenOptions::default() + }, + window, + cx, + ) + }) + .await + .unwrap(); + workspace + .update_in(cx, |workspace, window, cx| { + workspace.active_pane().update(cx, |pane, cx| { + pane.close_active_item(&CloseActiveItem::default(), window, cx) + .unwrap() + }) + }) + .await + .unwrap(); picker .update_in(cx, |picker, window, cx| { picker @@ -644,7 +696,26 @@ async fn test_ignored_root(cx: &mut TestAppContext) { .spawn_search(test_path_position("hi"), window, cx) }) .await; - picker.update(cx, |picker, _| assert_eq!(picker.delegate.matches.len(), 7)); + picker.update(cx, |picker, _| { + let matches = collect_search_matches(picker); + assert_eq!(matches.history.len(), 0); + assert_eq!( + matches.search, + vec![ + PathBuf::from("ignored-root/hi"), + PathBuf::from("tracked-root/hi"), + PathBuf::from("ignored-root/hiccup"), + PathBuf::from("tracked-root/hiccup"), + PathBuf::from("ignored-root/height"), + PathBuf::from("tracked-root/height"), + PathBuf::from("tracked-root/heights/height_1"), + PathBuf::from("tracked-root/heights/height_2"), + PathBuf::from("ignored-root/happiness"), + PathBuf::from("tracked-root/happiness"), + ], + "All ignored files that were indexed are found" + ); + }); } #[gpui::test]