Fork me on GitHub
#cider
<
2023-12-11
>
Felipe16:12:58

👋 I have a project for which I use jack-in for the clj REPL, cider-connect-cljs for the cljs one. I added (setq cider-merge-sessions 'project) for that to work but now it seems like my sessions are not isolated per project, i.e. in my advent-of-code REPL I get auto-connected to the work one and vice-versa. am I understanding that var wrong? I also don't get the difference between

Symbol 'host' combines all sessions of a project associated with the same host.
Symbol 'project' combines all sessions of a project.
what does host mean?

👀 1
1
vemv16:12:54

host is localhost, a given IP, DNS name, etc

👍 1
vemv16:12:59

cider-jack-in-clj&cljs might be your best bet if you don't wish to tinker much at the Sesman level. I use it all the time 🙂

Felipe16:12:45

yeah, the README for the project recommends booting the cljs REPL using a command line shortcut. I always blindly believed it was doing some more work in the background, but just dug and it seems not! let me try the double jack in

Felipe17:12:48

never mind. I now remember why I do that:

In the case of using separate config files for the clj and cljs dependencies (e.g. clj dependencies in deps.edn and cljs dependencies in shadow-cljs.edn) it is currently impossible to group those two repls in the same session. However, this can be worked around with cider-merge-sessions. Setting it to 'host will combine all sessions associated with the same host within a project. Setting it to 'project will combine all sessions in the same project.
in this particular project we use lein for clj, shadow through deps.edn for cljs

vemv17:12:40

You might not want to group those two repls in the same session anyway, let's see Are you working with .cljc files?

Felipe17:12:38

yes, but not frequently / I rarely eval stuff individually from those

Felipe17:12:03

so would be fine with a REPL for clj, another for cljs, no REPL for cljc

vemv17:12:18

So if you jack in once for clj, another time for cljs, each evaluation for a given .clj or .cljs buffer should be routed to the right repl if cider-merge-sessions is nil (default value) Is that not the case?

Felipe17:12:53

trying that now, but got The required namespace "devtools.preload" is not available. when doing cider-jack-in-cljs through emacs instead of connecting. let me see what's up with that

Felipe17:12:53

ah, I'm missing a profile

vemv17:12:11

Ok. Either way, cider-connect + cider-connect-cljs would be an equivalent experiement

Felipe17:12:54

what about cider-jack-in + cider-connect-cljs? wouldn't that work for some reason?

vemv17:12:27

should also work :)

Felipe17:12:30

I get a working REPL, but my buffer doesn't link to it

Felipe17:12:35

just saw a warning, though

Felipe17:12:52

WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it! (More information)
To quit, type: :cljs/quit
[:selected :dev]WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 3.10.0 and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.shadow.user> 

Felipe17:12:03

so let me try to fix that now

Felipe17:12:23

that was it! I'm connected to both REPLs now

Felipe17:12:42

thank you!

vemv17:12:40

Alright, happy to read that! cider If this doesn't work smoothly please raise an issue, this use case (.clj / .cljs files with no possible ambiguity) should be supported OOTB

cider 1
Felipe17:12:38

will do! thanks for the help 😄

vemv08:12:49

For completeness sake, as of lately you can choose a fixed destination for .cljc files - it's the cider-clojurec-eval-destination defcustom: https://docs.cider.mx/cider/cljs/up_and_running.html#working-with-cljc-files

👍 1
Felipe18:12:07

work yesterday and today has been much more enjoyable now that I can use two REPLs simultaneously. thanks again for the help!

🙌 1