aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/completion/src')
-rw-r--r--crates/completion/src/completions/magic.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/completion/src/completions/magic.rs b/crates/completion/src/completions/magic.rs
index ef0fc27ba..2ac6f94a9 100644
--- a/crates/completion/src/completions/magic.rs
+++ b/crates/completion/src/completions/magic.rs
@@ -13,11 +13,13 @@ use crate::{
13 13
14use super::Completions; 14use super::Completions;
15 15
16// TODO kb reuse auto_import assist approach to add trait completion
16// TODO kb add a setting toggle for this feature? 17// TODO kb add a setting toggle for this feature?
17pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 18pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
18 if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) { 19 if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) {
19 return None; 20 return None;
20 } 21 }
22 let _p = profile::span("complete_magic");
21 let current_module = ctx.scope.module()?; 23 let current_module = ctx.scope.module()?;
22 let anchor = ctx.name_ref_syntax.as_ref()?; 24 let anchor = ctx.name_ref_syntax.as_ref()?;
23 let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?; 25 let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;
@@ -25,7 +27,7 @@ pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) ->
25 let potential_import_name = ctx.token.to_string(); 27 let potential_import_name = ctx.token.to_string();
26 28
27 let possible_imports = 29 let possible_imports =
28 imports_locator::find_similar_imports(&ctx.sema, ctx.krate?, &potential_import_name) 30 imports_locator::find_similar_imports(&ctx.sema, ctx.krate?, &potential_import_name, 400)
29 .filter_map(|import_candidate| { 31 .filter_map(|import_candidate| {
30 Some(match import_candidate { 32 Some(match import_candidate {
31 Either::Left(module_def) => ( 33 Either::Left(module_def) => (