From ec051863780bdd4389f72cb279cf4e84f21a2c2d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 19 Apr 2021 19:53:29 +0200 Subject: Add autoimport test with inner items --- crates/ide_assists/src/handlers/auto_import.rs | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs index 5ccd7f7a2..49aa70f74 100644 --- a/crates/ide_assists/src/handlers/auto_import.rs +++ b/crates/ide_assists/src/handlers/auto_import.rs @@ -934,4 +934,37 @@ fn main() { ", ); } + + #[test] + fn inner_items() { + check_assist( + auto_import, + r#" +mod baz { + pub struct Foo {} +} + +mod bar { + fn bar() { + Foo$0; + println!("Hallo"); + } +} +"#, + r#" +mod baz { + pub struct Foo {} +} + +mod bar { + use crate::baz::Foo; + + fn bar() { + Foo; + println!("Hallo"); + } +} +"#, + ); + } } -- cgit v1.2.3