aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions/qualified_path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/completions/qualified_path.rs')
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index c072de7b5..d58745fb4 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -7,7 +7,7 @@ use syntax::AstNode;
7use crate::{CompletionContext, Completions}; 7use crate::{CompletionContext, Completions};
8 8
9pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionContext) { 9pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionContext) {
10 if ctx.is_path_disallowed() || ctx.expects_item() { 10 if ctx.is_path_disallowed() {
11 return; 11 return;
12 } 12 }
13 let path = match ctx.path_qual() { 13 let path = match ctx.path_qual() {
@@ -20,7 +20,8 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
20 None => return, 20 None => return,
21 }; 21 };
22 let context_module = ctx.scope.module(); 22 let context_module = ctx.scope.module();
23 if ctx.expects_assoc_item() { 23
24 if ctx.expects_item() || ctx.expects_assoc_item() {
24 if let hir::PathResolution::Def(hir::ModuleDef::Module(module)) = resolution { 25 if let hir::PathResolution::Def(hir::ModuleDef::Module(module)) = resolution {
25 let module_scope = module.scope(ctx.db, context_module); 26 let module_scope = module.scope(ctx.db, context_module);
26 for (name, def) in module_scope { 27 for (name, def) in module_scope {
@@ -631,17 +632,17 @@ impl MyStruct {
631"#, 632"#,
632 expect![[r##" 633 expect![[r##"
633 md bar 634 md bar
634 ma foo! #[macro_export] macro_rules! foo 635 ma foo!(…) #[macro_export] macro_rules! foo
635 "##]], 636 "##]],
636 ); 637 );
637 } 638 }
638 639
639 #[test] 640 #[test]
640 #[ignore] // FIXME doesn't complete anything atm
641 fn completes_in_item_list() { 641 fn completes_in_item_list() {
642 check( 642 check(
643 r#" 643 r#"
644struct MyStruct {} 644struct MyStruct {}
645#[macro_export]
645macro_rules! foo {} 646macro_rules! foo {}
646mod bar {} 647mod bar {}
647 648
@@ -649,7 +650,7 @@ crate::$0
649"#, 650"#,
650 expect![[r#" 651 expect![[r#"
651 md bar 652 md bar
652 ma foo! macro_rules! foo 653 ma foo!(…) #[macro_export] macro_rules! foo
653 "#]], 654 "#]],
654 ) 655 )
655 } 656 }