aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index d2ebba65f..eedb44873 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -59,6 +59,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
59 hir::ModuleDef::TypeAlias(a) => { 59 hir::ModuleDef::TypeAlias(a) => {
60 let ty = a.ty(ctx.db); 60 let ty = a.ty(ctx.db);
61 if let Some(Adt::Enum(e)) = ty.as_adt() { 61 if let Some(Adt::Enum(e)) = ty.as_adt() {
62 cov_mark::hit!(completes_variant_through_alias);
62 add_enum_variants(ctx, acc, e); 63 add_enum_variants(ctx, acc, e);
63 } 64 }
64 ty 65 ty
@@ -68,6 +69,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
68 Some(it) => it, 69 Some(it) => it,
69 None => return, 70 None => return,
70 }; 71 };
72 cov_mark::hit!(completes_primitive_assoc_const);
71 builtin.ty(ctx.db, module) 73 builtin.ty(ctx.db, module)
72 } 74 }
73 _ => unreachable!(), 75 _ => unreachable!(),
@@ -96,9 +98,8 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
96 if context_module.map_or(false, |m| !item.is_visible_from(ctx.db, m)) { 98 if context_module.map_or(false, |m| !item.is_visible_from(ctx.db, m)) {
97 return None; 99 return None;
98 } 100 }
99 match item { 101 if let hir::AssocItem::TypeAlias(ty) = item {
100 hir::AssocItem::Function(_) | hir::AssocItem::Const(_) => {} 102 acc.add_type_alias(ctx, ty)
101 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
102 } 103 }
103 None::<()> 104 None::<()>
104 }); 105 });
@@ -745,7 +746,7 @@ fn f() {}
745 } 746 }
746 747
747 #[test] 748 #[test]
748 fn completes_self_enum() { 749 fn completes_variant_through_self() {
749 check( 750 check(
750 r#" 751 r#"
751enum Foo { 752enum Foo {
@@ -769,6 +770,7 @@ impl Foo {
769 770
770 #[test] 771 #[test]
771 fn completes_primitive_assoc_const() { 772 fn completes_primitive_assoc_const() {
773 cov_mark::check!(completes_primitive_assoc_const);
772 check( 774 check(
773 r#" 775 r#"
774//- /lib.rs crate:lib deps:core 776//- /lib.rs crate:lib deps:core
@@ -792,7 +794,8 @@ impl u8 {
792 } 794 }
793 795
794 #[test] 796 #[test]
795 fn completes_through_alias() { 797 fn completes_variant_through_alias() {
798 cov_mark::check!(completes_variant_through_alias);
796 check( 799 check(
797 r#" 800 r#"
798enum Foo { 801enum Foo {