Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
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 asuniform
. Withstratified
approach we first sort the completion results by client (usingweight_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 parameterranking
.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.