diff options
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 22 |
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}; | |||
6 | use ra_syntax::{ | 6 | use 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 | ||
354 | impl 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 | |||
354 | pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> { | 374 | pub(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()); |