coq_nvim icon indicating copy to clipboard operation
coq_nvim copied to clipboard

Completion ordering by client

Open ioreshnikov opened this issue 2 years ago • 0 comments

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 avatar Mar 27 '22 16:03 ioreshnikov