diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-01 13:45:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-01 13:45:10 +0000 |
commit | 0e5fe4715360ab2f0d2954c9a8b37b247335bbcc (patch) | |
tree | 8a5f87218610fa80b1994dce8e0066ec713f6f0d /crates/ide/src/display | |
parent | 51d29fe55456e6e7af69d23982aa57c7fcf91e81 (diff) | |
parent | 18bf2e5af5875f036b321bcf9e07e9904c02510e (diff) |
Merge #7080
7080: Implement ConstParams for HIR r=Veykril a=Veykril
r? @flodiebold
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 6431e7d6d..bcde2b6f1 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -24,6 +24,7 @@ pub enum SymbolKind { | |||
24 | Impl, | 24 | Impl, |
25 | Field, | 25 | Field, |
26 | TypeParam, | 26 | TypeParam, |
27 | ConstParam, | ||
27 | LifetimeParam, | 28 | LifetimeParam, |
28 | ValueParam, | 29 | ValueParam, |
29 | SelfParam, | 30 | SelfParam, |
@@ -225,6 +226,7 @@ impl TryToNav for Definition { | |||
225 | Definition::TypeParam(it) => Some(it.to_nav(db)), | 226 | Definition::TypeParam(it) => Some(it.to_nav(db)), |
226 | Definition::LifetimeParam(it) => Some(it.to_nav(db)), | 227 | Definition::LifetimeParam(it) => Some(it.to_nav(db)), |
227 | Definition::Label(it) => Some(it.to_nav(db)), | 228 | Definition::Label(it) => Some(it.to_nav(db)), |
229 | Definition::ConstParam(it) => Some(it.to_nav(db)), | ||
228 | } | 230 | } |
229 | } | 231 | } |
230 | } | 232 | } |
@@ -485,6 +487,23 @@ impl ToNav for hir::LifetimeParam { | |||
485 | } | 487 | } |
486 | } | 488 | } |
487 | 489 | ||
490 | impl ToNav for hir::ConstParam { | ||
491 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | ||
492 | let src = self.source(db); | ||
493 | let full_range = src.value.syntax().text_range(); | ||
494 | NavigationTarget { | ||
495 | file_id: src.file_id.original_file(db), | ||
496 | name: self.name(db).to_string().into(), | ||
497 | kind: Some(SymbolKind::ConstParam), | ||
498 | full_range, | ||
499 | focus_range: src.value.name().map(|n| n.syntax().text_range()), | ||
500 | container_name: None, | ||
501 | description: None, | ||
502 | docs: None, | ||
503 | } | ||
504 | } | ||
505 | } | ||
506 | |||
488 | /// Get a description of a symbol. | 507 | /// Get a description of a symbol. |
489 | /// | 508 | /// |
490 | /// e.g. `struct Name`, `enum Name`, `fn Name` | 509 | /// e.g. `struct Name`, `enum Name`, `fn Name` |