diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-28 15:56:07 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-28 15:56:07 +0000 |
commit | c692e07b4ff648fea742c53c0dbad57d6f652068 (patch) | |
tree | d186df8fb298272eaa4ce14d2fccc854413bc566 /crates/ra_ide/src/goto_definition.rs | |
parent | 93f632ca4e7bb7fd54830e456d629a4948a92337 (diff) | |
parent | 56ce34c6a7ec0b4426d4cb25e10512c7efaf6f06 (diff) |
Merge #3367
3367: Fix highlighting of const patterns r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 6053c1bb6..621ab982c 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -30,7 +30,9 @@ pub(crate) fn goto_definition( | |||
30 | reference_definition(&sema, &name_ref).to_vec() | 30 | reference_definition(&sema, &name_ref).to_vec() |
31 | }, | 31 | }, |
32 | ast::Name(name) => { | 32 | ast::Name(name) => { |
33 | name_definition(&sema, &name)? | 33 | let def = classify_name(&sema, &name)?.definition(); |
34 | let nav = def.try_to_nav(sema.db)?; | ||
35 | vec![nav] | ||
34 | }, | 36 | }, |
35 | _ => return None, | 37 | _ => return None, |
36 | } | 38 | } |
@@ -88,15 +90,6 @@ pub(crate) fn reference_definition( | |||
88 | Approximate(navs) | 90 | Approximate(navs) |
89 | } | 91 | } |
90 | 92 | ||
91 | fn name_definition( | ||
92 | sema: &Semantics<RootDatabase>, | ||
93 | name: &ast::Name, | ||
94 | ) -> Option<Vec<NavigationTarget>> { | ||
95 | let def = classify_name(sema, name)?; | ||
96 | let nav = def.try_to_nav(sema.db)?; | ||
97 | Some(vec![nav]) | ||
98 | } | ||
99 | |||
100 | #[cfg(test)] | 93 | #[cfg(test)] |
101 | mod tests { | 94 | mod tests { |
102 | use test_utils::{assert_eq_text, covers}; | 95 | use test_utils::{assert_eq_text, covers}; |