edit predictions: Cache settings across renders (#24581)

We were reading edit prediction settings too often, causing frames to be
dropped. We'll now cache them and update them from
`update_visible_inline_completion`.

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-02-10 17:57:25 -03:00 committed by GitHub
parent 973cb916f3
commit 0af048a7cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 124 additions and 102 deletions

View file

@ -563,7 +563,7 @@ impl PromptLibrary {
editor.set_text(prompt_metadata.title.unwrap_or_default(), window, cx);
if prompt_id.is_built_in() {
editor.set_read_only(true);
editor.set_show_inline_completions(Some(false), window, cx);
editor.set_show_edit_predictions(Some(false), window, cx);
}
editor
});
@ -578,7 +578,7 @@ impl PromptLibrary {
let mut editor = Editor::for_buffer(buffer, None, window, cx);
if prompt_id.is_built_in() {
editor.set_read_only(true);
editor.set_show_inline_completions(Some(false), window, cx);
editor.set_show_edit_predictions(Some(false), window, cx);
}
editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx);
editor.set_show_gutter(false, cx);