Closed tomgr closed 6 years ago
The problem is the client is expected to perform filtering. In the past we just called the language server every keypress and some of them took the current word into consideration and others did not. Those that did also were often unusably slow.
If the language server wants to compute the results itself every time it can set IsIncomplete
to true
on the response it gives to indicate that.
Ok that makes sense, thanks.
It does seem odd that the completions are different if you ask for completions after x =
vs x =<space>
. Looking at the code, maybe filter should only be called if request.prefix
contains some non-whitespace characters? With clangd running on C++ code, filter is being called with request.prefix
set to a single space whenever you ask for completions with whitespace after an equals sign.
I don't disagree - personally I think the language server should return all the results and we shouldn't do any client filtering for the best experience but alas the spec and server authors disagree - primarily because of performance I believe.
We could definitely improve the filtering trigger to consider more whitespace - you want to send a PR?
At the moment it seems that the completion results are filtered by fuzzaldrin in many cases. This produces some peculiar code completions in many cases, as fuzzaldrin uses a completely different scoring system to the language server. This can be observed when using clangd as the language server: if you manually ask for completions immediately after a
=
then you get back a very useful list of suggestions (i.e. local variables of the correct type, etc); If instead you ask for completions with a space after=
, then you get back a list of mostly useless suggestions with the useful ones actually filtered out (i.e. typically for me I get back suggestions oflog/sin/exp
).It seems odd to me to be using fuzzaldrin at all if the server was asked to provide completions as the server should know best what the ranking is. It is certainly very odd to be doing filtering using fuzzaldrin as fuzzaldrin has no way of knowing whether what it filtered out was impossible at this point or not.
Could this behaviour be changed? I can think of a few possibilities:
sortText
value (indicating the server has done filtering+ranking).