Fork me on GitHub
#lsp
<
2023-01-29
>
didibus01:01:32

Lsp seems to show defn- signature as just: defn-: ([name & decls]) which isn't super helpful. Cider shows the full set of possibilities, and so does lsp when for defn. I think Cider must have it as a special case, because defn- does have as signature name & decls, but Cider is smart enough to list out the same options as for defn

ericdallo14:01:53

Not sure I get it, do you have a example comparing cider and LSP?

didibus16:01:05

Cider shows: (defn- [name doc-string? attr-map? [params*] prepost-map? body])

didibus16:01:39

Lsp shows: (defn- [name & decls])

ericdallo16:01:49

LSP should show the same

ericdallo16:01:59

Oh, its because of multiple args right?

ericdallo16:01:06

There is a setting to show all inline

ericdallo16:01:05

:hover :arity-in-same-line?

didibus16:01:38

I'll try, but I'm not sure that's it. The signature of defn- is actually name & decls, but defn- just passes decls to defn. So it seems Cider has a special case where for defn- it'll show the same signature as defn

ericdallo16:01:27

Oh, I got it, you are complaining about the signature of defn- itself, I see... Clojure-lsp relies on the signature kondo analysis return, if they are not correct we should fix it in clj-kondo

didibus17:01:05

Right. And I mean, it is correct. But I guess Cider goes the extra mile and improves it even from the real one.

ericdallo17:01:51

@U04V15CAJ do you know what cider could be doing differently to present different arity for defn-? Maybe checking some metadata that kondo doesn't?

borkdude18:01:18

Don't know what CIDER does, but if you find out, let me know ;)

borkdude18:01:18

Oh I see:

user=> (:arglists (meta #'defn))
([name doc-string? attr-map? [params*] prepost-map? body] [name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?])

borkdude18:01:28

This is only for defn, not defn-

borkdude18:01:29

Ah yes, this can be fixed here: https://github.com/clj-kondo/clj-kondo/blob/a12898dea17740f03652ac925331da061dc461bb/src/clj_kondo/impl/overrides.clj#L7-L18 clj-kondo doesn't really analyze the bootstrapped way of how defn is defined and these overrides take care of that. You can file an issue and update it there and then it'll work

borkdude18:01:37

(although maybe clj-kondo should support (def ^{:arglists ...} ...) too

borkdude18:01:45

issue for both is welcome

ericdallo18:01:15

Nice, @U0K064KQV willing to open that issue on clj-kondo?

👍 2