diff options
-rw-r--r-- | crates/ide_completion/src/completions/unqualified_path.rs | 2 | ||||
-rw-r--r-- | crates/ide_completion/src/context.rs | 4 | ||||
-rw-r--r-- | crates/ide_completion/src/tests/use_tree.rs | 17 |
3 files changed, 18 insertions, 5 deletions
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 4bafc1bf8..6f96eceb9 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs | |||
@@ -25,7 +25,7 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC | |||
25 | return; | 25 | return; |
26 | } | 26 | } |
27 | 27 | ||
28 | if ctx.expects_new_use_tree() { | 28 | if ctx.in_use_tree() { |
29 | // only show modules in a fresh UseTree | 29 | // only show modules in a fresh UseTree |
30 | cov_mark::hit!(only_completes_modules_in_import); | 30 | cov_mark::hit!(only_completes_modules_in_import); |
31 | ctx.scope.process_all_names(&mut |name, res| { | 31 | ctx.scope.process_all_names(&mut |name, res| { |
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index c3076f608..240cac1de 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs | |||
@@ -264,10 +264,6 @@ impl<'a> CompletionContext<'a> { | |||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | pub(crate) fn expects_new_use_tree(&self) -> bool { | ||
268 | matches!(self.completion_location, Some(ImmediateLocation::Use)) | ||
269 | } | ||
270 | |||
271 | pub(crate) fn expects_non_trait_assoc_item(&self) -> bool { | 267 | pub(crate) fn expects_non_trait_assoc_item(&self) -> bool { |
272 | matches!(self.completion_location, Some(ImmediateLocation::Impl)) | 268 | matches!(self.completion_location, Some(ImmediateLocation::Impl)) |
273 | } | 269 | } |
diff --git a/crates/ide_completion/src/tests/use_tree.rs b/crates/ide_completion/src/tests/use_tree.rs index 878bc42bf..7e6748ccc 100644 --- a/crates/ide_completion/src/tests/use_tree.rs +++ b/crates/ide_completion/src/tests/use_tree.rs | |||
@@ -236,3 +236,20 @@ pub use $0; | |||
236 | "#]], | 236 | "#]], |
237 | ); | 237 | ); |
238 | } | 238 | } |
239 | |||
240 | #[test] | ||
241 | fn use_tree_braces_at_start() { | ||
242 | check( | ||
243 | r#" | ||
244 | struct X; | ||
245 | mod bar {} | ||
246 | use {$0}; | ||
247 | "#, | ||
248 | expect![[r#" | ||
249 | kw crate:: | ||
250 | kw self:: | ||
251 | kw super:: | ||
252 | md bar | ||
253 | "#]], | ||
254 | ); | ||
255 | } | ||