aboutsummaryrefslogtreecommitdiff
path: root/crates/completion
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-11-13 20:31:41 +0000
committerKirill Bulatov <[email protected]>2020-11-16 19:19:06 +0000
commit46514448b740b82e4f5f9cf742c6f8c6caec1d38 (patch)
tree3c0b226594c9a18e8d49d738d5c419a09cee25db /crates/completion
parent1598740292c29613ef2b384a82de3a2735bc5566 (diff)
Tweak the search limits a bit
Diffstat (limited to 'crates/completion')
-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) => (