-
Notifications
You must be signed in to change notification settings - Fork 214
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
Completion menu showing before being fully created and sorted #1080
Comments
lsp-bridge is full async design, every backend (lsp or yas) have result will make acm menu redraw, we can't stop lsp candidate show to wait yas candidate. It's will make lsp-bridge slow as lsp-mode or eglot, it's not lsp-bridge's target. |
You can find other way to fit your need, but I won't accept any request that slow down the lsp-bridge's speed. |
Thanks for your answer! I ended up adding a small delay to the popup, that way : (require 'timeout)
(defvar lsp-bridge-try-completion-debounced-fn
(timeout-debounce! #'lsp-bridge-try-completion 0.5)
"Debounced version of `lsp-bridge-try-completion` with a 0.5-second delay.")
(defun lsp-bridge-try-completion-debounced ()
"Function to call the debounced version of `lsp-bridge-try-completion`."
(funcall lsp-bridge-try-completion-debounced-fn))
(with-eval-after-load 'lsp-bridge
(remove-hook 'post-command-hook #'lsp-bridge-try-completion)
(add-hook 'post-command-hook #'lsp-bridge-try-completion-debounced)) With the help of timeout. No idea if it is the proper or best way to do it, but it seems to work fine so far. I don't really need the (unsorted) completion popup to be shown immediately (it can even be slightly annoying having a thing always poping and moving as you type), but I really need a consistent behavior and be able to hit tab right after I wrote my yasnippet key. So all's good for me now. |
OK, can you rewrite this patch as a option? I don't like this patch, but I will merge option PR if user like it. |
Tweaking
acm-completion-backend-merge-order
as suggested in #1078 worked perfectly to sort the menu, now the yasnippet completions are always at the top of the completion list.But it didn't solve the real need I had, being :
Because when I type a yasnippet key and hit tab right away, lsp-bridge being fast, the completion menu is shown almost instantly BUT the items in the completion menu are still being created and sorted. So, until the menu is fully populated, the yasnippet are not at the top. That means that 9 times out of 10 (because I am too quick to hit tab) the completion made is not what I want.
I see two ways to solve this :
1/ Show the completion menu only after a small delay (so that I have time to expand my yasnippet key before the menu shows up).
Or better (in my opinion) :
2/ Show the menu only when it is fully populated and sorted, so that the same actions always yields the same results (no matter the time you take to hit the keys).
I couldn't find any variables to tweak to achieve either 1/ or 2/.
(I am aware of
lsp-bridge-complete-manually
(as mentionned in #623) but I do want the menu to popup automatically.)The text was updated successfully, but these errors were encountered: