From 32f5276465266522ebc01b8417feeba99bf00f6f Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 6 Mar 2020 01:02:14 +0200 Subject: Show mod path in hover tooltip --- crates/ra_ide/src/display.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide/src/display.rs') diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index 1c26a8697..eaeaaa2b4 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs @@ -68,17 +68,23 @@ pub(crate) fn macro_label(node: &ast::MacroCall) -> String { } pub(crate) fn rust_code_markup>(val: CODE) -> String { - rust_code_markup_with_doc::<_, &str>(val, None) + rust_code_markup_with_doc::<_, &str>(val, None, None) } -pub(crate) fn rust_code_markup_with_doc(val: CODE, doc: Option) -> String +pub(crate) fn rust_code_markup_with_doc( + val: CODE, + doc: Option, + mod_path: Option, +) -> String where CODE: AsRef, DOC: AsRef, { + let mod_path = + mod_path.filter(|path| !path.is_empty()).map(|path| path + "\n").unwrap_or_default(); if let Some(doc) = doc { - format!("```rust\n{}\n```\n\n{}", val.as_ref(), doc.as_ref()) + format!("```rust\n{}{}\n```\n\n{}", mod_path, val.as_ref(), doc.as_ref()) } else { - format!("```rust\n{}\n```", val.as_ref()) + format!("```rust\n{}{}\n```", mod_path, val.as_ref()) } } -- cgit v1.2.3