diff options
author | cynecx <[email protected]> | 2019-08-21 23:39:18 +0100 |
---|---|---|
committer | cynecx <[email protected]> | 2019-08-21 23:39:18 +0100 |
commit | 5534167f58ae81deabeffeffcc0ceb0e9c58b13f (patch) | |
tree | b2a80bc03046760e0345233d67dac7de8553a168 /crates/ra_ide_api | |
parent | 5fd9a5be0984faa138281e46dd4b73cfdad073b1 (diff) |
Fix syntax-highlighting for fields (`NAMED_FIELD_DEF`)
Diffstat (limited to 'crates/ra_ide_api')
-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" |