From e9848b2e6ce96a52252c8797c6f467e8e6e951a4 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 10 Jun 2019 00:03:38 +0800 Subject: Change docs and description to getter method --- crates/ra_ide_api/src/display.rs | 2 +- crates/ra_ide_api/src/display/navigation_target.rs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/display.rs b/crates/ra_ide_api/src/display.rs index 1d0e8ba12..313415610 100644 --- a/crates/ra_ide_api/src/display.rs +++ b/crates/ra_ide_api/src/display.rs @@ -76,7 +76,7 @@ where // FIXME: this should not really use navigation target. Rather, approximately // resolved symbol should return a `DefId`. pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option { - match (nav.description, nav.docs) { + match (nav.description(), nav.docs()) { (Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)), (None, Some(docs)) => Some(docs), _ => None, diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index f60a07f1d..c0fa9439e 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs @@ -23,9 +23,8 @@ pub struct NavigationTarget { full_range: TextRange, focus_range: Option, container_name: Option, - - pub(crate) description: Option, - pub(crate) docs: Option, + description: Option, + docs: Option, } impl NavigationTarget { @@ -55,6 +54,14 @@ impl NavigationTarget { self.full_range } + pub fn docs(&self) -> Option { + self.docs.clone() + } + + pub fn description(&self) -> Option { + self.description.clone() + } + /// A "most interesting" range withing the `full_range`. /// /// Typically, `full_range` is the whole syntax node, -- cgit v1.2.3