aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/display
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r--crates/ide/src/display/navigation_target.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index 234f80a3a..ce0f4214c 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -9,7 +9,7 @@ use ide_db::{defs::Definition, RootDatabase};
9use syntax::{ 9use syntax::{
10 ast::{self, NameOwner}, 10 ast::{self, NameOwner},
11 match_ast, AstNode, SmolStr, 11 match_ast, AstNode, SmolStr,
12 SyntaxKind::{self, IDENT_PAT, TYPE_PARAM}, 12 SyntaxKind::{self, IDENT_PAT, LIFETIME_PARAM, TYPE_PARAM},
13 TextRange, 13 TextRange,
14}; 14};
15 15
@@ -182,6 +182,7 @@ impl TryToNav for Definition {
182 Definition::SelfType(it) => Some(it.to_nav(db)), 182 Definition::SelfType(it) => Some(it.to_nav(db)),
183 Definition::Local(it) => Some(it.to_nav(db)), 183 Definition::Local(it) => Some(it.to_nav(db)),
184 Definition::TypeParam(it) => Some(it.to_nav(db)), 184 Definition::TypeParam(it) => Some(it.to_nav(db)),
185 Definition::LifetimeParam(it) => Some(it.to_nav(db)),
185 } 186 }
186 } 187 }
187} 188}
@@ -376,6 +377,23 @@ impl ToNav for hir::TypeParam {
376 } 377 }
377} 378}
378 379
380impl ToNav for hir::LifetimeParam {
381 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
382 let src = self.source(db);
383 let full_range = src.value.syntax().text_range();
384 NavigationTarget {
385 file_id: src.file_id.original_file(db),
386 name: self.name(db).to_string().into(),
387 kind: LIFETIME_PARAM,
388 full_range,
389 focus_range: Some(full_range),
390 container_name: None,
391 description: None,
392 docs: None,
393 }
394 }
395}
396
379pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<Documentation> { 397pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<Documentation> {
380 let parse = db.parse(symbol.file_id); 398 let parse = db.parse(symbol.file_id);
381 let node = symbol.ptr.to_node(parse.tree().syntax()); 399 let node = symbol.ptr.to_node(parse.tree().syntax());