aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/display/navigation_target.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-07 19:26:33 +0000
committerGitHub <[email protected]>2019-12-07 19:26:33 +0000
commit971df306ada43f6150e12a143873f680e104a866 (patch)
tree913c24e889f3db8044b4b9f11bc3969e7eb02e34 /crates/ra_ide/src/display/navigation_target.rs
parenta3eb8787452a04400784ba8fed38303232595695 (diff)
parent88c5b1282a5770097c6c768b24bedfc3a6944e08 (diff)
Merge #2494
2494: Get the right analyzer for impls r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/display/navigation_target.rs')
-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..6a6b49afd 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::TypeParam {
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());