project_search: Fix message displayed when no results are found (#19108)

CharlesChen0823 and Marshall Bowers created

when no result found, always display `Search all files`, which is
confused.

Release Notes:

- Fixed an issue where the project search would sometimes show "Search
all files" when there were no results.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>

Change summary

crates/search/src/project_search.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Detailed changes

crates/search/src/project_search.rs 🔗

@@ -289,7 +289,6 @@ impl ProjectSearch {
                     .await;
 
                 this.update(&mut cx, |this, cx| {
-                    this.no_results = Some(false);
                     this.match_ranges.extend(match_ranges);
                     cx.notify();
                 })
@@ -297,6 +296,9 @@ impl ProjectSearch {
             }
 
             this.update(&mut cx, |this, cx| {
+                if !this.match_ranges.is_empty() {
+                    this.no_results = Some(false);
+                }
                 this.limit_reached = limit_reached;
                 this.pending_search.take();
                 cx.notify();