From 191a1d7b10655ac4b4d0ad2948a356845725a69a Mon Sep 17 00:00:00 2001 From: itsaphel <2878052+itsaphel@users.noreply.github.com> Date: Thu, 20 Feb 2025 20:02:31 +0000 Subject: [PATCH] edit prediction: Don't show and discard completion if toggled off in the buffer (#24927) Discards an inline completion when it's toggled to off (using, say, a keyboard shortcut). This matches the behaviour in VS Code and JetBrains, and I think is a bit more intuitive. (https://github.com/zed-industries/zed/discussions/24895) Release Notes: - N/A --- crates/editor/src/editor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 6f5432ccd2..2f80d80d26 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1953,7 +1953,12 @@ impl Editor { cx: &mut Context, ) { self.show_inline_completions_override = show_edit_predictions; - self.refresh_inline_completion(false, true, window, cx); + + if let Some(false) = show_edit_predictions { + self.discard_inline_completion(false, cx); + } else { + self.refresh_inline_completion(false, true, window, cx); + } } fn inline_completions_disabled_in_scope(