mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Tweak the fuzzy search limits
This commit is contained in:
parent
eecbb51cb3
commit
77b4a1c5ef
1 changed files with 6 additions and 1 deletions
|
@ -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
|
// 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).
|
// (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
|
// .Merge Behavior
|
||||||
//
|
//
|
||||||
|
@ -126,6 +127,10 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()
|
||||||
let _p = profile::span("fuzzy_completion");
|
let _p = profile::span("fuzzy_completion");
|
||||||
let potential_import_name = ctx.token.to_string();
|
let potential_import_name = ctx.token.to_string();
|
||||||
|
|
||||||
|
if potential_import_name.len() < 2 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let current_module = ctx.scope.module()?;
|
let current_module = ctx.scope.module()?;
|
||||||
let anchor = ctx.name_ref_syntax.as_ref()?;
|
let anchor = ctx.name_ref_syntax.as_ref()?;
|
||||||
let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;
|
let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;
|
||||||
|
@ -133,7 +138,7 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()
|
||||||
let mut all_mod_paths = imports_locator::find_similar_imports(
|
let mut all_mod_paths = imports_locator::find_similar_imports(
|
||||||
&ctx.sema,
|
&ctx.sema,
|
||||||
ctx.krate?,
|
ctx.krate?,
|
||||||
Some(100),
|
Some(40),
|
||||||
&potential_import_name,
|
&potential_import_name,
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue