diff options
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r-- | crates/ide_db/src/defs.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index de0dc2a40..378bac7b2 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
@@ -79,6 +79,29 @@ impl Definition { | |||
79 | }; | 79 | }; |
80 | Some(name) | 80 | Some(name) |
81 | } | 81 | } |
82 | |||
83 | pub fn docs(&self, db: &RootDatabase) -> Option<hir::Documentation> { | ||
84 | match self { | ||
85 | Definition::Macro(it) => it.docs(db), | ||
86 | Definition::Field(it) => it.docs(db), | ||
87 | Definition::ModuleDef(def) => match def { | ||
88 | hir::ModuleDef::Module(it) => it.docs(db), | ||
89 | hir::ModuleDef::Function(it) => it.docs(db), | ||
90 | hir::ModuleDef::Adt(def) => match def { | ||
91 | hir::Adt::Struct(it) => it.docs(db), | ||
92 | hir::Adt::Union(it) => it.docs(db), | ||
93 | hir::Adt::Enum(it) => it.docs(db), | ||
94 | }, | ||
95 | hir::ModuleDef::Variant(it) => it.docs(db), | ||
96 | hir::ModuleDef::Const(it) => it.docs(db), | ||
97 | hir::ModuleDef::Static(it) => it.docs(db), | ||
98 | hir::ModuleDef::Trait(it) => it.docs(db), | ||
99 | hir::ModuleDef::TypeAlias(it) => it.docs(db), | ||
100 | hir::ModuleDef::BuiltinType(_) => None, | ||
101 | }, | ||
102 | _ => None, | ||
103 | } | ||
104 | } | ||
82 | } | 105 | } |
83 | 106 | ||
84 | #[derive(Debug)] | 107 | #[derive(Debug)] |