Skip to content

Feat: Incremental Acceptance of Suggestions #264

@Or1g3n

Description

@Or1g3n

Summary
It would be highly beneficial if copilot.vim supported incremental acceptance of suggestions, similar to the autocomplete behavior in Nushell/Fish/etc., where pressing Tab accepts the entire suggestion, but pressing the right-arrow key accepts only the next word or segment. This would allow users to accept just the relevant portion of a suggestion, streamlining the workflow and reducing the need for manual edits after accepting a suggestion.

Problem
More often than not, especially, when generating doc text OR using copilot to infer prompts in chat, it will suggest mostly what is wanted but include undesired segments. This forces the user to either the portion they want by hand OR accept the whole thing and then delete the unwanted portions after the fact which is cumbersome.

Benefits

  • Greater Control: Users can accept only the parts of a suggestion they want, reducing the need to delete unwanted code after accepting a full suggestion.
  • Improved Efficiency: Incremental acceptance would make it faster to compose code, especially when only a portion of the suggestion is correct.
  • Enhanced User Experience: Mimics familiar shell and IDE behaviors, making Copilot more intuitive and flexible for a wider range of users.
  • Reduced Cognitive Load: Users can focus on the code they want to keep, rather than constantly editing out irrelevant parts.

Incremental Acceptance Granularity
For the initial implementation, accepting suggestions by word is likely the simplest and most intuitive approach. This allows users to incrementally accept the suggestion one word at a time by pressing (or holding) the right-arrow key, making it easy to quickly accept as much of the suggestion as desired without overcomplicating the UI or logic. “By word” is language-agnostic and easy to implement, plus, users can hold down the right-arrow key to rapidly accept multiple words if needed.

Future Enhancement
One way to make this an even smoother workflow would be to allow find motion so user can "quick-accept" up to the character using said motion. This could get even better with plugin behaviors like flash.nvim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions