diff options
Diffstat (limited to 'crates/ra_analysis/src/hover.rs')
-rw-r--r-- | crates/ra_analysis/src/hover.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/hover.rs b/crates/ra_analysis/src/hover.rs index ba1fb9beb..067e5c12d 100644 --- a/crates/ra_analysis/src/hover.rs +++ b/crates/ra_analysis/src/hover.rs | |||
@@ -64,7 +64,14 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Cancelable<Option | |||
64 | parent_fn | 64 | parent_fn |
65 | )?); | 65 | )?); |
66 | let infer = function.infer(db)?; | 66 | let infer = function.infer(db)?; |
67 | Ok(infer.type_of_node(node).map(|t| t.to_string())) | 67 | let syntax_mapping = function.body_syntax_mapping(db)?; |
68 | if let Some(expr) = syntax_mapping.node_expr(node) { | ||
69 | Ok(Some(infer[expr].to_string())) | ||
70 | } else if let Some(pat) = syntax_mapping.node_pat(node) { | ||
71 | Ok(Some(infer[pat].to_string())) | ||
72 | } else { | ||
73 | Ok(None) | ||
74 | } | ||
68 | } | 75 | } |
69 | 76 | ||
70 | // FIXME: this should not really use navigation target. Rather, approximatelly | 77 | // FIXME: this should not really use navigation target. Rather, approximatelly |