aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs18
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs8
2 files changed, 17 insertions, 9 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index 88f4d940d..f5dbd203b 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -65,9 +65,11 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
65 // Don't suggest attribute macros and derives. 65 // Don't suggest attribute macros and derives.
66 hir::ScopeDef::MacroDef(mac) => mac.is_fn_like(), 66 hir::ScopeDef::MacroDef(mac) => mac.is_fn_like(),
67 // no values in type places 67 // no values in type places
68 hir::ScopeDef::ModuleDef(hir::ModuleDef::Function(_)) 68 hir::ScopeDef::ModuleDef(
69 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Variant(_)) 69 hir::ModuleDef::Function(_)
70 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Static(_)) 70 | hir::ModuleDef::Variant(_)
71 | hir::ModuleDef::Static(_),
72 )
71 | hir::ScopeDef::Local(_) => !ctx.expects_type(), 73 | hir::ScopeDef::Local(_) => !ctx.expects_type(),
72 // unless its a constant in a generic arg list position 74 // unless its a constant in a generic arg list position
73 hir::ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) => { 75 hir::ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) => {
@@ -81,9 +83,13 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
81 } 83 }
82 } 84 }
83 } 85 }
84 hir::PathResolution::Def(def @ hir::ModuleDef::Adt(_)) 86 hir::PathResolution::Def(
85 | hir::PathResolution::Def(def @ hir::ModuleDef::TypeAlias(_)) 87 def
86 | hir::PathResolution::Def(def @ hir::ModuleDef::BuiltinType(_)) => { 88 @
89 (hir::ModuleDef::Adt(_)
90 | hir::ModuleDef::TypeAlias(_)
91 | hir::ModuleDef::BuiltinType(_)),
92 ) => {
87 if let hir::ModuleDef::Adt(hir::Adt::Enum(e)) = def { 93 if let hir::ModuleDef::Adt(hir::Adt::Enum(e)) = def {
88 add_enum_variants(acc, ctx, e); 94 add_enum_variants(acc, ctx, e);
89 } 95 }
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 8ea5a2d5b..81c4fb305 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -74,9 +74,11 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
74 // Don't suggest attribute macros and derives. 74 // Don't suggest attribute macros and derives.
75 ScopeDef::MacroDef(mac) => mac.is_fn_like(), 75 ScopeDef::MacroDef(mac) => mac.is_fn_like(),
76 // no values in type places 76 // no values in type places
77 ScopeDef::ModuleDef(hir::ModuleDef::Function(_)) 77 ScopeDef::ModuleDef(
78 | ScopeDef::ModuleDef(hir::ModuleDef::Variant(_)) 78 hir::ModuleDef::Function(_)
79 | ScopeDef::ModuleDef(hir::ModuleDef::Static(_)) 79 | hir::ModuleDef::Variant(_)
80 | hir::ModuleDef::Static(_),
81 )
80 | ScopeDef::Local(_) => !ctx.expects_type(), 82 | ScopeDef::Local(_) => !ctx.expects_type(),
81 // unless its a constant in a generic arg list position 83 // unless its a constant in a generic arg list position
82 ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) 84 ScopeDef::ModuleDef(hir::ModuleDef::Const(_))