-
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
Using in tandem with vertico and orderless #120
Comments
You can use You would also need a way to pass the chosen candidate to |
Such a hook does not exist in Vertico. You could probably use an advice on vertico-exit. However using Prescient with Vertico for sorting doesn't bring significant benefits since Vertico alreads sorts by history position out of the box (by recency, see vertico-sort-function and vertico-sort-override-function). In comparison, Prescient sorts by frecency which is only slightly better since a flexible completion style will narrow down the candidates quickly enough anyway. Prescient has to store its own history and doesn't distinguish the completion candidate types (#85). For filtering, the Orderless completion style is more flexible and faster than Prescient and Prescient is not a completion style (#54, #89). For these reasons I am critical of Prescient and didn't add specific support to Vertico and Corfu (#112). Nevertheless it should be possible to create a vertico-prescient integration package, which glues prescient-remember to Vertico. I also think that wrapping Prescient in a completion style should be possible. |
Yes, this is on my to-do list. |
Is there any advantage of Prescient filtering over Orderless filtering at this point? If something is missing in Orderless we could also add it there. Note that Orderless has a flexible matching style dispatcher mechanism which lets the user control the generated regular expressions per word. |
Off the top of my head, one thing that's unique to using Prescient with Selectrum is Other than that, I would have to try Orderless again. |
Completion styles can modify the sort function, e.g., combine some style-specific sorting with the sorting function provided by the UI, so I think one could implement this on top of the completion styles. But this sounds like an edge case feature. I like that Orderless stays completely out of sorting. |
|
corfu could also use a recency-based sort function.
Corfu already provides corfu-history for sorting by *recency*. Vertico
also sorts by *recency* by default. The difference of Prescient is that
Prescient factors in the frequency, such that we get an overall sorting
by *frecency*. I argue that sorting by *frecency* is not significantly
better than sorting by *recency* when quickly narrowing down to a
candidate. For recency-based sorting we can simply rely on the history
variable (e.g. the minibuffer history) and don't have to track the
frequencies and compute a decay. Therefore I prefer the simpler and more
predictable recency-based sorting which comes with Vertico/Corfu ootb.
|
Yep thanks, playing with corfu-history now. Not sure how I missed it. Sadly it doesn't work with cape-super-capfs, since that hard-overrides the sort-functions with |
Yep thanks, playing with corfu-history now. Not sure how I missed it. Sadly it doesn't work with cape-super-capfs, since that hard-overrides the sort-functions with `#'identity`, cutting `corfu-history` out of the loop. Some comments over on cape on that.
Yes, that's always the downside if completion tables specify a sort
function. We have the corfu-sort-override-function variable to override,
which can be useful in rare cases.
|
@okamsn just added a section to the vertico wiki, which explains how to use prescient sorting in vertico: https://github.com/minad/vertico/wiki#using-prescientel |
This completion style can optionally modify a completion table's metadata to use `prescient.el` sorting, including `prescient-sort-full-matches-first`. - Update the CHANGELOG. - Update the README. - Prescient changes: - Add faces `prescient-primary-highlight` and `prescient-secondary-highlight`. Add a function to apply them. - Add user options `prescient-highlight-completions` and `prescient-completion-enable-sort`. - Make `prescient-filter` work with completion tables by using `all-completions` instead of assuming lists. - `prescient-filter` now propertizes all returned candidates with the regexps prescient used and whether it ignored case. This is needed for sorting after filtering. - Add filtering functions `prescient-all-completions`, `prescient-try-completion`, which use `prescient-filter`. - Add sorting functions `prescient--completion-modify-sort`, `prescient-sort-full-matches-first`, and `prescient-completion-sort`. - Define a completion style `prescient` that uses those functions. - The completion style can modify unsorted tables to use `prescient-completion-sort`, which wraps `prescient-sort` and `prescient-sort-full-matches-first`. - This requires Emacs 27+. - This is off by default to more easily work with multiple completion UIs. Some UIs (such as Vertico and Corfu) allow setting the sorting function to use after filtering. Setting that option to the function `prescient-completion-sort` works and applies to the output of all completion styles and backends, not just `prescient`. - Selectrum Prescient changes: - Old faces are now aliases of the completion faces. - Since Selectrum seems to remove the text properties of candidates after filtering, we use a function `selectrum-prescient--refine` that combines `prescient-filter` with `prescient-sort-full-matches-first`. - Move `selectrum-prescient--highlight` into Prescient for the completion style as `prescient--highlight-matches`. Use that instead. - Company Prescient changes: - Change `company-prescient-transformer` so that uses `prescient-completion-sort` instead of just `prescient-sort`. This should allow for moving full matches when using CAPFs and will always at least do `prescient-sort`. See also the PR radian-software#125. For various discussions about implementing a `prescient` completion style, see also radian-software#125, radian-software#120, radian-software#112, radian-software#89, radian-software#58, and radian-software#54.
This completion style can optionally modify a completion table's metadata to use `prescient.el` sorting, including `prescient-sort-full-matches-first`. - Update the CHANGELOG. - Update the README. - Prescient changes: - Add faces `prescient-primary-highlight` and `prescient-secondary-highlight`. Add a function to apply them. - Add user options `prescient-highlight-completions` and `prescient-completion-enable-sort`. - Make `prescient-filter` work with completion tables by using `all-completions` instead of assuming lists. - `prescient-filter` now propertizes all returned candidates with the regexps prescient used and whether it ignored case. This is needed for sorting after filtering. - Add filtering functions `prescient-all-completions`, `prescient-try-completion`, which use `prescient-filter`. - Add sorting functions `prescient--completion-modify-sort`, `prescient-sort-full-matches-first`, and `prescient-completion-sort`. - Define a completion style `prescient` that uses those functions. - The completion style can modify unsorted tables to use `prescient-completion-sort`, which wraps `prescient-sort` and `prescient-sort-full-matches-first`. - This requires Emacs 27+. - This is off by default to more easily work with multiple completion UIs. Some UIs (such as Vertico and Corfu) allow setting the sorting function to use after filtering. Setting that option to the function `prescient-completion-sort` works and applies to the output of all completion styles and backends, not just `prescient`. - Selectrum Prescient changes: - Old faces are now aliases of the completion faces. - Since Selectrum seems to remove the text properties of candidates after filtering, we use a function `selectrum-prescient--refine` that combines `prescient-filter` with `prescient-sort-full-matches-first`. - Move `selectrum-prescient--highlight` into Prescient for the completion style as `prescient--highlight-matches`. Use that instead. - Company Prescient changes: - Change `company-prescient-transformer` so that uses `prescient-completion-sort` instead of just `prescient-sort`. This should allow for moving full matches when using CAPFs and will always at least do `prescient-sort`. See also the PR #125. For various discussions about implementing a `prescient` completion style, see also #125, #120, #112, #89, #58, and #54.
See also #131 for more Vertico/Prescient integration, but with Prescient for both filtering and sorting. |
Sorry if my question is a bit on the rambling side, but I'm new to this ecosystem (migrating from helm).
I use vertico and orderless. What I would like is to use prescient for the sorting capability only. vertico will still be the interface, and orderless will do the matching. Is this doable?
Thanks.
The text was updated successfully, but these errors were encountered: