From d135ec2b73b6ce4fb48a91147cda3780fb4418f4 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Mon, 16 Dec 2024 11:02:54 +0100 Subject: [PATCH] completions: Restore tab behavior when both visible (#22069) This reverts part of #21858 by changing how `tab` works again: - If both, completions and inline completions, are visible, then `tab` accepts the completion and `shif-tab` the inline completion. - If only one of them is shown, then `tab` accepts it. I'm not a fan of this solution, but I think it's a short-term fix that avoids breaking people's `tab` muscle memory. Release Notes: - (These release notes invalidate the release notes contained in: https://github.com/zed-industries/zed/pull/21858) - Changed how inline completions (Copilot, Supermaven, ...) and normal completions (from language servers) interact. Zed will now also show inline completions when the completion menu is visible. The user can accept the inline completion with `` and the active entry in the completion menu with ``. --- assets/keymaps/default-linux.json | 13 ++++++++----- assets/keymaps/default-macos.json | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index f93c459ec6985e884856dff6ce924a1559f81eb0..5c300e82883160b1b0e0878190eb2ddef4eb2a6f 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -468,21 +468,24 @@ } }, { - "context": "Editor && showing_completions", + "context": "Editor && !inline_completion && showing_completions", "use_key_equivalents": true, "bindings": { - "enter": "editor::ConfirmCompletion" + "enter": "editor::ConfirmCompletion", + "tab": "editor::ComposeCompletion" } }, { - "context": "Editor && !inline_completion && showing_completions", + "context": "Editor && inline_completion && showing_completions", "use_key_equivalents": true, "bindings": { - "tab": "editor::ComposeCompletion" + "enter": "editor::ConfirmCompletion", + "tab": "editor::ComposeCompletion", + "shift-tab": "editor::AcceptInlineCompletion" } }, { - "context": "Editor && inline_completion", + "context": "Editor && inline_completion && !showing_completions", "use_key_equivalents": true, "bindings": { "tab": "editor::AcceptInlineCompletion" diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index f821bc982d3ac04df1f78c9b907f5f6d0d972179..a3f35dccdd4e78923df5c0554ac0777d459e58e8 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -539,21 +539,24 @@ } }, { - "context": "Editor && showing_completions", + "context": "Editor && !inline_completion && showing_completions", "use_key_equivalents": true, "bindings": { - "enter": "editor::ConfirmCompletion" + "enter": "editor::ConfirmCompletion", + "tab": "editor::ComposeCompletion" } }, { - "context": "Editor && !inline_completion && showing_completions", + "context": "Editor && inline_completion && showing_completions", "use_key_equivalents": true, "bindings": { - "tab": "editor::ComposeCompletion" + "enter": "editor::ConfirmCompletion", + "tab": "editor::ComposeCompletion", + "shift-tab": "editor::AcceptInlineCompletion" } }, { - "context": "Editor && inline_completion", + "context": "Editor && inline_completion && !showing_completions", "use_key_equivalents": true, "bindings": { "tab": "editor::AcceptInlineCompletion"