Change docs and description to getter method
This commit is contained in:
parent
aacc894134
commit
e9848b2e6c
2 changed files with 11 additions and 4 deletions
|
@ -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<String> {
|
||||
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,
|
||||
|
|
|
@ -23,9 +23,8 @@ pub struct NavigationTarget {
|
|||
full_range: TextRange,
|
||||
focus_range: Option<TextRange>,
|
||||
container_name: Option<SmolStr>,
|
||||
|
||||
pub(crate) description: Option<String>,
|
||||
pub(crate) docs: Option<String>,
|
||||
description: Option<String>,
|
||||
docs: Option<String>,
|
||||
}
|
||||
|
||||
impl NavigationTarget {
|
||||
|
@ -55,6 +54,14 @@ impl NavigationTarget {
|
|||
self.full_range
|
||||
}
|
||||
|
||||
pub fn docs(&self) -> Option<String> {
|
||||
self.docs.clone()
|
||||
}
|
||||
|
||||
pub fn description(&self) -> Option<String> {
|
||||
self.description.clone()
|
||||
}
|
||||
|
||||
/// A "most interesting" range withing the `full_range`.
|
||||
///
|
||||
/// Typically, `full_range` is the whole syntax node,
|
||||
|
|
Loading…
Add table
Reference in a new issue