-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow per-character autocompletion window movement #344
Comments
Blink originally worked this way but that was phased out for aligning the window to the word being typed. Why do you prefer this behavior? |
That's a good question. I think that the window not moving with the cursor makes something about typing feel disjointed. This feels more natural, even if there is an argument to be made for the movement making things feel more jittery or unreadable. I think the motion feels comfortable. Edit: also, to be explicit, I don't think that this should be the only option or the default. It would just be nice to have this as a setting that can be toggled. |
This comment was marked as outdated.
This comment was marked as outdated.
@s-cerevisiae If I understand correctly, that's already the default behavior. I'm interested in a second option that is similar to VSCode. |
Yeah that's the default behavior on main, but not on the latest release, just to clarify |
Attached is a patch that allows users to experiment with this. It doesn't include any configuration options to modify column offset or to turn the feature on and off (although I'd be happy to create that if there was interest). This is just a tiny POC. diff --git a/lua/blink/cmp/completion/windows/menu.lua b/lua/blink/cmp/completion/windows/menu.lua
index 969f99e..81b469a 100644
--- a/lua/blink/cmp/completion/windows/menu.lua
+++ b/lua/blink/cmp/completion/windows/menu.lua
@@ -120,9 +120,8 @@ function menu.update_position()
col = math.max(cmdline_position[2] + context.bounds.start_col - start_col, 0),
})
else
- local cursor_col = context.get_cursor()[2]
- local col = context.bounds.start_col - cursor_col - (context.bounds.length == 0 and 0 or 1) - border_size.left
- win:set_win_config({ relative = 'cursor', row = row, col = col - start_col })
+ local col = 0
+ win:set_win_config({ relative = 'cursor', row = row, col = col })
end
win:set_height(pos.height) |
Looks good! I'daccept a PR for it. Let's rename |
I just forked to work on this! Thank you for implementing this. I spent the day working on research yesterday and planned on doing this today. |
Np! Thanks for the diff, made it super easy |
Feature Description
Desired behavior
VSCode allows for the autocompletion window to move per-character. This means that, for each character typed, the autocompletion window will update to the position of the cursor in the buffer. This GIF from VSCode's IntelliSense documentation displays this.
Current behavior
As of now, blink does not allow for this. It only updates per-word; the autocompletion window will not move until the current word is completed.
Related
This was a feature I and another user implemented in nvim-cmp (hrsh7th/nvim-cmp#1727), so there is a precedent not only from another editor but also from the existing nvim ecosystem.
The text was updated successfully, but these errors were encountered: