Remove some unused events (#37498)

This PR cleans up some emitted events around the codebase. These events
are either never emitted or never listened for.

It seems better to re-implement these at some point should they again be
needed - this ensures that they will actually be fired in the cases
where they are needed as opposed to being there and getting unreliable
and stale (which is already the case for the majority of the events
removed here).

Lastly, this ensures the `CapabilitiesChanged` event is not fired too
often.

Release Notes:

- N/A
This commit is contained in:
Finn Evers
2025-09-04 09:09:28 +02:00
committed by GitHub
parent 69a5c45672
commit aa1629b544
11 changed files with 21 additions and 114 deletions
-4
View File
@@ -20326,7 +20326,6 @@ impl Editor {
multi_buffer::Event::FileHandleChanged
| multi_buffer::Event::Reloaded
| multi_buffer::Event::BufferDiffChanged => cx.emit(EditorEvent::TitleChanged),
multi_buffer::Event::Closed => cx.emit(EditorEvent::Closed),
multi_buffer::Event::DiagnosticsUpdated => {
self.update_diagnostics_state(window, cx);
}
@@ -23024,7 +23023,6 @@ pub enum EditorEvent {
DirtyChanged,
Saved,
TitleChanged,
DiffBaseChanged,
SelectionsChanged {
local: bool,
},
@@ -23032,14 +23030,12 @@ pub enum EditorEvent {
local: bool,
autoscroll: bool,
},
Closed,
TransactionUndone {
transaction_id: clock::Lamport,
},
TransactionBegun {
transaction_id: clock::Lamport,
},
Reloaded,
CursorShapeChanged,
BreadcrumbsChanged,
PushedToNavHistory {
-8
View File
@@ -775,12 +775,6 @@ impl Item for Editor {
self.nav_history = Some(history);
}
fn discarded(&self, _project: Entity<Project>, _: &mut Window, cx: &mut Context<Self>) {
for buffer in self.buffer().clone().read(cx).all_buffers() {
buffer.update(cx, |buffer, cx| buffer.discarded(cx))
}
}
fn on_removed(&self, cx: &App) {
self.report_editor_event(ReportEditorEvent::Closed, None, cx);
}
@@ -1022,8 +1016,6 @@ impl Item for Editor {
fn to_item_events(event: &EditorEvent, mut f: impl FnMut(ItemEvent)) {
match event {
EditorEvent::Closed => f(ItemEvent::CloseItem),
EditorEvent::Saved | EditorEvent::TitleChanged => {
f(ItemEvent::UpdateTab);
f(ItemEvent::UpdateBreadcrumbs);