diff options
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r-- | crates/ide/src/hover.rs | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 6466422c5..832192881 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use base_db::SourceDatabase; | ||
2 | use hir::{ | 1 | use hir::{ |
3 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, | 2 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, |
4 | Module, ModuleDef, ModuleSource, Semantics, | 3 | Module, ModuleDef, ModuleSource, Semantics, |
5 | }; | 4 | }; |
5 | use ide_db::base_db::SourceDatabase; | ||
6 | use ide_db::{ | 6 | use ide_db::{ |
7 | defs::{Definition, NameClass, NameRefClass}, | 7 | defs::{Definition, NameClass, NameRefClass}, |
8 | RootDatabase, | 8 | RootDatabase, |
@@ -385,8 +385,8 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> { | |||
385 | 385 | ||
386 | #[cfg(test)] | 386 | #[cfg(test)] |
387 | mod tests { | 387 | mod tests { |
388 | use base_db::FileLoader; | ||
389 | use expect_test::{expect, Expect}; | 388 | use expect_test::{expect, Expect}; |
389 | use ide_db::base_db::FileLoader; | ||
390 | 390 | ||
391 | use crate::fixture; | 391 | use crate::fixture; |
392 | 392 | ||
@@ -638,6 +638,33 @@ fn main() { } | |||
638 | } | 638 | } |
639 | 639 | ||
640 | #[test] | 640 | #[test] |
641 | fn hover_shows_fn_doc_attr_raw_string() { | ||
642 | check( | ||
643 | r##" | ||
644 | #[doc = r#"Raw string doc attr"#] | ||
645 | pub fn foo<|>(_: &Path) {} | ||
646 | |||
647 | fn main() { } | ||
648 | "##, | ||
649 | expect![[r##" | ||
650 | *foo* | ||
651 | |||
652 | ```rust | ||
653 | test | ||
654 | ``` | ||
655 | |||
656 | ```rust | ||
657 | pub fn foo(_: &Path) | ||
658 | ``` | ||
659 | |||
660 | --- | ||
661 | |||
662 | Raw string doc attr | ||
663 | "##]], | ||
664 | ); | ||
665 | } | ||
666 | |||
667 | #[test] | ||
641 | fn hover_shows_struct_field_info() { | 668 | fn hover_shows_struct_field_info() { |
642 | // Hovering over the field when instantiating | 669 | // Hovering over the field when instantiating |
643 | check( | 670 | check( |
@@ -2128,7 +2155,7 @@ fn foo_<|>test() {} | |||
2128 | ignore: false, | 2155 | ignore: false, |
2129 | }, | 2156 | }, |
2130 | }, | 2157 | }, |
2131 | cfg_exprs: [], | 2158 | cfg: None, |
2132 | }, | 2159 | }, |
2133 | ), | 2160 | ), |
2134 | ] | 2161 | ] |
@@ -2166,7 +2193,7 @@ mod tests<|> { | |||
2166 | kind: TestMod { | 2193 | kind: TestMod { |
2167 | path: "tests", | 2194 | path: "tests", |
2168 | }, | 2195 | }, |
2169 | cfg_exprs: [], | 2196 | cfg: None, |
2170 | }, | 2197 | }, |
2171 | ), | 2198 | ), |
2172 | ] | 2199 | ] |