The Wayback Machine - https://web.archive.org/web/20220803130939/https://github.com/ms-jpq/coq_nvim/pull/473
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

Completion ordering by client #473

Open
wants to merge 3 commits into
base: coq
Choose a base branch
from
Open

Conversation

ioreshnikov
Copy link

@ioreshnikov ioreshnikov commented Mar 27, 2022

Hey!

This PR introduces an alternative way to order the completion results. This idea was already suggested by @elkowar in #92 and by me in #241. I've read the discussion in #92 and while I agree with you that giving unconditional preference to some clients is, generally speaking, not a good idea, I find that for the languages I personally use LSPs give me good enough suggestions that I would love to see them on top all the time. I've tried to play with the client weights, but no matter what I do I cannot achieve this.

This PR implements this unconditional client-based ranking approach -- aliased in the code as stratified -- as an alternative to the current one -- aliased as uniform. With stratified approach we first sort the completion results by client (using weight_adjust as the client priority) and then withing the client using all the metrics used before. The choice of a specific ranking strategy is determined by a new settings parameter ranking.

The implementation at the moment is a bit ad hoc and it can be properly generalized in future. Also, there are neither documentation nor tests for that change, but I will be happy to add them in case you decide to accept the PR.

ioreshnikov added 3 commits Mar 27, 2022
This commit introduces a new ranking algorithm: all the completion
candidates are first ranked by the weight of the client and only then
withing each specific client they are ranked according to a more
sophisticated metric.

This change allows one to have guaranteed consistent client ordering in the
completion results. This can be achieved simply by assigning appropriate
`weight_adjust` values to the clients. For example, setting
`weight_adjust = 2.0` next to the LSP client will guarantee that the LSP
results will be always on top.
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

Successfully merging this pull request may close these issues.

None yet

1 participant