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

Different completion candidates in Corfu and Company #113

Closed
drcxd opened this issue May 26, 2022 · 2 comments
Closed

Different completion candidates in Corfu and Company #113

drcxd opened this issue May 26, 2022 · 2 comments

Comments

@drcxd
Copy link

drcxd commented May 26, 2022

I just tried Orderless with both Corfu and Company. I found that when prioritizing the orderless completion style, Corfu and Company returns different completion candidates.

For example, in the scratch buffer, when I typed

(lam

Company would return a list of candidates like these:

--anonymous-lambda
-lambda
ad-lambada-expression
ad-lambda-p
ad-lambdafy
byte-compile-check-lambda-list
...

It looks like the list is sorted alphabetically and lambda is near the end of the whole list.

However, when using Corfu, in the same situation, lambda is the first candidate. I think Corfu's behavior is the desired one. Any idea how could I fix this problem?

@oantolin
Copy link
Owner

Orderless does no sorting at all! Completion UIs (like Corfu and Company) can sort, and the underlying capf, in this case elisp-completion-at-point might do some sorting of their own.

  • A quick persual of elisp-completion-at-point suggests it does not provide either cycle-sort-function or display-sort-function metadata, so it's not sorting either.

  • Sorting in Corfu is configurable (see corfu-sort-function) and defaults to sorting first by length and breaking ties alphabetically.

  • I don't use company and don't have it installed, but a very superficial look at its repository suggests its sorting is configurable too, controlled by the variable company-transformers and defaults to alphabetical sorting.

So, I wouldn't say "I think Corfu's behavior is the desired one", probably it's more correct to say "Corfu and Company chose different defaults". If you find Corfu's default sorting better (I think I would), I suggest you set company-transformers to '(corfu-sort-length-alpha) (which I believe I should work). But also check out the other options Corfu and Company suggest, you may find a type of sorting you find even more useful. Company's company-sort-by-occurrence sounds pretty useful.

@minad
Copy link
Collaborator

minad commented May 26, 2022

However, when using Corfu, in the same situation, lambda is the first candidate. I think Corfu's behavior is the desired one. Any idea how could I fix this problem?

There is no problem - just use Corfu ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants