mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Ignore associated items during unqialified path fuzzy completions
This commit is contained in:
parent
8721574a85
commit
ec316cb211
1 changed files with 9 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use either::Either;
|
use either::Either;
|
||||||
use hir::{Adt, ModPath, ModuleDef, ScopeDef, Type};
|
use hir::{Adt, AsAssocItem, ModPath, ModuleDef, ScopeDef, Type};
|
||||||
use ide_db::helpers::insert_use::ImportScope;
|
use ide_db::helpers::insert_use::ImportScope;
|
||||||
use ide_db::imports_locator;
|
use ide_db::imports_locator;
|
||||||
use syntax::AstNode;
|
use syntax::AstNode;
|
||||||
|
@ -143,6 +143,14 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()
|
||||||
potential_import_name,
|
potential_import_name,
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
.filter(|import_candidate| match import_candidate {
|
||||||
|
Either::Left(ModuleDef::Function(function)) => function.as_assoc_item(ctx.db).is_none(),
|
||||||
|
Either::Left(ModuleDef::Const(const_)) => const_.as_assoc_item(ctx.db).is_none(),
|
||||||
|
Either::Left(ModuleDef::TypeAlias(type_alias)) => {
|
||||||
|
type_alias.as_assoc_item(ctx.db).is_none()
|
||||||
|
}
|
||||||
|
_ => true,
|
||||||
|
})
|
||||||
.filter_map(|import_candidate| {
|
.filter_map(|import_candidate| {
|
||||||
Some(match import_candidate {
|
Some(match import_candidate {
|
||||||
Either::Left(module_def) => {
|
Either::Left(module_def) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue