# Fix "Show Edit Predictions For This Buffer" button \(\#50845\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/778878418dfca779ccfe721898634f9b140db33c)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 778878418dfca779ccfe721898634f9b140db33c

Requested commit: 778878418dfca779ccfe721898634f9b140db33c

Commit: 778878418dfca779ccfe721898634f9b140db33c

Tree: 4070637125e975f688f449633873dc10b66c6fa2

Author: Ayush Kumar Anand

Committer: GitHub

## Message

```
Fix "Show Edit Predictions For This Buffer" button (#50845)

Closes #48393

When switching the language of an unsaved buffer (e.g., from Plain Text
to JavaScript), the editor's edit_prediction_settings were not
recalculated. This caused the "This Buffer" toggle in the edit
prediction menu to show a stale state, making the first click a no-op. I
added a call to update_edit_prediction_settings in the LanguageChanged
event handler so the editor immediately reflects the correct edit
prediction state for the new language.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed the "Show Edit Predictions For This Buffer" toggle being a no-op
in unsaved buffers after switching the buffer's language.
```

## Parents

- [f7ec53137d357b680d13661da15e0fd16aa93703](https://git.cafe/gitcafe/zed/commit/f7ec53137d357b680d13661da15e0fd16aa93703?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/778878418dfca779ccfe721898634f9b140db33c?format=markdown)
