Fork me on GitHub
#lsp
<
2022-01-13
>
Lukas Domagala13:01:28

I’ve just tried “Show call hierarchy” in calva and it returns every dependency twice. Do you think thats a problem with lsp or calva?

Phillip Mates13:01:55

I've seen duplicate info for lsp functionality when in .cljc files (analysis returns info for both cljs and clj). What type of clojure file are you in?

ericdallo13:01:34

good point, if possible to build a simple repro, it'd help

Lukas Domagala16:01:19

ah you are totally correct, it’s happening with any cljc file. So in that case calva probably should tell lsp if it wants the clj or cljs references

Lukas Domagala17:01:40

btw repo is basically any defn in a cljc file, so:

(defn i []
  (inc 1))
has a reference to clojure.core/inc and cljs.core/inc

ericdallo17:01:44

this is likely to be a clojure-lsp bug

ericdallo22:01:12

it's a clojure-lsp issue, not sure what would be the best approach to solve though, if we should consider only one of those like the clojure one not the cljs one

Lukas Domagala11:01:16

I think returning both is a good default since LSP has no way of knowing the compiler env. In the Calva integration the env could be passed in so only the “right” deps get returned

ericdallo12:01:46

yeah, there is no way calva can change that behavior I think, the best would be to make clojure-lsp return the correct one if there is any way to know which one return

ericdallo12:01:19

Also, remeber that clojure-lsp is used in a lot of other editors, if we make some calva specific code, we need to do that on other editors as well

Lukas Domagala12:01:52

yeah, I haven’t looked at the lsp-calva link yet, but I was thinking lsp could provide an optional setEnv api or similar to all editors. So anytime I switch from cljs <-> clj it would tell LSP. If it’s not set it just assumes both like it does now. I think this might also be helpful other analysis in LSP. If it’s just the hierarchy thing it might be overkill.

ericdallo14:01:46

yeah, until now there was no case AFAIK that could cause issues like this one, maybe worth checking if there is other cases like this one