aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/hover.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/hover.rs')
-rw-r--r--crates/ra_ide_api/src/hover.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index df877c324..1edeb7579 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -1,16 +1,22 @@
1use hir::{HasSource, HirDisplay};
1use ra_db::SourceDatabase; 2use ra_db::SourceDatabase;
2use ra_syntax::{ 3use ra_syntax::{
3 AstNode, TreeArc, 4 algo::{
5 ancestors_at_offset, find_covering_element, find_node_at_offset,
6 visit::{visitor, Visitor},
7 },
4 ast::{self, DocCommentsOwner}, 8 ast::{self, DocCommentsOwner},
5 algo::{find_covering_element, find_node_at_offset, ancestors_at_offset, visit::{visitor, Visitor}}, 9 AstNode, TreeArc,
6}; 10};
7use hir::{HirDisplay, HasSource};
8 11
9use crate::{ 12use crate::{
10 db::RootDatabase, 13 db::RootDatabase,
11 RangeInfo, FilePosition, FileRange, 14 display::{
12 display::{rust_code_markup, rust_code_markup_with_doc, ShortLabel, docs_from_symbol, description_from_symbol}, 15 description_from_symbol, docs_from_symbol, rust_code_markup, rust_code_markup_with_doc,
13 name_ref_kind::{NameRefKind::*, classify_name_ref}, 16 ShortLabel,
17 },
18 name_ref_kind::{classify_name_ref, NameRefKind::*},
19 FilePosition, FileRange, RangeInfo,
14}; 20};
15 21
16/// Contains the results when hovering over an item 22/// Contains the results when hovering over an item
@@ -256,8 +262,10 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
256 262
257#[cfg(test)] 263#[cfg(test)]
258mod tests { 264mod tests {
265 use crate::mock_analysis::{
266 analysis_and_position, single_file_with_position, single_file_with_range,
267 };
259 use ra_syntax::TextRange; 268 use ra_syntax::TextRange;
260 use crate::mock_analysis::{single_file_with_position, single_file_with_range, analysis_and_position};
261 269
262 fn trim_markup(s: &str) -> &str { 270 fn trim_markup(s: &str) -> &str {
263 s.trim_start_matches("```rust\n").trim_end_matches("\n```") 271 s.trim_start_matches("```rust\n").trim_end_matches("\n```")