diff options
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r-- | crates/ra_ide_api/src/syntax_highlighting.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index 8be93e27e..28c50102e 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs | |||
@@ -14,7 +14,7 @@ use ra_syntax::{ | |||
14 | 14 | ||
15 | use crate::{ | 15 | use crate::{ |
16 | db::RootDatabase, | 16 | db::RootDatabase, |
17 | name_kind::{classify_name_ref, NameKind::*}, | 17 | references::{classify_name_ref, NameKind::*}, |
18 | FileId, | 18 | FileId, |
19 | }; | 19 | }; |
20 | 20 | ||
@@ -101,10 +101,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
101 | continue; | 101 | continue; |
102 | } | 102 | } |
103 | if let Some(name_ref) = node.as_node().cloned().and_then(ast::NameRef::cast) { | 103 | if let Some(name_ref) = node.as_node().cloned().and_then(ast::NameRef::cast) { |
104 | // FIXME: try to reuse the SourceAnalyzers | 104 | let name_kind = |
105 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); | 105 | classify_name_ref(db, file_id, &name_ref).and_then(|d| Some(d.item)); |
106 | let name_kind = classify_name_ref(db, file_id, &analyzer, &name_ref) | ||
107 | .and_then(|d| Some(d.item)); | ||
108 | match name_kind { | 106 | match name_kind { |
109 | Some(Macro(_)) => "macro", | 107 | Some(Macro(_)) => "macro", |
110 | Some(FieldAccess(_)) => "field", | 108 | Some(FieldAccess(_)) => "field", |
@@ -131,6 +129,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
131 | Some(calc_binding_hash(file_id, &text, *shadow_count)) | 129 | Some(calc_binding_hash(file_id, &text, *shadow_count)) |
132 | } | 130 | } |
133 | 131 | ||
132 | let analyzer = | ||
133 | hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); | ||
134 | if is_variable_mutable(db, &analyzer, ptr.to_node(&root)) { | 134 | if is_variable_mutable(db, &analyzer, ptr.to_node(&root)) { |
135 | "variable.mut" | 135 | "variable.mut" |
136 | } else { | 136 | } else { |