-
Notifications
You must be signed in to change notification settings - Fork 25
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
ivy-prescient doesn't prioritizes the exact match #62
Comments
No, that seems like a bug. I suspect it is due to another internal change in Ivy. The best solution is to switch to Selectrum, which does not have any of these issues, but perhaps somebody will contribute a pull request to help |
I would, by the way, be happy to add somebody as a maintainer for |
It's not just ivy, |
The author already said he can't maintain |
The author didn't say he can't maintain |
If indeed this bug also exists in |
Actually, I take it back. This is not a bug, because regular Company does not prioritize exact matches. The reason you see the behavior in Ivy and Selectrum is because those frameworks implement it specifically, irrespective of the sorting function in use. I would be fine with a pull request that adds the option to prioritize the exact match directly in |
Do you have a rough idea what needs to be changed in prescient? |
You'd want to start by adding a new user option to toggle the behavior. You'd probably want to port something like (defun selectrum--move-to-front-destructive (elt lst)
"Move all instances of ELT to front of LST, if present.
Make comparisons using `equal'. Modify the input list
destructively and return the modified list."
(let* ((elts nil)
;; All problems in computer science are solved by an
;; additional layer of indirection.
(lst (cons (make-symbol "dummy") lst))
(link lst))
(while (cdr link)
(if (equal elt (cadr link))
(progn
(push (cadr link) elts)
(setcdr link (cddr link)))
(setq link (cdr link))))
(nconc (nreverse elts) (cdr lst)))) which is what Selectrum uses to implement the same functionality. Because of the performance optimization in It might be simpler to implement this at the Company level, to be honest, or perhaps just put it in |
Turns out company already has a |
It seems that prescient doesn't prioritize the exact match as vanilla ivy. I enabled both
ivy-prescient-mode
andprescient-persist-mode
. When I typeC-h f re-search-forward
, vanilla ivy selects the exact match, but prescient doesn't. Is this expected?Ivy (selectiong the second candidate):
Prescient (selecting the first candidate):
The text was updated successfully, but these errors were encountered: