aboutsummaryrefslogtreecommitdiff
path: root/crates/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/completion')
-rw-r--r--crates/completion/src/completions.rs2
-rw-r--r--crates/completion/src/completions/magic.rs (renamed from crates/completion/src/completions/complete_magic.rs)6
2 files changed, 2 insertions, 6 deletions
diff --git a/crates/completion/src/completions.rs b/crates/completion/src/completions.rs
index 99db5f998..4abb10156 100644
--- a/crates/completion/src/completions.rs
+++ b/crates/completion/src/completions.rs
@@ -13,7 +13,7 @@ pub(crate) mod postfix;
13pub(crate) mod macro_in_item_position; 13pub(crate) mod macro_in_item_position;
14pub(crate) mod trait_impl; 14pub(crate) mod trait_impl;
15pub(crate) mod mod_; 15pub(crate) mod mod_;
16pub(crate) mod complete_magic; 16pub(crate) mod magic;
17 17
18use hir::{ModPath, ScopeDef, Type}; 18use hir::{ModPath, ScopeDef, Type};
19 19
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)| {