aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions/unqualified_path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/completions/unqualified_path.rs')
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index dc93e368d..c901b358b 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -9,10 +9,10 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
9 if !ctx.is_trivial_path { 9 if !ctx.is_trivial_path {
10 return; 10 return;
11 } 11 }
12 if ctx.is_path_disallowed() { 12 if ctx.is_path_disallowed() || ctx.expects_item() {
13 return; 13 return;
14 } 14 }
15 if ctx.expects_item() || ctx.expects_assoc_item() { 15 if ctx.expects_assoc_item() {
16 ctx.scope.process_all_names(&mut |name, def| { 16 ctx.scope.process_all_names(&mut |name, def| {
17 if let ScopeDef::MacroDef(macro_def) = def { 17 if let ScopeDef::MacroDef(macro_def) = def {
18 acc.add_macro(ctx, Some(name.to_string()), macro_def); 18 acc.add_macro(ctx, Some(name.to_string()), macro_def);
@@ -692,4 +692,22 @@ impl MyStruct {
692 "#]], 692 "#]],
693 ) 693 )
694 } 694 }
695
696 // FIXME: The completions here currently come from `macro_in_item_position`, but they shouldn't
697 #[test]
698 fn completes_in_item_list() {
699 check(
700 r#"
701struct MyStruct {}
702macro_rules! foo {}
703mod bar {}
704
705$0
706"#,
707 expect![[r#"
708 md bar
709 ma foo!(…) macro_rules! foo
710 "#]],
711 )
712 }
695} 713}