editor: Add to option to keep completion menu at original position. - #2549
editor: Add to option to keep completion menu at original position.#2549palaska wants to merge 1 commit into
Conversation
The completion menu recomputed its origin() from the live caret bounds on every render, so the popover slid right as the query grew — reading as draggy/stuttery. Freeze the anchor for the lifetime of a completion session (cleared on hide / new trigger).
f652b4f to
c962383
Compare
|
VS Code and Zed's completion popovers follow the cursor like your Before example. Not to say gpui-component's couldn't be better, the other editor's auto-close the popover after you finish a word, or there are no matches, then re-open when you start typing a second word. |
Hmm thats true actually. Yeah it felt jittery and laggy probably because as you said it doesn't follow the cursor as closely as the others so the after behavior felt much nicer to me. If you prefer keeping the old behavior, I guess I can make this gated by a config. Feel free to close this if you don't think it's necessary :) |
|
I'd like this feature, but I'd like this to as an option and default to before version. |
Description
The completion popover recomputes its position from the live caret bounds on every render, so it slides right as you type the query, reading as jittery.
This pins the popover to where the completion session opened and keeps it there until the session ends (
hide) or a new one begins, matching the behavior of editors like VS Code and Zed.Screenshot
Before

After

Break Changes
None
How to Test
cargo run --example editorBefore: the popover slides right, tracking the caret.
After: the popover stays pinned where the completion opened.
Dismissing (Esc) and re-triggering elsewhere re-pins it at the new location.
Checklist
cargo runfor story tests related to the changes.