diff options
author | Kirill Bulatov <[email protected]> | 2020-11-13 16:32:30 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-11-16 19:19:06 +0000 |
commit | d1556550f83b7b8e9dd42c80ab6e08a632dfd256 (patch) | |
tree | df9014780b0475523b05b93900855fa0385d3543 /crates | |
parent | 0e050fc3eba251f3debf964c7779c522e5639cd8 (diff) |
Rename the module
Diffstat (limited to 'crates')
-rw-r--r-- | crates/completion/src/completions.rs | 2 | ||||
-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; | |||
13 | pub(crate) mod macro_in_item_position; | 13 | pub(crate) mod macro_in_item_position; |
14 | pub(crate) mod trait_impl; | 14 | pub(crate) mod trait_impl; |
15 | pub(crate) mod mod_; | 15 | pub(crate) mod mod_; |
16 | pub(crate) mod complete_magic; | 16 | pub(crate) mod magic; |
17 | 17 | ||
18 | use hir::{ModPath, ScopeDef, Type}; | 18 | use 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 | ||
12 | use super::Completions; | 12 | use 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? |
15 | pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 15 | pub(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)| { |