diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-25 19:49:54 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-25 19:49:54 +0000 |
commit | e53eab3f25af2ebd381012f1b34f0bc52c6951eb (patch) | |
tree | fdb97e99f511d05aae145fe13ef3152883c24892 /crates/ra_hir/src | |
parent | 55906341a6f61e12df1dc0a4bda35dd9814ece8b (diff) | |
parent | 7a0bc2dd6402d681223be4198ec68ee7bb65d9ee (diff) |
Merge #650
650: Add docs to struct fields r=matklad a=kjeremy
Co-authored-by: Jeremy A. Kolb <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-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, |