diff options
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r-- | crates/ide/src/hover.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 0332c7be0..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( |