diff options
author | Aleksey Kladov <[email protected]> | 2020-01-14 16:39:28 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-01-15 15:52:28 +0000 |
commit | 11d6b9daddfa9275c507a5e246541c28a78023ab (patch) | |
tree | 1284a6dd8fe99e549c2bdba4198665b6e350910a /crates/ra_ide/src/hover.rs | |
parent | 35bfeaf4af4bcccf355f1e0e1a38547a2982a251 (diff) |
Only new-style classification
Diffstat (limited to 'crates/ra_ide/src/hover.rs')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 5548681f1..6661e5cb2 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{db::AstDatabase, Adt, HasSource, HirDisplay}; | 3 | use hir::{db::AstDatabase, Adt, HasSource, HirDisplay, SourceBinder}; |
4 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
5 | use ra_syntax::{ | 5 | use ra_syntax::{ |
6 | algo::find_covering_element, | 6 | algo::find_covering_element, |
@@ -152,13 +152,14 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn | |||
152 | 152 | ||
153 | let mut res = HoverResult::new(); | 153 | let mut res = HoverResult::new(); |
154 | 154 | ||
155 | let mut sb = SourceBinder::new(db); | ||
155 | if let Some((range, name_kind)) = match_ast! { | 156 | if let Some((range, name_kind)) = match_ast! { |
156 | match (token.value.parent()) { | 157 | match (token.value.parent()) { |
157 | ast::NameRef(name_ref) => { | 158 | ast::NameRef(name_ref) => { |
158 | classify_name_ref(db, token.with_value(&name_ref)).map(|d| (name_ref.syntax().text_range(), d.kind)) | 159 | classify_name_ref(&mut sb, token.with_value(&name_ref)).map(|d| (name_ref.syntax().text_range(), d.kind)) |
159 | }, | 160 | }, |
160 | ast::Name(name) => { | 161 | ast::Name(name) => { |
161 | classify_name(db, token.with_value(&name)).map(|d| (name.syntax().text_range(), d.kind)) | 162 | classify_name(&mut sb, token.with_value(&name)).map(|d| (name.syntax().text_range(), d.kind)) |
162 | }, | 163 | }, |
163 | _ => None, | 164 | _ => None, |
164 | } | 165 | } |
@@ -742,7 +743,7 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
742 | } | 743 | } |
743 | fn foo(bar:u32) { | 744 | fn foo(bar:u32) { |
744 | let a = id!(ba<|>r); | 745 | let a = id!(ba<|>r); |
745 | } | 746 | } |
746 | ", | 747 | ", |
747 | &["u32"], | 748 | &["u32"], |
748 | ); | 749 | ); |