blink.cmp
blink.cmp copied to clipboard
Accept by word / line
Feature Description
Thanks for this awesome plugin!
From https://github.com/fang2hou/blink-copilot/issues/13,
Overall, it’s been incredibly helpful. One feature that could improve the experience further is the ability to accept completions per word or line instead of the entire block, especially when dealing with ai suggestions. For example, sometimes a suggestion works well for part of the code but not the rest, and having granular control (like copilot.lua’s partial acceptance) would streamline workflows. Would this be feasible to implement?
What means the word? The word is non space characters or \w characters?
What means the
word? The word is non space characters or\wcharacters?
Both make sense for me. Maybe as an option?
Or it may be another key map.
accept, accept_word, accept_non_spaces, accept_line
Overall, it’s been incredibly helpful. One feature that could improve the experience further is the ability to accept completions per word or line instead of the entire block, especially when dealing with ai suggestions. For example, sometimes a suggestion works well for part of the code but not the rest, and having granular control (like copilot.lua’s partial acceptance) would streamline workflows. Would this be feasible to implement?
I think it would be easier to understand with a concrete example.
An example of Copilot's suggestions: I only want the suggestion for the first line but ignore the rest. The 'Accept line' feature would be the only way to do this. This is especially useful when dealing with longer AI-generated suggestions.
For anyone looking to implement this, I would start by adding a function to https://github.com/Saghen/blink.cmp/blob/main/lua/blink/cmp/lib/text_edits.lua or under accept/* which transforms the newText to only include one line or word (similar "by word" implementation here, maybe there can be some reuse).
Then the accept function would take some argument which enables the by word or by line behavior. And the relevant command can be added here https://github.com/Saghen/blink.cmp/blob/main/lua/blink/cmp/init.lua#L126
I'd be very interested in this also. I use similar functionality in supermaven-nvim at the moment.