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 | 19 +++++++++++-------- assets/keymaps/default-macos.json | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index f93c459ec6..5c300e8288 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -467,22 +467,25 @@ "enter": "editor::ConfirmRename" } }, - { - "context": "Editor && showing_completions", - "use_key_equivalents": true, - "bindings": { - "enter": "editor::ConfirmCompletion" - } - }, { "context": "Editor && !inline_completion && showing_completions", "use_key_equivalents": true, "bindings": { + "enter": "editor::ConfirmCompletion", "tab": "editor::ComposeCompletion" } }, { - "context": "Editor && inline_completion", + "context": "Editor && inline_completion && showing_completions", + "use_key_equivalents": true, + "bindings": { + "enter": "editor::ConfirmCompletion", + "tab": "editor::ComposeCompletion", + "shift-tab": "editor::AcceptInlineCompletion" + } + }, + { + "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 f821bc982d..a3f35dccdd 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -538,22 +538,25 @@ "enter": "editor::ConfirmRename" } }, - { - "context": "Editor && showing_completions", - "use_key_equivalents": true, - "bindings": { - "enter": "editor::ConfirmCompletion" - } - }, { "context": "Editor && !inline_completion && showing_completions", "use_key_equivalents": true, "bindings": { + "enter": "editor::ConfirmCompletion", "tab": "editor::ComposeCompletion" } }, { - "context": "Editor && inline_completion", + "context": "Editor && inline_completion && showing_completions", + "use_key_equivalents": true, + "bindings": { + "enter": "editor::ConfirmCompletion", + "tab": "editor::ComposeCompletion", + "shift-tab": "editor::AcceptInlineCompletion" + } + }, + { + "context": "Editor && inline_completion && !showing_completions", "use_key_equivalents": true, "bindings": { "tab": "editor::AcceptInlineCompletion"