aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/goto_definition.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-06-09 16:59:59 +0100
committerEdwin Cheng <[email protected]>2019-06-09 16:59:59 +0100
commitaacc8941342d9b04fe65164018c07c994ff981b7 (patch)
tree437afc068961faadbe6ad30f93d82eb88f5bc1c0 /crates/ra_ide_api/src/goto_definition.rs
parent2acf1e16fc89c51725a1bd6aafe8dfe4b9d19b1f (diff)
Add display::Description
Diffstat (limited to 'crates/ra_ide_api/src/goto_definition.rs')
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index fbd881bfe..359fc2da1 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -13,6 +13,7 @@ use crate::{
13 db::RootDatabase, 13 db::RootDatabase,
14 RangeInfo, 14 RangeInfo,
15 name_ref_kind::{NameRefKind::*, classify_name_ref}, 15 name_ref_kind::{NameRefKind::*, classify_name_ref},
16 display::Description,
16}; 17};
17 18
18pub(crate) fn goto_definition( 19pub(crate) fn goto_definition(
@@ -72,7 +73,7 @@ pub(crate) fn reference_definition(
72 } 73 }
73 } 74 }
74 Some(Pat(pat)) => return Exact(NavigationTarget::from_pat(db, file_id, pat)), 75 Some(Pat(pat)) => return Exact(NavigationTarget::from_pat(db, file_id, pat)),
75 Some(SelfParam(par)) => return Exact(NavigationTarget::from_self_param(db, file_id, par)), 76 Some(SelfParam(par)) => return Exact(NavigationTarget::from_self_param(file_id, par)),
76 Some(GenericParam(_)) => { 77 Some(GenericParam(_)) => {
77 // FIXME: go to the generic param def 78 // FIXME: go to the generic param def
78 } 79 }
@@ -115,37 +116,37 @@ pub(crate) fn name_definition(
115fn named_target(file_id: FileId, node: &SyntaxNode) -> Option<NavigationTarget> { 116fn named_target(file_id: FileId, node: &SyntaxNode) -> Option<NavigationTarget> {
116 visitor() 117 visitor()
117 .visit(|node: &ast::StructDef| { 118 .visit(|node: &ast::StructDef| {
118 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 119 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
119 }) 120 })
120 .visit(|node: &ast::EnumDef| { 121 .visit(|node: &ast::EnumDef| {
121 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 122 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
122 }) 123 })
123 .visit(|node: &ast::EnumVariant| { 124 .visit(|node: &ast::EnumVariant| {
124 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 125 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
125 }) 126 })
126 .visit(|node: &ast::FnDef| { 127 .visit(|node: &ast::FnDef| {
127 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 128 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
128 }) 129 })
129 .visit(|node: &ast::TypeAliasDef| { 130 .visit(|node: &ast::TypeAliasDef| {
130 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 131 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
131 }) 132 })
132 .visit(|node: &ast::ConstDef| { 133 .visit(|node: &ast::ConstDef| {
133 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 134 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
134 }) 135 })
135 .visit(|node: &ast::StaticDef| { 136 .visit(|node: &ast::StaticDef| {
136 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 137 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
137 }) 138 })
138 .visit(|node: &ast::TraitDef| { 139 .visit(|node: &ast::TraitDef| {
139 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 140 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
140 }) 141 })
141 .visit(|node: &ast::NamedFieldDef| { 142 .visit(|node: &ast::NamedFieldDef| {
142 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 143 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
143 }) 144 })
144 .visit(|node: &ast::Module| { 145 .visit(|node: &ast::Module| {
145 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 146 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
146 }) 147 })
147 .visit(|node: &ast::MacroCall| { 148 .visit(|node: &ast::MacroCall| {
148 NavigationTarget::from_named(file_id, node, node.doc_comment_text()) 149 NavigationTarget::from_named(file_id, node, node.doc_comment_text(), None)
149 }) 150 })
150 .accept(node) 151 .accept(node)
151} 152}