From 5333eff0e4805a56f299c44e2d27354745b71f2c Mon Sep 17 00:00:00 2001 From: Ben Hamment Date: Wed, 31 Jan 2024 19:18:21 +0000 Subject: [PATCH] Improve file finder by ignoring spaces in query (#7068) Release Notes: - Changed file finder to ignore spaces in queries ([#5324 ](https://github.com/zed-industries/zed/issues/5324)). ![image](https://github.com/zed-industries/zed/assets/7274458/14f3d511-129d-4e73-b9d3-12ce1aaa892f) --------- Co-authored-by: Marshall Bowers --- crates/file_finder/src/file_finder.rs | 1 + crates/file_finder/src/file_finder_tests.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index f97c059a22..ca2808afb2 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -666,6 +666,7 @@ impl PickerDelegate for FileFinderDelegate { raw_query: String, cx: &mut ViewContext>, ) -> Task<()> { + let raw_query = raw_query.replace(" ", ""); let raw_query = raw_query.trim(); if raw_query.is_empty() { let project = self.project.read(cx); diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs index ca07cbf083..7702f71f46 100644 --- a/crates/file_finder/src/file_finder_tests.rs +++ b/crates/file_finder/src/file_finder_tests.rs @@ -53,6 +53,7 @@ async fn test_matching_paths(cx: &mut TestAppContext) { " bandana ", " ndan ", " band ", + "a bandana", ] { picker .update(cx, |picker, cx| {