project_search: Add ability to search only for opened files (#16580)

Any suggestion?

Release Notes:
  - add ability for project search only for opend files.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
CharlesChen0823 2024-08-29 11:41:29 +08:00 committed by GitHub
parent 403fdd6018
commit 400e503d9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 192 additions and 20 deletions

View file

@ -3941,7 +3941,8 @@ async fn test_search(cx: &mut gpui::TestAppContext) {
true,
false,
Default::default(),
Default::default()
Default::default(),
None
)
.unwrap(),
cx
@ -3974,7 +3975,8 @@ async fn test_search(cx: &mut gpui::TestAppContext) {
true,
false,
Default::default(),
Default::default()
Default::default(),
None,
)
.unwrap(),
cx
@ -4017,7 +4019,8 @@ async fn test_search_with_inclusions(cx: &mut gpui::TestAppContext) {
true,
false,
PathMatcher::new(&["*.odd".to_owned()]).unwrap(),
Default::default()
Default::default(),
None
)
.unwrap(),
cx
@ -4037,7 +4040,8 @@ async fn test_search_with_inclusions(cx: &mut gpui::TestAppContext) {
true,
false,
PathMatcher::new(&["*.rs".to_owned()]).unwrap(),
Default::default()
Default::default(),
None
)
.unwrap(),
cx
@ -4063,6 +4067,7 @@ async fn test_search_with_inclusions(cx: &mut gpui::TestAppContext) {
PathMatcher::new(&["*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
Default::default(),
None,
).unwrap(),
cx
)
@ -4087,6 +4092,7 @@ async fn test_search_with_inclusions(cx: &mut gpui::TestAppContext) {
PathMatcher::new(&["*.rs".to_owned(), "*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
Default::default(),
None,
).unwrap(),
cx
)
@ -4131,6 +4137,7 @@ async fn test_search_with_exclusions(cx: &mut gpui::TestAppContext) {
false,
Default::default(),
PathMatcher::new(&["*.odd".to_owned()]).unwrap(),
None,
)
.unwrap(),
cx
@ -4155,7 +4162,8 @@ async fn test_search_with_exclusions(cx: &mut gpui::TestAppContext) {
true,
false,
Default::default(),
PathMatcher::new(&["*.rs".to_owned()]).unwrap()
PathMatcher::new(&["*.rs".to_owned()]).unwrap(),
None,
)
.unwrap(),
cx
@ -4180,6 +4188,7 @@ async fn test_search_with_exclusions(cx: &mut gpui::TestAppContext) {
Default::default(),
PathMatcher::new(&["*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
None,
).unwrap(),
cx
@ -4204,6 +4213,7 @@ async fn test_search_with_exclusions(cx: &mut gpui::TestAppContext) {
Default::default(),
PathMatcher::new(&["*.rs".to_owned(), "*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
None,
).unwrap(),
cx
@ -4243,6 +4253,7 @@ async fn test_search_with_exclusions_and_inclusions(cx: &mut gpui::TestAppContex
false,
PathMatcher::new(&["*.odd".to_owned()]).unwrap(),
PathMatcher::new(&["*.odd".to_owned()]).unwrap(),
None,
)
.unwrap(),
cx
@ -4263,6 +4274,7 @@ async fn test_search_with_exclusions_and_inclusions(cx: &mut gpui::TestAppContex
false,
PathMatcher::new(&["*.ts".to_owned()]).unwrap(),
PathMatcher::new(&["*.ts".to_owned()]).unwrap(),
None,
).unwrap(),
cx
)
@ -4282,6 +4294,7 @@ async fn test_search_with_exclusions_and_inclusions(cx: &mut gpui::TestAppContex
false,
PathMatcher::new(&["*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
PathMatcher::new(&["*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
None,
)
.unwrap(),
cx
@ -4302,6 +4315,7 @@ async fn test_search_with_exclusions_and_inclusions(cx: &mut gpui::TestAppContex
false,
PathMatcher::new(&["*.ts".to_owned(), "*.odd".to_owned()]).unwrap(),
PathMatcher::new(&["*.rs".to_owned(), "*.odd".to_owned()]).unwrap(),
None,
)
.unwrap(),
cx
@ -4354,7 +4368,8 @@ async fn test_search_multiple_worktrees_with_inclusions(cx: &mut gpui::TestAppCo
true,
false,
PathMatcher::new(&["worktree-a/*.rs".to_owned()]).unwrap(),
Default::default()
Default::default(),
None,
)
.unwrap(),
cx
@ -4373,7 +4388,8 @@ async fn test_search_multiple_worktrees_with_inclusions(cx: &mut gpui::TestAppCo
true,
false,
PathMatcher::new(&["worktree-b/*.rs".to_owned()]).unwrap(),
Default::default()
Default::default(),
None,
)
.unwrap(),
cx
@ -4393,7 +4409,8 @@ async fn test_search_multiple_worktrees_with_inclusions(cx: &mut gpui::TestAppCo
true,
false,
PathMatcher::new(&["*.ts".to_owned()]).unwrap(),
Default::default()
Default::default(),
None,
)
.unwrap(),
cx
@ -4447,7 +4464,8 @@ async fn test_search_in_gitignored_dirs(cx: &mut gpui::TestAppContext) {
false,
false,
Default::default(),
Default::default()
Default::default(),
None,
)
.unwrap(),
cx
@ -4468,7 +4486,8 @@ async fn test_search_in_gitignored_dirs(cx: &mut gpui::TestAppContext) {
false,
true,
Default::default(),
Default::default()
Default::default(),
None,
)
.unwrap(),
cx
@ -4508,6 +4527,7 @@ async fn test_search_in_gitignored_dirs(cx: &mut gpui::TestAppContext) {
true,
files_to_include,
files_to_exclude,
None,
)
.unwrap(),
cx
@ -4554,6 +4574,7 @@ async fn test_search_ordering(cx: &mut gpui::TestAppContext) {
true,
Default::default(),
Default::default(),
None,
)
.unwrap(),
cx,