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, 4 insertions, 18 deletions
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 6f96eceb9..8ea5a2d5b 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -6,7 +6,7 @@ use syntax::{ast, AstNode};
6use crate::{patterns::ImmediateLocation, CompletionContext, Completions}; 6use crate::{patterns::ImmediateLocation, CompletionContext, Completions};
7 7
8pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { 8pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) {
9 if ctx.is_path_disallowed() || !ctx.is_trivial_path() { 9 if ctx.is_path_disallowed() || !ctx.is_trivial_path() || ctx.has_impl_or_trait_prev_sibling() {
10 return; 10 return;
11 } 11 }
12 12
@@ -68,6 +68,9 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
68 return; 68 return;
69 } 69 }
70 let add_resolution = match res { 70 let add_resolution = match res {
71 ScopeDef::ImplSelfType(_) => {
72 !ctx.previous_token_is(syntax::T![impl]) && !ctx.previous_token_is(syntax::T![for])
73 }
71 // Don't suggest attribute macros and derives. 74 // Don't suggest attribute macros and derives.
72 ScopeDef::MacroDef(mac) => mac.is_fn_like(), 75 ScopeDef::MacroDef(mac) => mac.is_fn_like(),
73 // no values in type places 76 // no values in type places
@@ -713,23 +716,6 @@ fn f() {}
713 } 716 }
714 717
715 #[test] 718 #[test]
716 fn completes_target_type_or_trait_in_impl_block() {
717 check(
718 r#"
719trait MyTrait {}
720struct MyStruct {}
721
722impl My$0
723"#,
724 expect![[r#"
725 sp Self
726 tt MyTrait
727 st MyStruct
728 "#]],
729 )
730 }
731
732 #[test]
733 fn completes_types_and_const_in_arg_list() { 719 fn completes_types_and_const_in_arg_list() {
734 check( 720 check(
735 r#" 721 r#"