diff options
author | Pascal Hertleif <[email protected]> | 2019-05-25 15:29:39 +0100 |
---|---|---|
committer | Pascal Hertleif <[email protected]> | 2019-05-27 10:26:35 +0100 |
commit | 2b200f6e1a600e263f314efba5d8c3743095071b (patch) | |
tree | 96daa90ff3fd6b3ebd372784ca75c6c495dbc8bf /crates/ra_ide_api/src/syntax_highlighting.rs | |
parent | 43d5a4965308ec4b594725c0bd02cb046bdb730c (diff) |
Disable broken struct field rainbowing
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r-- | crates/ra_ide_api/src/syntax_highlighting.rs | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index 8981c85e6..e46686ab9 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs | |||
@@ -68,16 +68,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
68 | match classify_name_ref(db, &analyzer, name_ref) { | 68 | match classify_name_ref(db, &analyzer, name_ref) { |
69 | Some(Method(_)) => "function", | 69 | Some(Method(_)) => "function", |
70 | Some(Macro(_)) => "macro", | 70 | Some(Macro(_)) => "macro", |
71 | Some(FieldAccess(field)) => { | 71 | Some(FieldAccess(_)) => "field", |
72 | let (hir_file_id, src) = field.source(db); | ||
73 | if let hir::FieldSource::Named(name) = src { | ||
74 | let text = name.syntax().text().to_smol_string(); | ||
75 | let shadow_count = 0; // potentially even from different file | ||
76 | binding_hash = Some(calc_binding_hash(hir_file_id.original_file(db), &text, shadow_count)); | ||
77 | } | ||
78 | |||
79 | "field" | ||
80 | }, | ||
81 | Some(AssocItem(ImplItem::Method(_))) => "function", | 72 | Some(AssocItem(ImplItem::Method(_))) => "function", |
82 | Some(AssocItem(ImplItem::Const(_))) => "constant", | 73 | Some(AssocItem(ImplItem::Const(_))) => "constant", |
83 | Some(AssocItem(ImplItem::TypeAlias(_))) => "type", | 74 | Some(AssocItem(ImplItem::TypeAlias(_))) => "type", |
@@ -119,13 +110,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
119 | calc_binding_hash(file_id, &text, *shadow_count) | 110 | calc_binding_hash(file_id, &text, *shadow_count) |
120 | }); | 111 | }); |
121 | "variable" | 112 | "variable" |
122 | } else if name.syntax().ancestors().any(|x| ast::NamedFieldDef::cast(x).is_some()) { | ||
123 | binding_hash = Some({ | ||
124 | let text = name.syntax().text().to_smol_string(); | ||
125 | let shadow_count = 0; | ||
126 | calc_binding_hash(file_id, &text, shadow_count) | ||
127 | }); | ||
128 | "variable" | ||
129 | } else { | 113 | } else { |
130 | "function" | 114 | "function" |
131 | } | 115 | } |