aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion/complete_path.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-03-03 19:46:59 +0000
committerFlorian Diebold <[email protected]>2020-03-03 19:49:50 +0000
commite55fc286fc60a32ff0b6d9e0dd56719e685af180 (patch)
tree8b1ebffb9a0cf053f6228ba9a878b32bbbba24b4 /crates/ra_ide/src/completion/complete_path.rs
parent5abc45982b5558d4c5f8753cb531a4a0858faa0f (diff)
Fix completion snippet for reexported functions
Fixes #3356.
Diffstat (limited to 'crates/ra_ide/src/completion/complete_path.rs')
-rw-r--r--crates/ra_ide/src/completion/complete_path.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/complete_path.rs b/crates/ra_ide/src/completion/complete_path.rs
index c626e90cc..1a9699466 100644
--- a/crates/ra_ide/src/completion/complete_path.rs
+++ b/crates/ra_ide/src/completion/complete_path.rs
@@ -784,4 +784,55 @@ mod tests {
784 "### 784 "###
785 ); 785 );
786 } 786 }
787
788 #[test]
789 fn completes_reexported_items_under_correct_name() {
790 assert_debug_snapshot!(
791 do_reference_completion(
792 r"
793 fn foo() {
794 self::m::<|>
795 }
796
797 mod m {
798 pub use super::p::wrong_fn as right_fn;
799 pub use super::p::WRONG_CONST as RIGHT_CONST;
800 pub use super::p::WrongType as RightType;
801 }
802 mod p {
803 fn wrong_fn() {}
804 const WRONG_CONST: u32 = 1;
805 struct WrongType {};
806 }
807 "
808 ),
809 @r###"
810 [
811 CompletionItem {
812 label: "RIGHT_CONST",
813 source_range: [57; 57),
814 delete: [57; 57),
815 insert: "RIGHT_CONST",
816 kind: Const,
817 },
818 CompletionItem {
819 label: "RightType",
820 source_range: [57; 57),
821 delete: [57; 57),
822 insert: "RightType",
823 kind: Struct,
824 },
825 CompletionItem {
826 label: "right_fn()",
827 source_range: [57; 57),
828 delete: [57; 57),
829 insert: "right_fn()$0",
830 kind: Function,
831 lookup: "right_fn",
832 detail: "fn wrong_fn()",
833 },
834 ]
835 "###
836 );
837 }
787} 838}