aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/display/navigation_target.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/display/navigation_target.rs')
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs56
1 files changed, 28 insertions, 28 deletions
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index f441ae943..9b17d6adc 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -8,7 +8,7 @@ use ra_syntax::{
8use hir::{ModuleSource, FieldSource, ImplItem}; 8use hir::{ModuleSource, FieldSource, ImplItem};
9 9
10use crate::{FileSymbol, db::RootDatabase}; 10use crate::{FileSymbol, db::RootDatabase};
11use super::description::Description; 11use super::short_label::ShortLabel;
12 12
13/// `NavigationTarget` represents and element in the editor's UI which you can 13/// `NavigationTarget` represents and element in the editor's UI which you can
14/// click on to navigate to a particular piece of code. 14/// click on to navigate to a particular piece of code.
@@ -142,7 +142,7 @@ impl NavigationTarget {
142 None, 142 None,
143 node.syntax(), 143 node.syntax(),
144 node.doc_comment_text(), 144 node.doc_comment_text(),
145 node.description(), 145 node.short_label(),
146 ), 146 ),
147 } 147 }
148 } 148 }
@@ -157,7 +157,7 @@ impl NavigationTarget {
157 None, 157 None,
158 source.syntax(), 158 source.syntax(),
159 source.doc_comment_text(), 159 source.doc_comment_text(),
160 source.description(), 160 source.short_label(),
161 ); 161 );
162 } 162 }
163 NavigationTarget::from_module(db, module) 163 NavigationTarget::from_module(db, module)
@@ -169,7 +169,7 @@ impl NavigationTarget {
169 file_id.original_file(db), 169 file_id.original_file(db),
170 &*fn_def, 170 &*fn_def,
171 fn_def.doc_comment_text(), 171 fn_def.doc_comment_text(),
172 fn_def.description(), 172 fn_def.short_label(),
173 ) 173 )
174 } 174 }
175 175
@@ -178,7 +178,7 @@ impl NavigationTarget {
178 let file_id = file_id.original_file(db); 178 let file_id = file_id.original_file(db);
179 match field { 179 match field {
180 FieldSource::Named(it) => { 180 FieldSource::Named(it) => {
181 NavigationTarget::from_named(file_id, &*it, it.doc_comment_text(), it.description()) 181 NavigationTarget::from_named(file_id, &*it, it.doc_comment_text(), it.short_label())
182 } 182 }
183 FieldSource::Pos(it) => { 183 FieldSource::Pos(it) => {
184 NavigationTarget::from_syntax(file_id, "".into(), None, it.syntax(), None, None) 184 NavigationTarget::from_syntax(file_id, "".into(), None, it.syntax(), None, None)
@@ -194,7 +194,7 @@ impl NavigationTarget {
194 file_id.original_file(db), 194 file_id.original_file(db),
195 &*node, 195 &*node,
196 node.doc_comment_text(), 196 node.doc_comment_text(),
197 node.description(), 197 node.short_label(),
198 ) 198 )
199 } 199 }
200 hir::AdtDef::Union(s) => { 200 hir::AdtDef::Union(s) => {
@@ -203,7 +203,7 @@ impl NavigationTarget {
203 file_id.original_file(db), 203 file_id.original_file(db),
204 &*node, 204 &*node,
205 node.doc_comment_text(), 205 node.doc_comment_text(),
206 node.description(), 206 node.short_label(),
207 ) 207 )
208 } 208 }
209 hir::AdtDef::Enum(s) => { 209 hir::AdtDef::Enum(s) => {
@@ -212,7 +212,7 @@ impl NavigationTarget {
212 file_id.original_file(db), 212 file_id.original_file(db),
213 &*node, 213 &*node,
214 node.doc_comment_text(), 214 node.doc_comment_text(),
215 node.description(), 215 node.short_label(),
216 ) 216 )
217 } 217 }
218 } 218 }
@@ -231,7 +231,7 @@ impl NavigationTarget {
231 file_id.original_file(db), 231 file_id.original_file(db),
232 &*node, 232 &*node,
233 node.doc_comment_text(), 233 node.doc_comment_text(),
234 node.description(), 234 node.short_label(),
235 ) 235 )
236 } 236 }
237 hir::ModuleDef::Union(s) => { 237 hir::ModuleDef::Union(s) => {
@@ -240,7 +240,7 @@ impl NavigationTarget {
240 file_id.original_file(db), 240 file_id.original_file(db),
241 &*node, 241 &*node,
242 node.doc_comment_text(), 242 node.doc_comment_text(),
243 node.description(), 243 node.short_label(),
244 ) 244 )
245 } 245 }
246 hir::ModuleDef::Const(s) => { 246 hir::ModuleDef::Const(s) => {
@@ -249,7 +249,7 @@ impl NavigationTarget {
249 file_id.original_file(db), 249 file_id.original_file(db),
250 &*node, 250 &*node,
251 node.doc_comment_text(), 251 node.doc_comment_text(),
252 node.description(), 252 node.short_label(),
253 ) 253 )
254 } 254 }
255 hir::ModuleDef::Static(s) => { 255 hir::ModuleDef::Static(s) => {
@@ -258,7 +258,7 @@ impl NavigationTarget {
258 file_id.original_file(db), 258 file_id.original_file(db),
259 &*node, 259 &*node,
260 node.doc_comment_text(), 260 node.doc_comment_text(),
261 node.description(), 261 node.short_label(),
262 ) 262 )
263 } 263 }
264 hir::ModuleDef::Enum(e) => { 264 hir::ModuleDef::Enum(e) => {
@@ -267,7 +267,7 @@ impl NavigationTarget {
267 file_id.original_file(db), 267 file_id.original_file(db),
268 &*node, 268 &*node,
269 node.doc_comment_text(), 269 node.doc_comment_text(),
270 node.description(), 270 node.short_label(),
271 ) 271 )
272 } 272 }
273 hir::ModuleDef::EnumVariant(var) => { 273 hir::ModuleDef::EnumVariant(var) => {
@@ -276,7 +276,7 @@ impl NavigationTarget {
276 file_id.original_file(db), 276 file_id.original_file(db),
277 &*node, 277 &*node,
278 node.doc_comment_text(), 278 node.doc_comment_text(),
279 node.description(), 279 node.short_label(),
280 ) 280 )
281 } 281 }
282 hir::ModuleDef::Trait(e) => { 282 hir::ModuleDef::Trait(e) => {
@@ -285,7 +285,7 @@ impl NavigationTarget {
285 file_id.original_file(db), 285 file_id.original_file(db),
286 &*node, 286 &*node,
287 node.doc_comment_text(), 287 node.doc_comment_text(),
288 node.description(), 288 node.short_label(),
289 ) 289 )
290 } 290 }
291 hir::ModuleDef::TypeAlias(e) => { 291 hir::ModuleDef::TypeAlias(e) => {
@@ -294,7 +294,7 @@ impl NavigationTarget {
294 file_id.original_file(db), 294 file_id.original_file(db),
295 &*node, 295 &*node,
296 node.doc_comment_text(), 296 node.doc_comment_text(),
297 node.description(), 297 node.short_label(),
298 ) 298 )
299 } 299 }
300 hir::ModuleDef::BuiltinType(..) => { 300 hir::ModuleDef::BuiltinType(..) => {
@@ -328,7 +328,7 @@ impl NavigationTarget {
328 file_id.original_file(db), 328 file_id.original_file(db),
329 &*node, 329 &*node,
330 node.doc_comment_text(), 330 node.doc_comment_text(),
331 node.description(), 331 node.short_label(),
332 ) 332 )
333 } 333 }
334 ImplItem::TypeAlias(a) => { 334 ImplItem::TypeAlias(a) => {
@@ -337,7 +337,7 @@ impl NavigationTarget {
337 file_id.original_file(db), 337 file_id.original_file(db),
338 &*node, 338 &*node,
339 node.doc_comment_text(), 339 node.doc_comment_text(),
340 node.description(), 340 node.short_label(),
341 ) 341 )
342 } 342 }
343 } 343 }
@@ -446,15 +446,15 @@ fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<Str
446 // FIXME: After type inference is done, add type information to improve the output 446 // FIXME: After type inference is done, add type information to improve the output
447 447
448 visitor() 448 visitor()
449 .visit(|node: &ast::FnDef| node.description()) 449 .visit(|node: &ast::FnDef| node.short_label())
450 .visit(|node: &ast::StructDef| node.description()) 450 .visit(|node: &ast::StructDef| node.short_label())
451 .visit(|node: &ast::EnumDef| node.description()) 451 .visit(|node: &ast::EnumDef| node.short_label())
452 .visit(|node: &ast::TraitDef| node.description()) 452 .visit(|node: &ast::TraitDef| node.short_label())
453 .visit(|node: &ast::Module| node.description()) 453 .visit(|node: &ast::Module| node.short_label())
454 .visit(|node: &ast::TypeAliasDef| node.description()) 454 .visit(|node: &ast::TypeAliasDef| node.short_label())
455 .visit(|node: &ast::ConstDef| node.description()) 455 .visit(|node: &ast::ConstDef| node.short_label())
456 .visit(|node: &ast::StaticDef| node.description()) 456 .visit(|node: &ast::StaticDef| node.short_label())
457 .visit(|node: &ast::NamedFieldDef| node.description()) 457 .visit(|node: &ast::NamedFieldDef| node.short_label())
458 .visit(|node: &ast::EnumVariant| node.description()) 458 .visit(|node: &ast::EnumVariant| node.short_label())
459 .accept(&node)? 459 .accept(&node)?
460} 460}