blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Feature: show menu after backspace

Open Kyren223 opened this issue 8 months ago • 11 comments

Feature Description

Hitting backspace should re-trigger the menu (like nvim-cmp) Ex (| is cursor): print| then press backspace (<BS>) Should result in prin| with a menu popup

Probably should have exceptions (like don't show menu when whitespace), can maybe see how nvim-cmp handles that and mimic it.

Kyren223 avatar Apr 29 '25 12:04 Kyren223

We intentionally don't show the menu in this case. I'd be open to reviewing a PR that adds opt-in support for it (file to change).

saghen avatar Apr 29 '25 16:04 saghen

@Saghen Unfortunately I am not so experienced in making nvim plugins, I am willing to try and help in what I can, would appreciate any help from you or other people. Option can be something like completion.trigger.show_on_backspace = false (so it's opt-in)

Also as a side note, I find it quite confusing what you categorize as "not planned", like if the user had some configuration issue/bug that is fixable on their side, you'd often mark it as "not planned", I think just closing it is more clear (because I assume "oh this feature/bug is not being fixed" and then I have to go into the issue to see, oh it's just a fixable issue). At least for me, it'd make the most sense to only mark "not planned" issues if it's a feature/bug that is not fixable on the user side AND it's not going to be fixed/added.

Kyren223 avatar Apr 29 '25 16:04 Kyren223

Yeah I get you, but I'm following the same methodology as neovim, where if it isn't a planned feature or an issue with blink.cmp itself, then I close it as not planned.

saghen avatar Apr 29 '25 16:04 saghen

Fair I guess, also maybe reopen this issue so even if you don't work on it, maybe someone else will? (maybe have a label for "contribution welcome" for things you won't work on, but open to merge)

Kyren223 avatar Apr 29 '25 16:04 Kyren223

I have a similar need.

I think this opportunity to customize this behavior will improve the UX.

Yu-Leo avatar May 21 '25 18:05 Yu-Leo

This is a feature that I like, so I would also be interested in helping out

@Kyren223 Are you interested in working on this together?

mcauley-penney avatar May 21 '25 20:05 mcauley-penney

@mcauley-penney Unfortunately I am busy at the moment, I won't be able to dedicate any time to this. Would be very grateful if you end up implementing this!

Kyren223 avatar May 22 '25 15:05 Kyren223

So, I've played around with this for several hours and I think I have something interesting. I apologize for posting then deleting messages, as well as for editing this one so many times. I kind of used this as a way to rubber duck besides posting updates.

Below is a GIF of where I'm at right now. I'll explain the features below the GIF.

Image

  1. We can backspace after accepting a completion,
  2. we can backspace through trigger characters as long as they aren't spaces,
  3. the menu is hidden when we are on a space,
  4. the menu is hidden after an acceptance.

I had something basic up and running, but I found that it was incredibly annoying having the menu continue to show up suggesting the word you just accepted right after you accepted it. I haven't used nvim-cmp in a long while, so I can't remember what its behavior is like, but I think this is a good starting point. Please chime in and let me know what you think. If this is interesting to everybody, I can open a PR.

mcauley-penney avatar May 24 '25 02:05 mcauley-penney

This is a good starting point, thanks for working on it.

For the showing completions you just accepted, I recommend just having it be an option with the default matching nvim-cmp behavior.

Also I am writing this on a phone, and the completion there does show the existing completion like "behavior." Delete the . And it shows "behavior" along with "behav" and "behave"

Kyren223 avatar May 24 '25 08:05 Kyren223

I'll go back and play with nvim-cmp today to see how it acts, then come back to this and update it to be exact.

mcauley-penney avatar May 24 '25 14:05 mcauley-penney

For the showing completions you just accepted, I recommend just having it be an option with the default matching nvim-cmp behavior.

The default nvim-cmp behavior is to not display them, that I can tell. I opened VSCode and found that it doesn't do this either. The behavior that I implemented in blink for the GIF above actually matches cmp, which I didn't realize at the time. I just need to add a user configuration option and then this is actually ready to go as a PR.

Edit: see #1813

mcauley-penney avatar May 25 '25 04:05 mcauley-penney

We can safely close this issue since PR #1813 got merged 5 days ago :)

soifou avatar Jun 08 '25 21:06 soifou