Great to hear that Cursive could support malli! In current version, there is no global schema definition, like there is s/def
in spec. Instead, there can be multiple registries that are merged together, and one can build custom def
for registering schemas. So, atm, not sure where to goto.
there Will be a new ns with Plumatic style def
, defn
and fn.
Would be great if Cursive would handle those out-of-the-box, like the Plumatic ones. I'll ping @cfleming when the ns ships.
but, if you can cook up something for the goto-definition, I'm all ears :)
Also, happy to help with anything that could help, add stuff to malli to Make it easy to integrate to etc.
Does just resolving the custom def as s/def work?
the plumatic def is not about registering key->schema like the spec s/def,
but to define a value and the schema it represents, with eager validation: https://github.com/plumatic/schema/blob/master/src/cljx/schema/core.cljx#L1386-L1408
I think the goto would require a single global registry and a. custom def
to register key->schema into it. No such thing in malli right now.
I have some ideas for the goto nav. Not sure how sophisticated Cursive can be but there are signals in the AST that a keyword is part of a Malli schema e.g. {:registry foo} could be the start of a walk back to :map keywords
also https://github.com/metosin/malli/blob/master/test/malli/core_test.cljc#L1392-L1470
I would definitely add support now for Malli. What’s required?
awesome. initially just having the static analyzer understand when a keyword is defined in a Malli registry somewhere would allow you to provide the navigation that I desire
that said, registries in Malli are not global (one of the benefits) so it will need to handle multiple nav locations (much like “show usages”)
I’d defer to Tommi for the official answer to this. I’m pretty sure he uses Cursive too. Is that correct? @ikitommi
happy to provide some samples if you need/want them
I’ll check the Malli docs and let you know if I need more examples. If @ikitommi has worked around it using Resolve As… then it should be pretty easy to add.
I’d be interested in seeing some examples of where you’d like to see the navigation work. I’ve looked at the registry doc and it seems pretty open, so I’m not clear where the hooks for navigation should be.
sure. it’s probably fastest to look at some of my code so we can derive a few samples together. that work for you?
and should/would @ikitommi like to join? I think he might be on holiday atm
I can’t do tonight but could do tomorrow.
My yearly appreciation post cfleming - you're great, the product is great, enjoy your holidays!
Does anyone know if there is a way to eliminate "cannot be resolved" warnings for mount defstate
declarations (and their usages)?
@mkeller02 right click on defstate. select reslove as... select def.
Perfect! I had been trying to get some option by right-clicking where the warning showed on the name...whoops.
Thanks Emil, it’s much appreciated! I hope everyone has a good holiday season too.