Fork me on GitHub
#cursive
<
2024-03-19
>
Marcel Krcah19:03:53

Trying to replicate https://twitter.com/ikitommi/status/1480215765143932931/photo/1, but cannot get the editor to play along: getting those "cannot be resolved" warnings + indentation seems off. evaluating in REPL indeed shows a pretty dev error + clj-kondo also warns correctly on invalid type (I have clojure-extras installed); so it's only those editor warnings & indentation. I must be missing something obvious. tried searching around slack and google, but couldn't find the answer. any ideas? thanks a lot.

cfleming19:03:59

I think you want to use Resolve As, see: https://cursive-ide.com/userguide/macros.html#customising-symbol-resolution. I believe the malli annotations are designed to look like Plumatic Schema’s, so you can resolve mx/defn as schema/defn and things should hopefully work.

Marcel Krcah20:03:31

hi @U0567Q30W thanks for the quick reply, that is great. I didn't know about those Resolve As. I tried it out and it solved the first warning, thanks. however, the args are still left with warnings, see the screenshot. i've noticed, btw, that .clj-kondo/metosin/malli/config.edn contains the following rules:

{:lint-as {malli.experimental/defn schema.core/defn}
 :linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}
which are followed when using clj-kondo from the command-line but not followed in the editor. sorry if a reason for this is obvious, I'm still trying to wrap my head around what is the role of cursive and clojure-extras in relation to these clj-kondo lib configurations.

cfleming20:03:25

So, Cursive doesn’t do anything with the clj-kondo config at the moment, they’re completely independent and use different mechanisms.

cfleming21:03:46

I’ll try to repro the argument problem in a moment.

cfleming23:03:39

I just tried this, and it works for me. I think you might have resolved mx/defn as the wrong defn. Here’s how I did it. I do the Resolve As on mx/defn:

cfleming23:03:04

Then I choose specify, since I don’t want standard defn:

cfleming23:03:31

Then I type defn and choose the schema one:

Marcel Krcah10:03:41

@U0567Q30W thanks a lot for looking into this. I indeed didn't enter the correct schema :face_palm: the code works now like a charm. Sorry for the noise and thanks for taking the time 🙏

👍 1