Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing tab in case of edit completion inserts tab instead of finishing completion #25406

Open
mspanc opened this issue Feb 22, 2025 · 6 comments
Assignees
Labels
ai Improvement related to Assistant, Copilot, or other AI features inline completion Umbrella label for Copilot, Supermaven, etc. completions

Comments

@mspanc
Copy link

mspanc commented Feb 22, 2025

Summary

Since +/- last update, in most cases, when I try to accept code completion by pressing tab, Zed inserts tab instead of finishing completion.

See that video:

Nagranie.z.ekranu.2025-02-22.o.20.56.53.mov

Actual Behavior:

Zed inserts tab

Expected Behavior:

Zed completes the edit

Zed Version and System Specs

Zed: v0.174.6 (Zed)
OS: macOS 15.3.0
Memory: 64 GiB
Architecture: aarch64

@beniaminzagan
Copy link
Member

@mspanc Thank you for reporting this, I'm sorry for this experience. Can we get your keymap.json setup if you have one at all, and see if its interacting with it?

@beniaminzagan beniaminzagan added the autocompletions Feedback for code completions in the editor label Feb 22, 2025
@maxdeviant
Copy link
Member

In the video you can see that it is showing ⌥ tab as the accept keybind in this case. In some cases Zed will require ⌥ tab instead of just tab in order to accept the completion due to the ambiguity introduced by the position of the cursor (as it is equally reasonable that someone might want to insert indentation when pressing tab in this case).

We are currently looking into how to improve cases like this.

@mspanc
Copy link
Author

mspanc commented Feb 23, 2025

Ah, now I noticed the extra option modifier.

But it sometimes asks about pressing just tab:

Image

in other cases its option+tab.

That's inconvenient. Previously, when I was using copilot, pressing just tab was fine. If I rejected completion I pressed esc, and then I was able to use tab to insert tab. That felt more natural and I did not had to look whether its tab or option+tab. Current state is very annoying.

@baptisteArno
Copy link

baptisteArno commented Feb 23, 2025

That's inconvenient. Previously, when I was using copilot, pressing just tab was fine. If I rejected completion I pressed esc, and then I was able to use tab to insert tab. That felt more natural and I did not had to look whether its tab or option+tab. Current state is very annoying.

You can add this keymap to always use ai completion even when there's a language server completion

{
    "context": "Editor && edit_prediction_conflict",
    "bindings": {
      "tab": "editor::AcceptEditPrediction"
    }
  }

Found here: https://zed.dev/docs/completions

@danilo-leal danilo-leal added ai Improvement related to Assistant, Copilot, or other AI features inline completion Umbrella label for Copilot, Supermaven, etc. completions and removed autocompletions Feedback for code completions in the editor labels Feb 23, 2025
@mspanc
Copy link
Author

mspanc commented Feb 23, 2025

Thank you for the hint. However, I don't think it's valid UX to expect from the user to recognise what is LSP completion, and what is AI completion and have two different key bindings by default. When you're focused on coding, you don't care what is the source of completion - you want to accept it as long as it works for you. And you want to this mindlessly by pressing the same key. Current approach is IMO quite distracting.

@mspanc
Copy link
Author

mspanc commented Feb 23, 2025

Moreover I am accepting completions 10x more often than having an intention to add a tab when the completion happens. The completions are being rarely shown when the cursor is located in a position that usually would have ended up with adding tab. Look at my video from the first comment - this is a great example. There's 0,0001% chance my intention was to add a tab in that place in the code - there's no if or any other block, its very end of the function - I'm rather willing to write return, not make indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai Improvement related to Assistant, Copilot, or other AI features inline completion Umbrella label for Copilot, Supermaven, etc. completions
Projects
None yet
Development

No branches or pull requests

6 participants