File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
crates/ide-completion/src Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ fn import_on_the_fly(
238
238
( PathKind :: Type { location } , ItemInNs :: Types ( ty) ) => {
239
239
if matches ! ( location, TypeLocation :: TypeBound ) {
240
240
matches ! ( ty, ModuleDef :: Trait ( _) )
241
+ } else if matches ! ( location, TypeLocation :: ImplTrait ) {
242
+ matches ! ( ty, ModuleDef :: Trait ( _) ) || matches ! ( ty, ModuleDef :: Module ( _) )
241
243
} else {
242
244
true
243
245
}
Original file line number Diff line number Diff line change @@ -1397,3 +1397,22 @@ pub use bridge2::server2::Span2;
1397
1397
"# ] ] ,
1398
1398
) ;
1399
1399
}
1400
+
1401
+ #[ test]
1402
+ fn flyimport_only_traits_in_impl_trait_block ( ) {
1403
+ check (
1404
+ r#"
1405
+ //- /main.rs crate:main deps:dep
1406
+ pub struct Bar;
1407
+
1408
+ impl Foo$0 for Bar { }
1409
+ //- /lib.rs crate:dep
1410
+ pub trait FooTrait;
1411
+
1412
+ pub struct FooStruct;
1413
+ "# ,
1414
+ expect ! [ [ r#"
1415
+ tt FooTrait (use dep::FooTrait)
1416
+ "# ] ] ,
1417
+ ) ;
1418
+ }
You can’t perform that action at this time.
0 commit comments