diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide_api/src/syntax_highlighting.rs | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index 878a94f06..448acffc8 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs | |||
@@ -158,21 +158,17 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
158 | } else { | 158 | } else { |
159 | "variable" | 159 | "variable" |
160 | } | 160 | } |
161 | } else if name | ||
162 | .syntax() | ||
163 | .parent() | ||
164 | .map(|x| { | ||
165 | x.kind() == TYPE_PARAM | ||
166 | || x.kind() == STRUCT_DEF | ||
167 | || x.kind() == ENUM_DEF | ||
168 | || x.kind() == TRAIT_DEF | ||
169 | || x.kind() == TYPE_ALIAS_DEF | ||
170 | }) | ||
171 | .unwrap_or(false) | ||
172 | { | ||
173 | "type" | ||
174 | } else { | 161 | } else { |
175 | "function" | 162 | name.syntax() |
163 | .parent() | ||
164 | .map(|x| match x.kind() { | ||
165 | TYPE_PARAM | STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF => { | ||
166 | "type" | ||
167 | } | ||
168 | NAMED_FIELD_DEF => "field", | ||
169 | _ => "function", | ||
170 | }) | ||
171 | .unwrap_or("function") | ||
176 | } | 172 | } |
177 | } else { | 173 | } else { |
178 | "text" | 174 | "text" |