svg_preview: Remove unnecessary dependency on editor (#43147)

Editor is a choke point in our compilation graph while also being a very
common crate that is being edited. So reducing things that depend on it
will generally improve compilation times for us.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-20 12:18:50 +01:00
committed by GitHub
parent 1e45c99c80
commit 29f9853978
24 changed files with 127 additions and 119 deletions
+1 -1
View File
@@ -26983,7 +26983,7 @@ async fn test_non_utf_8_opens(cx: &mut TestAppContext) {
.unwrap();
assert_eq!(
handle.to_any().entity_type(),
handle.to_any_view().entity_type(),
TypeId::of::<InvalidItemView>()
);
}
+15
View File
@@ -588,6 +588,21 @@ fn deserialize_anchor(buffer: &MultiBufferSnapshot, anchor: proto::EditorAnchor)
impl Item for Editor {
type Event = EditorEvent;
fn act_as_type<'a>(
&'a self,
type_id: TypeId,
self_handle: &'a Entity<Self>,
cx: &'a App,
) -> Option<gpui::AnyEntity> {
if TypeId::of::<Self>() == type_id {
Some(self_handle.clone().into())
} else if TypeId::of::<MultiBuffer>() == type_id {
Some(self_handle.read(cx).buffer.clone().into())
} else {
None
}
}
fn navigate(
&mut self,
data: Box<dyn std::any::Any>,