From c304e964fe281a559cd5fc34b2b4375fb4a9a7d6 Mon Sep 17 00:00:00 2001 From: Jakub Sygnowski Date: Fri, 6 Jun 2025 05:30:57 -0400 Subject: [PATCH] Display the first keystroke instead of an error for multi-keystroke binding (#31456) Ideally we would show multi-keystroke binding, but I'd say this improves over the status quo. A partial solution to #27334 Release Notes: - Fixed spurious warning for lack of edit prediction on multi-keystroke binding Co-authored-by: Ben Kunkle --- crates/editor/src/editor.rs | 2 ++ crates/editor/src/element.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 3424a72697..ed8e0c9cc8 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -2261,6 +2261,8 @@ impl Editor { window.bindings_for_action_in_context(&AcceptEditPrediction, key_context) }; + // TODO: if the binding contains multiple keystrokes, display all of them, not + // just the first one. AcceptEditPredictionBinding(bindings.into_iter().rev().find(|binding| { !in_conflict || binding diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 33371b5c6a..073aac2873 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -6666,7 +6666,7 @@ impl AcceptEditPredictionBinding { pub fn keystroke(&self) -> Option<&Keystroke> { if let Some(binding) = self.0.as_ref() { match &binding.keystrokes() { - [keystroke] => Some(keystroke), + [keystroke, ..] => Some(keystroke), _ => None, } } else {