Skip to content

feat(completion): accept selected item with enter - #263

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/completion-enter
Aug 17, 2026
Merged

fcoury-oai merged 1 commit into
mainfrom
fcoury/completion-enter

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

When the completion menu is open, Enter currently dismisses it and inserts a newline. Users should be able to accept the highlighted suggestion with either Enter or Tab.

Plain Enter now uses the same completion-application path as Tab. If filtering leaves no selected item, Enter still closes the menu and inserts a newline. Modified Enter and Ctrl+e keep their existing behavior. The shortcut help and completion reference now describe the updated keys.

How to Test

  1. In Insert mode, open a completion menu, select a suggestion, and press Enter. The selected text should replace the completion prefix, the menu should close, and no newline should be inserted. Repeat with Tab.
  2. Open the menu again and type until no suggestions match. Press Enter. The menu should close and a newline should be inserted.
  3. Run cargo test --lib completion -- --test-threads=1. This includes enter_accepts_completion_without_inserting_a_newline, tab_and_enter_accept_the_selected_completion, and the filtered-out completion regression. All 108 matching tests passed locally.

cargo clippy --all-targets --all-features -- -D warnings also passed.

@fcoury-oai
fcoury-oai merged commit b66b89b into main Aug 17, 2026
19 of 20 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/completion-enter branch August 17, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant