Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/use_tree.rs')
| -rw-r--r-- | crates/ide-completion/src/tests/use_tree.rs | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/crates/ide-completion/src/tests/use_tree.rs b/crates/ide-completion/src/tests/use_tree.rs index 109007c7a0..037d7dce52 100644 --- a/crates/ide-completion/src/tests/use_tree.rs +++ b/crates/ide-completion/src/tests/use_tree.rs @@ -31,7 +31,6 @@ mod foo {} md other_crate kw crate:: kw self:: - kw super:: "#]], ); } @@ -214,7 +213,6 @@ struct Bar; md bar md foo st Bar - kw super:: "#]], ); } @@ -284,9 +282,73 @@ pub use $0; md bar kw crate:: kw self:: + "#]], + ); +} + +#[test] +fn pub_suggest_use_tree_super_acc_to_depth_in_tree() { + // https://github.com/rust-lang/rust-analyzer/issues/12439 + // Check discussion in https://github.com/rust-lang/rust-analyzer/pull/12447 + + check( + r#" +mod foo { + mod bar { + pub use super::$0; + } +} +"#, + expect![[r#" + md bar + kw super:: + "#]], + ); + + // Not suggest super when at crate root + check( + r#" +mod foo { + mod bar { + pub use super::super::$0; + } +} +"#, + expect![[r#" + md foo + "#]], + ); + + check( + r#" +mod foo { + use $0; +} +"#, + expect![[r#" + kw crate:: + kw self:: kw super:: "#]], ); + + // Not suggest super after another kw in path ( here it is foo1 ) + check( + r#" +mod foo { + mod bar { + use super::super::foo1::$0; + } +} + +mod foo1 { + pub mod bar1 {} +} +"#, + expect![[r#" + md bar1 + "#]], + ); } #[test] @@ -301,7 +363,6 @@ use {$0}; md bar kw crate:: kw self:: - kw super:: "#]], ); } |