aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/syntax_highlighting.rs
diff options
context:
space:
mode:
authorEkaterina Babshukova <[email protected]>2019-10-04 01:20:14 +0100
committerEkaterina Babshukova <[email protected]>2019-10-22 21:47:31 +0100
commit121aa35f12d282066651d906ea9a8b2da8209605 (patch)
treec9e896b2607d45ac72732572800d0397747ea680 /crates/ra_ide_api/src/syntax_highlighting.rs
parent83f780eabfdaf37cb50c10c79af87506f2cc2afe (diff)
return Declaration from classify_name_ref
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 98373a49c..8be93e27e 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -103,7 +103,9 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
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 // FIXME: try to reuse the SourceAnalyzers
105 let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); 105 let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None);
106 match classify_name_ref(db, &analyzer, &name_ref) { 106 let name_kind = classify_name_ref(db, file_id, &analyzer, &name_ref)
107 .and_then(|d| Some(d.item));
108 match name_kind {
107 Some(Macro(_)) => "macro", 109 Some(Macro(_)) => "macro",
108 Some(FieldAccess(_)) => "field", 110 Some(FieldAccess(_)) => "field",
109 Some(AssocItem(hir::AssocItem::Function(_))) => "function", 111 Some(AssocItem(hir::AssocItem::Function(_))) => "function",
@@ -119,7 +121,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
119 Some(Def(hir::ModuleDef::TypeAlias(_))) => "type", 121 Some(Def(hir::ModuleDef::TypeAlias(_))) => "type",
120 Some(Def(hir::ModuleDef::BuiltinType(_))) => "type", 122 Some(Def(hir::ModuleDef::BuiltinType(_))) => "type",
121 Some(SelfType(_)) => "type", 123 Some(SelfType(_)) => "type",
122 Some(Pat(ptr)) => { 124 Some(Pat((_, ptr))) => {
123 let pat = ptr.to_node(&root); 125 let pat = ptr.to_node(&root);
124 if let Some(name) = pat.name() { 126 if let Some(name) = pat.name() {
125 let text = name.text(); 127 let text = name.text();