diff options
author | Lukas Wirth <[email protected]> | 2021-01-01 09:07:01 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-01-01 13:43:16 +0000 |
commit | 18bf2e5af5875f036b321bcf9e07e9904c02510e (patch) | |
tree | 1a82bc1dddc9a0d77515f7e7036c4b5583d359ba /crates/ide/src/display | |
parent | 0acdb730769cfb040ffc5e2c87f83b19fd3ce291 (diff) |
Add ConstParams to the ide layer
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` |