diff options
author | Kirill Bulatov <[email protected]> | 2021-01-03 13:58:15 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2021-01-04 15:44:27 +0000 |
commit | ec316cb21117dbefacd67af2f33779fb2d66fdea (patch) | |
tree | c6554966e724f84bd051488f82d5c03823e51d7f /crates/completion | |
parent | 8721574a85399cd74319e93c84dc19c7ed7c6605 (diff) |
Ignore associated items during unqialified path fuzzy completions
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/completions/unqualified_path.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 81a6d00e2..068b6b407 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use std::iter; | 3 | use std::iter; |
4 | 4 | ||
5 | use either::Either; | 5 | use either::Either; |
6 | use hir::{Adt, ModPath, ModuleDef, ScopeDef, Type}; | 6 | use hir::{Adt, AsAssocItem, ModPath, ModuleDef, ScopeDef, Type}; |
7 | use ide_db::helpers::insert_use::ImportScope; | 7 | use ide_db::helpers::insert_use::ImportScope; |
8 | use ide_db::imports_locator; | 8 | use ide_db::imports_locator; |
9 | use syntax::AstNode; | 9 | use syntax::AstNode; |
@@ -143,6 +143,14 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<() | |||
143 | potential_import_name, | 143 | potential_import_name, |
144 | true, | 144 | true, |
145 | ) | 145 | ) |
146 | .filter(|import_candidate| match import_candidate { | ||
147 | Either::Left(ModuleDef::Function(function)) => function.as_assoc_item(ctx.db).is_none(), | ||
148 | Either::Left(ModuleDef::Const(const_)) => const_.as_assoc_item(ctx.db).is_none(), | ||
149 | Either::Left(ModuleDef::TypeAlias(type_alias)) => { | ||
150 | type_alias.as_assoc_item(ctx.db).is_none() | ||
151 | } | ||
152 | _ => true, | ||
153 | }) | ||
146 | .filter_map(|import_candidate| { | 154 | .filter_map(|import_candidate| { |
147 | Some(match import_candidate { | 155 | Some(match import_candidate { |
148 | Either::Left(module_def) => { | 156 | Either::Left(module_def) => { |