Add docs to struct fields

This commit is contained in:
Jeremy A. Kolb 2019-01-25 14:29:56 -05:00
parent 55906341a6
commit 7a0bc2dd64
6 changed files with 26 additions and 8 deletions

View file

@ -216,6 +216,15 @@ impl StructField {
}
}
impl Docs for StructField {
fn docs(&self, db: &impl HirDatabase) -> Option<Documentation> {
match self.source(db).1 {
FieldSource::Named(named) => docs_from_ast(&*named),
FieldSource::Pos(..) => return None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Struct {
pub(crate) id: StructId,