From 6ee7788513960ddf11254aca50da012b58df4583 Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Thu, 3 Jan 2019 21:15:23 +0900 Subject: Return type name when doc_text_for returns nothing --- crates/ra_lsp_server/src/main_loop/handlers.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ra_lsp_server') 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( contents: HoverContents::Scalar(MarkedString::String(result.join("\n\n---\n"))), range: Some(range), })); + } else { + let file_id = params.text_document.try_conv_with(&world)?; + let file_range = FileRange { + file_id, + range: rr.reference_range, + }; + if let Some(type_name) = world.analysis().type_of(file_range)? { + return Ok(Some(Hover { + contents: HoverContents::Scalar(MarkedString::String(type_name)), + range: Some(range), + })); + } } Ok(None) } -- cgit v1.2.3