diff options
Diffstat (limited to 'crates/ide_completion')
-rw-r--r-- | crates/ide_completion/src/completions/flyimport.rs | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs index f34764b61..16384551c 100644 --- a/crates/ide_completion/src/completions/flyimport.rs +++ b/crates/ide_completion/src/completions/flyimport.rs | |||
@@ -168,15 +168,15 @@ fn import_assets(ctx: &CompletionContext, fuzzy_name: String) -> Option<ImportAs | |||
168 | ctx.path_qual.clone(), | 168 | ctx.path_qual.clone(), |
169 | fuzzy_name, | 169 | fuzzy_name, |
170 | &ctx.sema, | 170 | &ctx.sema, |
171 | ); | 171 | )?; |
172 | 172 | ||
173 | if matches!(assets_for_path.as_ref()?.import_candidate(), ImportCandidate::Path(_)) | 173 | if matches!(assets_for_path.import_candidate(), ImportCandidate::Path(_)) |
174 | && fuzzy_name_length < 2 | 174 | && fuzzy_name_length < 2 |
175 | { | 175 | { |
176 | cov_mark::hit!(ignore_short_input_for_path); | 176 | cov_mark::hit!(ignore_short_input_for_path); |
177 | None | 177 | None |
178 | } else { | 178 | } else { |
179 | assets_for_path | 179 | Some(assets_for_path) |
180 | } | 180 | } |
181 | } | 181 | } |
182 | } | 182 | } |
@@ -773,4 +773,35 @@ fn main() { | |||
773 | }"#, | 773 | }"#, |
774 | ); | 774 | ); |
775 | } | 775 | } |
776 | |||
777 | #[test] | ||
778 | fn unresolved_qualifiers() { | ||
779 | check_edit( | ||
780 | "Item", | ||
781 | r#" | ||
782 | mod foo { | ||
783 | pub mod bar { | ||
784 | pub struct Item; | ||
785 | } | ||
786 | } | ||
787 | |||
788 | fn main() { | ||
789 | bar::Ite$0 | ||
790 | } | ||
791 | "#, | ||
792 | r#" | ||
793 | use foo::bar; | ||
794 | |||
795 | mod foo { | ||
796 | pub mod bar { | ||
797 | pub struct Item; | ||
798 | } | ||
799 | } | ||
800 | |||
801 | fn main() { | ||
802 | bar::Item | ||
803 | } | ||
804 | "#, | ||
805 | ); | ||
806 | } | ||
776 | } | 807 | } |