diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 1b6ff6d210..cf04c3de08 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -3357,4 +3357,66 @@ impl Foo { "#]], ); } + + #[test] + fn hover_doc_outer_inner() { + check( + r#" +/// Be quick; +mod Foo<|> { + //! time is mana + + /// This comment belongs to the function + fn foo() {} +} +"#, + expect![[r#" + *Foo* + + ```rust + test + ``` + + ```rust + mod Foo + ``` + + --- + + Be quick; + time is mana + "#]], + ); + } + + #[test] + fn hover_doc_outer_inner_attribue() { + check( + r#" +#[doc = "Be quick;"] +mod Foo<|> { + #![doc = "time is mana"] + + #[doc = "This comment belongs to the function"] + fn foo() {} +} +"#, + expect![[r#" + *Foo* + + ```rust + test + ``` + + ```rust + mod Foo + ``` + + --- + + Be quick; + time is mana + "#]], + ); + } }