From ef868ff0235ea867be1770f43dad2e004e0240c2 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 9 May 2022 20:41:18 -0600 Subject: [PATCH] Fix test after changing fuzzy matching for empty queries --- crates/project_symbols/src/project_symbols.rs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 4f083888d9..157ea8ef73 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -319,15 +319,20 @@ mod tests { .into_iter() .map(|name| StringMatchCandidate::new(0, name.into())) .collect::>(); - let matches = fuzzy::match_strings( - &candidates, - ¶ms.query, - true, - 100, - &Default::default(), - executor.clone(), - ) - .await; + let matches = if params.query.is_empty() { + Vec::new() + } else { + fuzzy::match_strings( + &candidates, + ¶ms.query, + true, + 100, + &Default::default(), + executor.clone(), + ) + .await + }; + Ok(Some( matches.into_iter().map(|mat| symbol(&mat.string)).collect(), ))