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 -12
View File
@@ -315,10 +315,6 @@ pub enum BufferEvent {
DiagnosticsUpdated,
/// The buffer gained or lost editing capabilities.
CapabilityChanged,
/// The buffer was explicitly requested to close.
Closed,
/// The buffer was discarded when closing.
Discarded,
}
/// The file associated with a buffer.
@@ -1246,8 +1242,10 @@ impl Buffer {
/// Assign the buffer a new [`Capability`].
pub fn set_capability(&mut self, capability: Capability, cx: &mut Context<Self>) {
self.capability = capability;
cx.emit(BufferEvent::CapabilityChanged)
if self.capability != capability {
self.capability = capability;
cx.emit(BufferEvent::CapabilityChanged)
}
}
/// This method is called to signal that the buffer has been saved.
@@ -1267,12 +1265,6 @@ impl Buffer {
cx.notify();
}
/// This method is called to signal that the buffer has been discarded.
pub fn discarded(&self, cx: &mut Context<Self>) {
cx.emit(BufferEvent::Discarded);
cx.notify();
}
/// Reloads the contents of the buffer from disk.
pub fn reload(&mut self, cx: &Context<Self>) -> oneshot::Receiver<Option<Transaction>> {
let (tx, rx) = futures::channel::oneshot::channel();