Skip to content
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

Deselects after quickly pressing keys #219

Closed
2 tasks done
jorgebef opened this issue Oct 30, 2024 · 2 comments · Fixed by #465
Closed
2 tasks done

Deselects after quickly pressing keys #219

jorgebef opened this issue Oct 30, 2024 · 2 comments · Fixed by #465
Labels
bug Something isn't working
Milestone

Comments

@jorgebef
Copy link

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

After using the plugin for some time, I've noticed that when using certain LSPs if a key is pressed and very quickly after the key assigned to select_next is pressed, instead of respecting the normal order of key presses, it acts as if the order of the presses is reversed.

My wild guess is that it is due to some async info coming in from the LSP and thus only happening in slower LSPs (typescript-language-server is the usecase I've noticed), for example, I've actively tried making it bug in lua_ls, but was not able to reproduce.

I attach a short video to illustrate, I hope it can show what I mean.

Steps to reproduce:

  • Type usual part of string to trigger completion (e.g. in JSX, the string "classNa")
  • Type one more letter and immediately afterwards the key set up as select_next (e.g. "m" and then "Tab")
  • Visually, first the letter is typed, then first entry is selected, then deselected.

If auto_insert is set, the visual effect is even more jarring as the insert is actually typed but when pressing accept the fallback happens instead of the intended action due to nothing being selected, and select_and_accept selects the first option and accepts due to nothing being selected.
blink-cmp.webm

Relevant configuration

keymap = {
      ["<C-space>"] = { "show", "hide" },
      ["<C-p>"] = { "select_prev", "fallback" },
      ["<C-n>"] = { "select_next", "fallback" },
      ["<CR>"] = { "accept", "fallback" },
      ["<Tab>"] = { "select_next" },
      ["<S-Tab>"] = { "select_prev" },
    },

neovim version

NVIM v0.10.2

blink.cmp version: branch, tag, or commit

commit 6f0fc86

@jorgebef jorgebef added the bug Something isn't working label Oct 30, 2024
@Saghen
Copy link
Owner

Saghen commented Nov 9, 2024

My wild guess is that it is due to some async info coming in from the LSP and thus only happening in slower LSPs

Your wild guess is on the dot 😄 If the item changes position after the new data comes in, would you expect the item to remain selected, or would you expect for your position within the list to be maintained?

@jorgebef
Copy link
Author

My wild guess is that it is due to some async info coming in from the LSP and thus only happening in slower LSPs

Your wild guess is on the dot 😄 If the item changes position after the new data comes in, would you expect the item to remain selected, or would you expect for your position within the list to be maintained?

IMO, the selected item should remain selected.
I'm basing my decision on what nvim-cmp feels like, which is the de-facto standard plugin for completion right now.
Absolutely fantastic plugin by the way, love it!

@Saghen Saghen added this to the Sources v2 milestone Nov 28, 2024
@Saghen Saghen mentioned this issue Dec 6, 2024
9 tasks
@Saghen Saghen closed this as completed in 7ff28da Dec 10, 2024
Saghen added a commit that referenced this issue Dec 10, 2024
Large rewrite of how sources are handled, adding support for async providers/timeouts, tree based fallbacks, dynamically adding sources and some other goodies

Closes #386
Closes #219
Closes #328
Closes #331
Closes #312
Closes #454
Closes #444
Closes #372
Closes #475
Saghen added a commit that referenced this issue Dec 11, 2024
Large rewrite of how sources are handled, adding support for async providers/timeouts, tree based fallbacks, dynamically adding sources and some other goodies

Closes #386
Closes #219
Closes #328
Closes #331
Closes #312
Closes #454
Closes #444
Closes #372
Closes #475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants