From 0a9ea782ebbf4c63db629c9704895e990d8ce1c7 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 14 Mar 2020 20:48:36 +0100 Subject: Fix completion of trait items Trait items should be public by default. --- crates/ra_ide/src/completion/complete_dot.rs | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 81e5037aa..f07611d88 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs @@ -401,6 +401,38 @@ mod tests { ); } + #[test] + fn completes_trait_method_from_other_module() { + assert_debug_snapshot!( + do_ref_completion( + r" + struct A {} + mod m { + pub trait Trait { fn the_method(&self); } + } + use m::Trait; + impl Trait for A {} + fn foo(a: A) { + a.<|> + } + ", + ), + @r###" + [ + CompletionItem { + label: "the_method()", + source_range: [219; 219), + delete: [219; 219), + insert: "the_method()$0", + kind: Method, + lookup: "the_method", + detail: "fn the_method(&self)", + }, + ] + "### + ); + } + #[test] fn test_no_non_self_method() { assert_debug_snapshot!( -- cgit v1.2.3