aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/completions
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-11-13 16:32:30 +0000
committerKirill Bulatov <[email protected]>2020-11-16 19:19:06 +0000
commitd1556550f83b7b8e9dd42c80ab6e08a632dfd256 (patch)
treedf9014780b0475523b05b93900855fa0385d3543 /crates/completion/src/completions
parent0e050fc3eba251f3debf964c7779c522e5639cd8 (diff)
Rename the module
Diffstat (limited to 'crates/completion/src/completions')
-rw-r--r--crates/completion/src/completions/magic.rs (renamed from crates/completion/src/completions/complete_magic.rs)6
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/completion/src/completions/complete_magic.rs b/crates/completion/src/completions/magic.rs
index 58509fc5b..34fc35847 100644
--- a/crates/completion/src/completions/complete_magic.rs
+++ b/crates/completion/src/completions/magic.rs
@@ -11,7 +11,7 @@ use crate::{context::CompletionContext, item::CompletionKind, CompletionItem, Co
11 11
12use super::Completions; 12use super::Completions;
13 13
14// TODO kb when typing, completes partial results, need to rerun manually to see the proper ones 14// TODO kb add a setting toggle for this feature?
15pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 15pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
16 if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) { 16 if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) {
17 return None; 17 return None;
@@ -20,8 +20,6 @@ pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) ->
20 let anchor = ctx.name_ref_syntax.as_ref()?; 20 let anchor = ctx.name_ref_syntax.as_ref()?;
21 let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?; 21 let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;
22 22
23 // TODO kb consider heuristics, such as "don't show `hash_map` import if `HashMap` is the import for completion"
24 // also apply completion ordering
25 let potential_import_name = ctx.token.to_string(); 23 let potential_import_name = ctx.token.to_string();
26 24
27 let possible_imports = ctx 25 let possible_imports = ctx
@@ -34,8 +32,6 @@ pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) ->
34 Either::Left(module_def) => current_module.find_use_path(ctx.db, module_def), 32 Either::Left(module_def) => current_module.find_use_path(ctx.db, module_def),
35 Either::Right(macro_def) => current_module.find_use_path(ctx.db, macro_def), 33 Either::Right(macro_def) => current_module.find_use_path(ctx.db, macro_def),
36 }?; 34 }?;
37 // TODO kb need to omit braces when there are some already.
38 // maybe remove braces completely?
39 Some((use_path, additional_completion(ctx.db, import_candidate))) 35 Some((use_path, additional_completion(ctx.db, import_candidate)))
40 }) 36 })
41 .filter_map(|(mod_path, additional_completion)| { 37 .filter_map(|(mod_path, additional_completion)| {