Skip to content

Commit

Permalink
Tweak the fuzzy search limits
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneToIgnore committed Dec 28, 2020
1 parent eecbb51 commit 77b4a1c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/completion/src/completions/unqualified_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T
//
// To avoid an excessive amount of the results returned, completion input is checked for inclusion in the names only
// (i.e. in `HashMap` in the `std::collections::HashMap` path).
// For the same reasons, avoids searching for any imports for inputs with their length less that 2 symbols.
//
// .Merge Behavior
//
Expand All @@ -126,14 +127,18 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()
let _p = profile::span("fuzzy_completion");
let potential_import_name = ctx.token.to_string();

if potential_import_name.len() < 2 {
return None;
}

let current_module = ctx.scope.module()?;
let anchor = ctx.name_ref_syntax.as_ref()?;
let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;

let mut all_mod_paths = imports_locator::find_similar_imports(
&ctx.sema,
ctx.krate?,
Some(100),
Some(40),
&potential_import_name,
true,
)
Expand Down

0 comments on commit 77b4a1c

Please sign in to comment.