diff options
author | Lukas Wirth <[email protected]> | 2021-06-17 16:37:14 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-17 16:37:14 +0100 |
commit | 95c8c65139c10e4de44367fead8dff88511e6d46 (patch) | |
tree | 4326d46ee282c133123f3a08aaee7d640f007050 /crates/ide_completion/src/completions | |
parent | c82a9141abe6b6cbf5b55710dc8a315a3839081b (diff) |
Nest all the or-patterns!
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/qualified_path.rs | 18 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/unqualified_path.rs | 8 |
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 0597879ac..da3385bdc 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 6f96eceb9..77c6d706f 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs | |||
@@ -71,9 +71,11 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC | |||
71 | // Don't suggest attribute macros and derives. | 71 | // Don't suggest attribute macros and derives. |
72 | ScopeDef::MacroDef(mac) => mac.is_fn_like(), | 72 | ScopeDef::MacroDef(mac) => mac.is_fn_like(), |
73 | // no values in type places | 73 | // no values in type places |
74 | ScopeDef::ModuleDef(hir::ModuleDef::Function(_)) | 74 | ScopeDef::ModuleDef( |
75 | | ScopeDef::ModuleDef(hir::ModuleDef::Variant(_)) | 75 | hir::ModuleDef::Function(_) |
76 | | ScopeDef::ModuleDef(hir::ModuleDef::Static(_)) | 76 | | hir::ModuleDef::Variant(_) |
77 | | hir::ModuleDef::Static(_), | ||
78 | ) | ||
77 | | ScopeDef::Local(_) => !ctx.expects_type(), | 79 | | ScopeDef::Local(_) => !ctx.expects_type(), |
78 | // unless its a constant in a generic arg list position | 80 | // unless its a constant in a generic arg list position |
79 | ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) | 81 | ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) |