Fork me on GitHub
#calva
<
2021-11-06
>
grumplet12:11:57

Is anyone using Calva with Fulcro? And if so, do you know of a recommended setup which improves code navigation?

pez13:11:34

What are you missing from the navigation?

grumplet09:11:58

Here’s one example. Looking at it now it may be due to a clj-kondo misconfiguration somewhere. Though it does have some words about Fulcro there.

grumplet09:11:32

So obviously it can’t do things like ‘find refs to PlaceHolderImage’ because that s showing as an undefined symbol.

grumplet09:11:17

…. it must be my clj-kondo config…

grumplet09:11:05

Sorry - yes it was exactly that - I had the config.edn telling clj-kondo to use the com.fulcrologic/fulcro config inside the com.fulcrologic folder instead of inside the .clj-kondo folder.

pez09:11:49

Awesome. Cab you share how you set it up? Thinking we should have a page about using Calva with Fulcro in the spirit of some of the other using Calva with X pages there.

❤️ 2
🙏 1
grumplet10:11:46

I seem to have ended up with this though …. gist to follow.

grumplet14:11:08

@U0ETXRFEW @U0522TWDA I’ve updated the gist again (fingers crossed) testing against @U0522TWDA’s Fulcro course materials at https://github.com/holyjak/fulcro-intro-wshop. It gets rid of clj-kondo redness apart from a couple of places in src/holyjak/fulcro_exercises/puzzles where the toggle-color mutation is called with no args and clj-kondo wants 1.

grumplet14:11:00

@U0522TWDA - I’m really appreciating going through this material - it’s excellent. And its one of the few good examples I’ve found so far that gives good Calva instructions.

❤️ 1
Jakub Holý (HolyJak)14:11:50

Happy to hear that! Kudos for Calva instructions go to Peter :-)

grumplet14:11:52

I thought he may have had a hand! It got me over the bit that kept tripping me up - working with both a clj and cljs repl.

Jakub Holý (HolyJak)14:11:54

The problem with the assertion arity is that it differ in cljs and Clj and kondo doesn't understand which one applies there :(

grumplet14:11:10

Yep - that makes sense.

grumplet14:11:07

One problem I had to fix in the course repo was the .clj-kondo directory structure. Something seemed to be at the wrong level. I ended up with:

.clj-kondo
├── com
│   └── fulcrologic
│       └── fulcro
│           └── clj_kondo_hooks.clj
├── com.wsscode
│   ├── async
│   │   └── config.edn
│   └── pathom
│       └── config.edn
└── config.edn

Jakub Holý (HolyJak)14:11:29

FYI fulcro now has kondo config baked in and you can use kondo CLI to import it into your project. Though it might need some improvements :) @U0ETXRFEW Would it make sense to detect that a project's dependencies have kondo config to import and offer to do that (and open the config file with the kondo's output instructing what to add there)?

Jakub Holý (HolyJak)14:11:20

It seems weird you would have to change the dir structure...

grumplet14:11:00

I’ll go check again what it was before I messed with it…

grumplet14:11:27

You have

.
├── com.fulcrologic
│   └── fulcro
│       ├── com
│       │   └── fulcrologic
│       │       └── fulcro
│       │           └── clj_kondo_hooks.clj
│       └── config.edn
└── com.wsscode
    ├── async
    │   └── config.edn
    └── pathom
        └── config.edn

grumplet14:11:07

@U0522TWDA So it may be me misconfiguring .clj-kondo/config.edn

👍 1
pez14:11:41

Maybe what makes most sense is that clj-kondo picks all these drugs up and merges them in some predictable order? WDYT, @U04V15CAJ ?

grumplet15:11:30

I’m probably not understanding what’s necessary in .clj-kondo/config.edn. From the docs I’d expect it to need {:config-paths [“com.filcrologic/fulcro” “com.wsscode/async” “com.wsscode/pathom”]} to connect up. That doesn’t work for me but my gist does.

grumplet15:11:49

@U0522TWDA @U0ETXRFEW. Grrrr stupid typo was the problem! filcrologic in that config.edn

👍 1
Jakub Holý (HolyJak)15:11:25

@U0YBFTSLS does the kondo config that comes with Fulcro work for you? If not, could you be so kind and submit a PR to improve it? See https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#importing for importing the default one.

grumplet15:11:28

Your course repo now works for me

🎉 1
borkdude19:11:02

This is a long thread and I may have missed some points. Is everything solved now? The clj-kondo/config repo is probably stale concerning fulcro and I should remove those in favor of fulcros own config

pez08:11:14

@U04V15CAJ this is what I was referring to: > FYI fulcro now has kondo config baked in and you can use kondo CLI to import it into your project. > Would it make sense to detect that a project’s dependencies have kondo config to import and offer to do that (and open the config file with the kondo’s output instructing what to add there)? I wonder… if the project has kondo config baked in, can clj-kondo pick the config up there w/o the user having to import anything?

borkdude09:11:12

@U0ETXRFEW Right now no. clj-kondo could do this, but I've chosen not to since a config may contain mistakes and then clj-kondo would not work, etc. so the selection of configs is explicit instead of implicit

pez10:11:20

Yeah, I actually spoke with less thinking than usual. Fulcro is a library. … I was thinking about the case where the project would have kondo config in its deps.edn.

tbrooke15:11:37

I am getting the following message but I am not sure where the Calva Connection log it - I see the Calva Output window but not a log file — everything compiles fine with a browser build but the repl can’t connect Connecting cljs repl: shadow-cljs... ; The Calva Connection Log might have more connection progress information. ; Error while connecting cljs REPL: TypeError: Cannot read property 'search' of undefined

pez16:11:11

It's an output channel in vs code. What project type are you selecting when connecting?

tbrooke16:11:03

shadow-cljs

tbrooke16:11:10

:builds {:frontend {:target :browser :modules {:main {:init-fn accord-cljs.core/init}} :compiler-options {:optimizations :none}}}}