diff options
author | Jeremy A. Kolb <[email protected]> | 2019-01-25 19:29:56 +0000 |
---|---|---|
committer | Jeremy A. Kolb <[email protected]> | 2019-01-25 19:29:56 +0000 |
commit | 7a0bc2dd6402d681223be4198ec68ee7bb65d9ee (patch) | |
tree | fdb97e99f511d05aae145fe13ef3152883c24892 /crates/ra_hir | |
parent | 55906341a6f61e12df1dc0a4bda35dd9814ece8b (diff) |
Add docs to struct fields
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 1e88bff8b..41bac05c6 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -216,6 +216,15 @@ impl StructField { | |||
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | impl Docs for StructField { | ||
220 | fn docs(&self, db: &impl HirDatabase) -> Option<Documentation> { | ||
221 | match self.source(db).1 { | ||
222 | FieldSource::Named(named) => docs_from_ast(&*named), | ||
223 | FieldSource::Pos(..) => return None, | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | |||
219 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 228 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
220 | pub struct Struct { | 229 | pub struct Struct { |
221 | pub(crate) id: StructId, | 230 | pub(crate) id: StructId, |