diff options
author | Hirokazu Hata <[email protected]> | 2019-01-03 12:15:23 +0000 |
---|---|---|
committer | Hirokazu Hata <[email protected]> | 2019-01-03 12:15:23 +0000 |
commit | 6ee7788513960ddf11254aca50da012b58df4583 (patch) | |
tree | 8232abf1a733883fc6a07a3aaca250970fec1edc /crates/ra_lsp_server | |
parent | d29e98dd975c6d72a62f3d3e178fef1e2ae8fc6a (diff) |
Return type name when doc_text_for returns nothing
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index b5792f3b8..705d1360f 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -525,6 +525,18 @@ pub fn handle_hover( | |||
525 | contents: HoverContents::Scalar(MarkedString::String(result.join("\n\n---\n"))), | 525 | contents: HoverContents::Scalar(MarkedString::String(result.join("\n\n---\n"))), |
526 | range: Some(range), | 526 | range: Some(range), |
527 | })); | 527 | })); |
528 | } else { | ||
529 | let file_id = params.text_document.try_conv_with(&world)?; | ||
530 | let file_range = FileRange { | ||
531 | file_id, | ||
532 | range: rr.reference_range, | ||
533 | }; | ||
534 | if let Some(type_name) = world.analysis().type_of(file_range)? { | ||
535 | return Ok(Some(Hover { | ||
536 | contents: HoverContents::Scalar(MarkedString::String(type_name)), | ||
537 | range: Some(range), | ||
538 | })); | ||
539 | } | ||
528 | } | 540 | } |
529 | Ok(None) | 541 | Ok(None) |
530 | } | 542 | } |