Closed anonimitoraf closed 2 years ago
@kiennq or @yyoncho do you know why this happens?
I did short debug session on that and I was unable to find out the reason. I confirm the issue is happening only with Clojure, it works fine with the other servers I tested with.
@yyoncho odd, the request is being made correctly to the server?
I don't see requests at all.
Got it, so indeed lsp-mode is not requesting for some reason, really curious
most likely it is related to prefix calculation, @kiennq knows much better than me on that.
Hey @yyoncho @ericdallo thanks for giving this a glance
I can also check it out, any good starting points? Files to look at, for example
@anonimitoraf thank you for the interest but for this particular issue I believe that @kiennq is the best person to investigate because the completion code is not very intuitive due to the complexity of the emacs completion-at-point
facilities. But still, if you want to give it a try - start from lsp-completion-at-point
.
@anonimitoraf Did it work if you set lsp-completion-no-cache
to t
?
@kiennq I see. Yes with lsp-completion-no-cache
set to t
, company-min-length
of 1 works :D
Although with company-min-length
of 0, it only pops up after I've typed a letter or 2.
When I try to open up the completion box manually, it tells me "No completion found"
I'm thinking that while it might be nice to open up the completion box with 0 chars typed, for the sake of "discoverability", it sounds like this could potentially be inefficient (because: LOT of candidates)
Side question: Is setting lsp-completion-no-cache
to t
all the more inefficient? What happens when it is set to t
?
Also can you post the trace io log here?
Changing prefix-length
is working in my env though.
I would not recommend setting lsp-completion-no-cache
since it will not using cache, and will make the typing slower.
When I try to open up the completion box manually, it tells me "No completion found"
This seems to be clojure
language server limitation.
Setting min prefix length to 0
is not that different from 1
since company
will kick in only after you type something (means the length already >= 1
). Also some character is guarded and may not trigger company ((
for example), so with min length of 0
, the completion will be trigger likely after word separation characters (spaces) only.
Combine that with language server limitation, it will likely make you see no different at all.
Note that, just type (
and trigger the completion at point (manually, since it will not be triggered automaticially) will make server returns no result. That value will be cached and make the subsequence typing with same prefix at the same position will not query the language server. It's expected behavior.
Yeah, I can confirm server is not returning any results for a min length of 0
, this could be fixed on server side indeed :)
Fixed the completion with 0
length on server side @anonimitoraf :) https://github.com/clojure-lsp/clojure-lsp/commit/fac945d1d452295adeac04f768d1b37fea0f3e70
@ericdallo is there anything to address on the client side after your server fix?
I think the issue with the 1 length not working without change the cache on completion? Let me try it
I tested with company-prefix-length
of 1
and it worked when idle as expected
@kiennq Ah, I see. Makes sense.
And damn @ericdallo awesome. Thanks so much! I'll have a read through your commits out of curiosity
seems like this issue is already fixed.
Describe the bug Auto-completion when:
Set to 0 - doesn't suggest stuff Expected:
a/so
should suggestsome-variable
andsome-function
Set to 1 - same as when set to 0
Set to 2 - works
To Reproduce Sample project: https://github.com/anonimitoraf/issue-reproduction-clojure
Open
src/clojure_sandbox/core.clj
and with different values forcompany-minimum-prefix-length
, try to auto-complete(a/so)
Expected behavior
company-minimum-prefix-length
set to 0 or 1 should suggest auto-completion entriesWhich Language Server did you use clojure-lsp
OS 5.9.16-1-MANJARO (via
uname -r
)