diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_scope.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 445788407..eeaf26d93 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -4,7 +4,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | |||
4 | if !ctx.is_trivial_path { | 4 | if !ctx.is_trivial_path { |
5 | return; | 5 | return; |
6 | } | 6 | } |
7 | let names = ctx.resolver.all_names(); | 7 | let names = ctx.resolver.all_names(ctx.db); |
8 | 8 | ||
9 | names.into_iter().for_each(|(name, res)| { | 9 | names.into_iter().for_each(|(name, res)| { |
10 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.to_string()) | 10 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.to_string()) |
@@ -165,4 +165,23 @@ mod tests { | |||
165 | fn completes_self_in_methods() { | 165 | fn completes_self_in_methods() { |
166 | check_reference_completion("self_in_methods", r"impl S { fn foo(&self) { <|> } }") | 166 | check_reference_completion("self_in_methods", r"impl S { fn foo(&self) { <|> } }") |
167 | } | 167 | } |
168 | |||
169 | #[test] | ||
170 | fn completes_prelude() { | ||
171 | check_reference_completion( | ||
172 | "completes_prelude", | ||
173 | " | ||
174 | //- /main.rs | ||
175 | fn foo() { let x: <|> } | ||
176 | |||
177 | //- /std/lib.rs | ||
178 | #[prelude_import] | ||
179 | use prelude::*; | ||
180 | |||
181 | mod prelude { | ||
182 | struct Option; | ||
183 | } | ||
184 | ", | ||
185 | ); | ||
186 | } | ||
168 | } | 187 | } |