aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-06-09 17:03:38 +0100
committerEdwin Cheng <[email protected]>2019-06-09 17:04:03 +0100
commite9848b2e6ce96a52252c8797c6f467e8e6e951a4 (patch)
tree475ea182c3c05d8516ecb3fbed503816e004788f /crates/ra_ide_api/src
parentaacc8941342d9b04fe65164018c07c994ff981b7 (diff)
Change docs and description to getter method
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/display.rs2
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs13
2 files changed, 11 insertions, 4 deletions
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
76// FIXME: this should not really use navigation target. Rather, approximately 76// FIXME: this should not really use navigation target. Rather, approximately
77// resolved symbol should return a `DefId`. 77// resolved symbol should return a `DefId`.
78pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option<String> { 78pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option<String> {
79 match (nav.description, nav.docs) { 79 match (nav.description(), nav.docs()) {
80 (Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)), 80 (Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)),
81 (None, Some(docs)) => Some(docs), 81 (None, Some(docs)) => Some(docs),
82 _ => None, 82 _ => 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 {
23 full_range: TextRange, 23 full_range: TextRange,
24 focus_range: Option<TextRange>, 24 focus_range: Option<TextRange>,
25 container_name: Option<SmolStr>, 25 container_name: Option<SmolStr>,
26 26 description: Option<String>,
27 pub(crate) description: Option<String>, 27 docs: Option<String>,
28 pub(crate) docs: Option<String>,
29} 28}
30 29
31impl NavigationTarget { 30impl NavigationTarget {
@@ -55,6 +54,14 @@ impl NavigationTarget {
55 self.full_range 54 self.full_range
56 } 55 }
57 56
57 pub fn docs(&self) -> Option<String> {
58 self.docs.clone()
59 }
60
61 pub fn description(&self) -> Option<String> {
62 self.description.clone()
63 }
64
58 /// A "most interesting" range withing the `full_range`. 65 /// A "most interesting" range withing the `full_range`.
59 /// 66 ///
60 /// Typically, `full_range` is the whole syntax node, 67 /// Typically, `full_range` is the whole syntax node,