diff options
Diffstat (limited to 'crates/ide_completion')
-rw-r--r-- | crates/ide_completion/src/completions/flyimport.rs | 84 |
1 files changed, 81 insertions, 3 deletions
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs index 16384551c..64b60bbdd 100644 --- a/crates/ide_completion/src/completions/flyimport.rs +++ b/crates/ide_completion/src/completions/flyimport.rs | |||
@@ -775,18 +775,92 @@ fn main() { | |||
775 | } | 775 | } |
776 | 776 | ||
777 | #[test] | 777 | #[test] |
778 | fn unresolved_qualifiers() { | 778 | fn unresolved_qualifier() { |
779 | check_edit( | ||
780 | "Item", | ||
781 | r#" | ||
782 | mod foo { | ||
783 | pub mod bar { | ||
784 | pub mod baz { | ||
785 | pub struct Item; | ||
786 | } | ||
787 | } | ||
788 | } | ||
789 | |||
790 | fn main() { | ||
791 | bar::baz::Ite$0 | ||
792 | } | ||
793 | "#, | ||
794 | r#" | ||
795 | use foo::bar; | ||
796 | |||
797 | mod foo { | ||
798 | pub mod bar { | ||
799 | pub mod baz { | ||
800 | pub struct Item; | ||
801 | } | ||
802 | } | ||
803 | } | ||
804 | |||
805 | fn main() { | ||
806 | bar::baz::Item | ||
807 | } | ||
808 | "#, | ||
809 | ); | ||
810 | } | ||
811 | |||
812 | #[test] | ||
813 | fn unresolved_assoc_item_container() { | ||
814 | check_edit( | ||
815 | "Item", | ||
816 | r#" | ||
817 | mod foo { | ||
818 | pub struct Item; | ||
819 | |||
820 | impl Item { | ||
821 | pub const TEST_ASSOC: usize = 3; | ||
822 | } | ||
823 | } | ||
824 | |||
825 | fn main() { | ||
826 | Item::TEST_A$0; | ||
827 | } | ||
828 | "#, | ||
829 | r#" | ||
830 | use foo::Item; | ||
831 | |||
832 | mod foo { | ||
833 | pub struct Item; | ||
834 | |||
835 | impl Item { | ||
836 | pub const TEST_ASSOC: usize = 3; | ||
837 | } | ||
838 | } | ||
839 | |||
840 | fn main() { | ||
841 | Item::TEST_ASSOC | ||
842 | } | ||
843 | "#, | ||
844 | ); | ||
845 | } | ||
846 | |||
847 | #[test] | ||
848 | fn unresolved_assoc_item_container_with_path() { | ||
779 | check_edit( | 849 | check_edit( |
780 | "Item", | 850 | "Item", |
781 | r#" | 851 | r#" |
782 | mod foo { | 852 | mod foo { |
783 | pub mod bar { | 853 | pub mod bar { |
784 | pub struct Item; | 854 | pub struct Item; |
855 | |||
856 | impl Item { | ||
857 | pub const TEST_ASSOC: usize = 3; | ||
858 | } | ||
785 | } | 859 | } |
786 | } | 860 | } |
787 | 861 | ||
788 | fn main() { | 862 | fn main() { |
789 | bar::Ite$0 | 863 | bar::Item::TEST_A$0; |
790 | } | 864 | } |
791 | "#, | 865 | "#, |
792 | r#" | 866 | r#" |
@@ -795,11 +869,15 @@ use foo::bar; | |||
795 | mod foo { | 869 | mod foo { |
796 | pub mod bar { | 870 | pub mod bar { |
797 | pub struct Item; | 871 | pub struct Item; |
872 | |||
873 | impl Item { | ||
874 | pub const TEST_ASSOC: usize = 3; | ||
875 | } | ||
798 | } | 876 | } |
799 | } | 877 | } |
800 | 878 | ||
801 | fn main() { | 879 | fn main() { |
802 | bar::Item | 880 | bar::Item::TEST_ASSOC |
803 | } | 881 | } |
804 | "#, | 882 | "#, |
805 | ); | 883 | ); |