editor: Disable edit predictions in read-only buffers (#26804)

Finn Evers and Marshall Bowers created

Closes #26797

Release Notes:

- Fixed edit predictions appearing in read-only buffers.

Co-authored-by: Marshall Bowers <git@maxdeviant.com>

Change summary

crates/editor/src/editor.rs | 3 +++
1 file changed, 3 insertions(+)

Detailed changes

crates/editor/src/editor.rs 🔗

@@ -5200,6 +5200,9 @@ impl Editor {
         cx: &App,
     ) -> bool {
         maybe!({
+            if self.read_only(cx) {
+                return Some(false);
+            }
             let provider = self.edit_prediction_provider()?;
             if !provider.is_enabled(&buffer, buffer_position, cx) {
                 return Some(false);