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 <ben@zed.dev>
This commit is contained in:
Jakub Sygnowski 2025-06-06 05:30:57 -04:00 committed by GitHub
parent 53abad5979
commit c304e964fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -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

View file

@ -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 {