Disable broken struct field rainbowing

This commit is contained in:
Pascal Hertleif 2019-05-25 16:29:39 +02:00
parent 43d5a49653
commit 2b200f6e1a
No known key found for this signature in database
GPG key ID: EDBB1A8D2047A074
3 changed files with 7 additions and 23 deletions

View file

@ -68,16 +68,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
match classify_name_ref(db, &analyzer, name_ref) {
Some(Method(_)) => "function",
Some(Macro(_)) => "macro",
Some(FieldAccess(field)) => {
let (hir_file_id, src) = field.source(db);
if let hir::FieldSource::Named(name) = src {
let text = name.syntax().text().to_smol_string();
let shadow_count = 0; // potentially even from different file
binding_hash = Some(calc_binding_hash(hir_file_id.original_file(db), &text, shadow_count));
}
"field"
},
Some(FieldAccess(_)) => "field",
Some(AssocItem(ImplItem::Method(_))) => "function",
Some(AssocItem(ImplItem::Const(_))) => "constant",
Some(AssocItem(ImplItem::TypeAlias(_))) => "type",
@ -119,13 +110,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
calc_binding_hash(file_id, &text, *shadow_count)
});
"variable"
} else if name.syntax().ancestors().any(|x| ast::NamedFieldDef::cast(x).is_some()) {
binding_hash = Some({
let text = name.syntax().text().to_smol_string();
let shadow_count = 0;
calc_binding_hash(file_id, &text, shadow_count)
});
"variable"
} else {
"function"
}