calva

andrea 2025-06-21T09:49:51.908279Z

I have two separate cljs packages on the same project. (one for the client, and one for a server on node) They spawn two repls (`:app` and :server) and come from two different paths. How can I make calva switch to the repl when I switch file? It works ok on some other project with clj for the server (but there there's a single shadowcljs running, here I need to run the server with node ... so it's a diff binary running) but for this node one I couldn't manage.

pez 2025-06-21T10:22:08.074719Z

There are two layers to this. One is that Calva only really allows one Clojure REPL from which it spawns/clones the the ClojureScript REPL. Is there a way you can solve this by having one shadow-cljs.edn with two builds? If so we reach the second layer of the problem. While Calva allows you to switch between shadow-cljs builds, there is nothing built-in to do this automatically. We could consider adding that to Calva. It can also be solved using #joyride (I am not 100%, it will depend on if we have made the switch build command correctly, but otherwise we can fix that).

andrea 2025-06-21T10:55:05.894379Z

I do have a single shadowcljs with two builds. Not sure whether the two repls run from a single shadowcljs command or one of them runs from the node ... command (I'm investing this in #shadow-cljs). According to thomas there's a way to switch from within shadow but not sure how that's done from within Calva. https://clojurians.slack.com/archives/C6N245JGG/p1750503040801269?thread_ts=1750500033.847539&cid=C6N245JGG I confirm I can switch from the toggle at the bottom of the IDE, just not automatically upon navigation. If you could share some pointers I'd be happy to take a stab at how to implement something that does it automatically

pez 2025-06-21T11:08:18.267009Z

I now checked the Calva code for this out a bit. Currently it is not possible to automate build switching in a meaningful way. It is all super complected with a lot of other things. It’s probably possible to decomplect things enough to support a path based auto-switching, and we would need to start there. If you are willing to work in these messy parts of the Calva code, I would welcome help to implement this feature. Otherwise, an issue would be welcome about supporting auto-cljs-build-switching, and at some point I will get to it. There are some more shadow-cljs API support things we need to add to, and I hope to find some time to focus on it. But no ETA whatsoever on this.

andrea 2025-06-21T11:22:41.840839Z

I've opened an issue at https://github.com/BetterThanTomorrow/calva/issues/2866 It'd an ambitious first contribution 🙂 If you can put some of the pointers about that complection and entry points I may be able to take a stab at it before you do.

pez 2025-06-21T11:26:57.478779Z

Thanks for the issue. If you like we can have a look at the code together, using the huddle feature here on slack. I have some time right now.

❤️ 1
pez 2025-06-21T11:29:03.989789Z

Agree it is not exactly the good-first-issue kind of material. 😃 But also, I think if we don’t have the ambition to clean the ClojureScript connect system up completely, we can probably find some minimum refactor and get the feature in without piling on the tech debt.

andrea 2025-06-21T11:31:18.902839Z

Yes would love to