diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 6176f06bd0327bcd5cba8a73b20a20f5b697a0f2..c2658c4f8e3db40b37a1bb747c5caf2b159bbbbf 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -521,18 +521,20 @@ impl DisplayMap { } pub fn clear_highlights(&mut self, type_id: TypeId) -> bool { - let mut cleared = false; - + let mut cleared = self + .text_highlights + .remove(HighlightKey::Type(type_id)) + .is_some(); self.text_highlights.retain(|key, _| { - let retain = match key { - HighlightKey::Type(key_type_id) => key_type_id != &type_id, - HighlightKey::TypePlus(key_type_id, _) => key_type_id != &type_id, + let retain = if let HighlightKey::TypePlus(key_type_id, _) = key { + key_type_id != &type_id + } else { + true }; cleared |= !retain; retain }); cleared |= self.inlay_highlights.remove(&type_id).is_some(); - cleared } diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index a133e8f13f5e1a477001d760a6753e20684c2ac9..6a758e3c10afc544e14e88ac21223448519edd4a 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -20935,7 +20935,7 @@ impl Editor { cx: &mut Context, ) { self.display_map.update(cx, |map, _| { - map.highlight_text(HighlightKey::Type(TypeId::of::()), ranges, style) + map.highlight_text(HighlightKey::Type(TypeId::of::()), ranges, style, false) }); cx.notify(); }