diff options
Diffstat (limited to 'crates/ra_ide_api/src/hover.rs')
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index f993a461c..60b81567c 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs | |||
@@ -33,13 +33,9 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn | |||
33 | } | 33 | } |
34 | if range.is_none() { | 34 | if range.is_none() { |
35 | let node = find_leaf_at_offset(file.syntax(), position.offset).find_map(|leaf| { | 35 | let node = find_leaf_at_offset(file.syntax(), position.offset).find_map(|leaf| { |
36 | leaf.ancestors() | 36 | leaf.ancestors().find(|n| ast::Expr::cast(*n).is_some() || ast::Pat::cast(*n).is_some()) |
37 | .find(|n| ast::Expr::cast(*n).is_some() || ast::Pat::cast(*n).is_some()) | ||
38 | })?; | 37 | })?; |
39 | let frange = FileRange { | 38 | let frange = FileRange { file_id: position.file_id, range: node.range() }; |
40 | file_id: position.file_id, | ||
41 | range: node.range(), | ||
42 | }; | ||
43 | res.extend(type_of(db, frange).map(Into::into)); | 39 | res.extend(type_of(db, frange).map(Into::into)); |
44 | range = Some(node.range()); | 40 | range = Some(node.range()); |
45 | }; | 41 | }; |
@@ -126,10 +122,8 @@ impl NavigationTarget { | |||
126 | where | 122 | where |
127 | T: ast::NameOwner + ast::VisibilityOwner, | 123 | T: ast::NameOwner + ast::VisibilityOwner, |
128 | { | 124 | { |
129 | let mut string = node | 125 | let mut string = |
130 | .visibility() | 126 | node.visibility().map(|v| format!("{} ", v.syntax().text())).unwrap_or_default(); |
131 | .map(|v| format!("{} ", v.syntax().text())) | ||
132 | .unwrap_or_default(); | ||
133 | string.push_str(label); | 127 | string.push_str(label); |
134 | node.name()?.syntax().text().push_to(&mut string); | 128 | node.name()?.syntax().text().push_to(&mut string); |
135 | Some(string) | 129 | Some(string) |