mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Fix syntax-highlighting for fields (NAMED_FIELD_DEF
)
This commit is contained in:
parent
5fd9a5be09
commit
5534167f58
1 changed files with 10 additions and 14 deletions
|
@ -158,21 +158,17 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
|
||||||
} else {
|
} else {
|
||||||
"variable"
|
"variable"
|
||||||
}
|
}
|
||||||
} else if name
|
|
||||||
.syntax()
|
|
||||||
.parent()
|
|
||||||
.map(|x| {
|
|
||||||
x.kind() == TYPE_PARAM
|
|
||||||
|| x.kind() == STRUCT_DEF
|
|
||||||
|| x.kind() == ENUM_DEF
|
|
||||||
|| x.kind() == TRAIT_DEF
|
|
||||||
|| x.kind() == TYPE_ALIAS_DEF
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
|
||||||
"type"
|
|
||||||
} else {
|
} else {
|
||||||
"function"
|
name.syntax()
|
||||||
|
.parent()
|
||||||
|
.map(|x| match x.kind() {
|
||||||
|
TYPE_PARAM | STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF => {
|
||||||
|
"type"
|
||||||
|
}
|
||||||
|
NAMED_FIELD_DEF => "field",
|
||||||
|
_ => "function",
|
||||||
|
})
|
||||||
|
.unwrap_or("function")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"text"
|
"text"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue