aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-11 15:34:01 +0100
committerAleksey Kladov <[email protected]>2019-06-11 16:28:51 +0100
commitf411c2988d40bbdebc5c9a63ce4bfb883a2fbca1 (patch)
tree6afe8341929ac7a4e6c69d0d99022cff6a13a859 /crates/ra_ide_api/src
parent5e6213b516ab5c9be62c499ba0ea9eb399d68389 (diff)
use Source for Trait
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs20
-rw-r--r--crates/ra_ide_api/src/hover.rs10
2 files changed, 4 insertions, 26 deletions
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index 19a64f300..2e3e3863a 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -214,24 +214,8 @@ impl NavigationTarget {
214 hir::ModuleDef::Union(it) => NavigationTarget::from_adt_def(db, it.into()), 214 hir::ModuleDef::Union(it) => NavigationTarget::from_adt_def(db, it.into()),
215 hir::ModuleDef::Const(it) => NavigationTarget::from_def_source(db, it), 215 hir::ModuleDef::Const(it) => NavigationTarget::from_def_source(db, it),
216 hir::ModuleDef::Static(it) => NavigationTarget::from_def_source(db, it), 216 hir::ModuleDef::Static(it) => NavigationTarget::from_def_source(db, it),
217 hir::ModuleDef::EnumVariant(var) => { 217 hir::ModuleDef::EnumVariant(it) => NavigationTarget::from_def_source(db, it),
218 let src = var.source(db); 218 hir::ModuleDef::Trait(it) => NavigationTarget::from_def_source(db, it),
219 NavigationTarget::from_named(
220 src.file_id.original_file(db),
221 &*src.ast,
222 src.ast.doc_comment_text(),
223 src.ast.short_label(),
224 )
225 }
226 hir::ModuleDef::Trait(e) => {
227 let (file_id, node) = e.source(db);
228 NavigationTarget::from_named(
229 file_id.original_file(db),
230 &*node,
231 node.doc_comment_text(),
232 node.short_label(),
233 )
234 }
235 hir::ModuleDef::TypeAlias(it) => NavigationTarget::from_def_source(db, it), 219 hir::ModuleDef::TypeAlias(it) => NavigationTarget::from_def_source(db, it),
236 hir::ModuleDef::BuiltinType(..) => { 220 hir::ModuleDef::BuiltinType(..) => {
237 return None; 221 return None;
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 237e1f4a1..c4004435c 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -124,16 +124,10 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
124 hir::ModuleDef::Struct(it) => res.extend(from_def_source(db, it)), 124 hir::ModuleDef::Struct(it) => res.extend(from_def_source(db, it)),
125 hir::ModuleDef::Union(it) => res.extend(from_def_source(db, it)), 125 hir::ModuleDef::Union(it) => res.extend(from_def_source(db, it)),
126 hir::ModuleDef::Enum(it) => res.extend(from_def_source(db, it)), 126 hir::ModuleDef::Enum(it) => res.extend(from_def_source(db, it)),
127 hir::ModuleDef::EnumVariant(it) => { 127 hir::ModuleDef::EnumVariant(it) => res.extend(from_def_source(db, it)),
128 let src = it.source(db);
129 res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()))
130 }
131 hir::ModuleDef::Const(it) => res.extend(from_def_source(db, it)), 128 hir::ModuleDef::Const(it) => res.extend(from_def_source(db, it)),
132 hir::ModuleDef::Static(it) => res.extend(from_def_source(db, it)), 129 hir::ModuleDef::Static(it) => res.extend(from_def_source(db, it)),
133 hir::ModuleDef::Trait(it) => { 130 hir::ModuleDef::Trait(it) => res.extend(from_def_source(db, it)),
134 let it = it.source(db).1;
135 res.extend(hover_text(it.doc_comment_text(), it.short_label()))
136 }
137 hir::ModuleDef::TypeAlias(it) => res.extend(from_def_source(db, it)), 131 hir::ModuleDef::TypeAlias(it) => res.extend(from_def_source(db, it)),
138 hir::ModuleDef::BuiltinType(_) => { 132 hir::ModuleDef::BuiltinType(_) => {
139 // FIXME: hover for builtin Type ? 133 // FIXME: hover for builtin Type ?