diff options
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r-- | crates/ra_ide/src/completion/complete_qualified_path.rs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/crates/ra_ide/src/completion/complete_qualified_path.rs b/crates/ra_ide/src/completion/complete_qualified_path.rs index 7fcd22525..db7430454 100644 --- a/crates/ra_ide/src/completion/complete_qualified_path.rs +++ b/crates/ra_ide/src/completion/complete_qualified_path.rs | |||
@@ -20,7 +20,7 @@ pub(super) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
20 | let scope = ctx.scope(); | 20 | let scope = ctx.scope(); |
21 | let context_module = scope.module(); | 21 | let context_module = scope.module(); |
22 | 22 | ||
23 | let res = match scope.resolve_hir_path(&path) { | 23 | let res = match scope.resolve_hir_path_qualifier(&path) { |
24 | Some(res) => res, | 24 | Some(res) => res, |
25 | None => return, | 25 | None => return, |
26 | }; | 26 | }; |
@@ -226,6 +226,34 @@ mod tests { | |||
226 | } | 226 | } |
227 | 227 | ||
228 | #[test] | 228 | #[test] |
229 | fn completes_mod_with_same_name_as_function() { | ||
230 | assert_debug_snapshot!( | ||
231 | do_reference_completion( | ||
232 | r" | ||
233 | use self::my::<|>; | ||
234 | |||
235 | mod my { | ||
236 | pub struct Bar; | ||
237 | } | ||
238 | |||
239 | fn my() {} | ||
240 | " | ||
241 | ), | ||
242 | @r###" | ||
243 | [ | ||
244 | CompletionItem { | ||
245 | label: "Bar", | ||
246 | source_range: 31..31, | ||
247 | delete: 31..31, | ||
248 | insert: "Bar", | ||
249 | kind: Struct, | ||
250 | }, | ||
251 | ] | ||
252 | "### | ||
253 | ); | ||
254 | } | ||
255 | |||
256 | #[test] | ||
229 | fn path_visibility() { | 257 | fn path_visibility() { |
230 | assert_debug_snapshot!( | 258 | assert_debug_snapshot!( |
231 | do_reference_completion( | 259 | do_reference_completion( |