aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index add11fbc3..e8c3d980f 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -6,7 +6,7 @@ use ra_db::{FileId, SourceDatabase};
6use ra_syntax::{ 6use ra_syntax::{
7 ast::{self, DocCommentsOwner, NameOwner}, 7 ast::{self, DocCommentsOwner, NameOwner},
8 match_ast, AstNode, SmolStr, 8 match_ast, AstNode, SmolStr,
9 SyntaxKind::{self, BIND_PAT}, 9 SyntaxKind::{self, BIND_PAT, TYPE_PARAM},
10 TextRange, 10 TextRange,
11}; 11};
12 12
@@ -351,6 +351,26 @@ impl ToNav for hir::Local {
351 } 351 }
352} 352}
353 353
354impl ToNav for hir::GenericParam {
355 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
356 let src = self.source(db);
357 let range = match src.value {
358 Either::Left(it) => it.syntax().text_range(),
359 Either::Right(it) => it.syntax().text_range(),
360 };
361 NavigationTarget {
362 file_id: src.file_id.original_file(db),
363 name: self.name(db).to_string().into(),
364 kind: TYPE_PARAM,
365 full_range: range,
366 focus_range: None,
367 container_name: None,
368 description: None,
369 docs: None,
370 }
371 }
372}
373
354pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> { 374pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
355 let parse = db.parse(symbol.file_id); 375 let parse = db.parse(symbol.file_id);
356 let node = symbol.ptr.to_node(parse.tree().syntax()); 376 let node = symbol.ptr.to_node(parse.tree().syntax());