I'm trying to cider-connect-cljs
with a running shadow-cljs
repl. It connects and the repl works great. However, when I try to cider-switch-to-repl-buffer
in a cljs file in my project, I get this:
user-error: No cljs REPLs in current session "ti/fulcro-rad-demo:localhost:9000"
I've almost always used the jack-in method in the past, so I suspect there's something simple I'm missing here. Does anyone know what it might be?
(versions: emacs = 27.1, spacemacs = 0.300.0@27.1, cider = 1.1.0snapshot, shadow-cljs = 2.11.8)if you put your cursor in the cljs repl buffer and then back into your source buffer then cider-switch-to-repl-buffer
does it work?
Nope, it still doesn't work when I do that.
I saw that issue in the scrollback (you posted it). I figured it didn't apply since I only have the one repl running (which I should have mentioned).
ah ok. interesting. let me see if i can repro
hmm. works for me.
think you can put up a simple repro and create an issue? tinies thing possible
and have you updated to most recent CIDER?
I updated today.
any chance you're dealing with docker stuff? is the shadow server local?
Nope, no docker. I realized I haven't restarted emacs in a while...trying that.
No luck, same issue. I'm trying to play around with https://github.com/fulcrologic/fulcro-rad-demo. I've never used shadow before, but I could probably figure out how to set up a minimal cljs project. I doubt I'll get that done tonight though--it's getting late where I am.
Here's a pretty minimal setup: https://github.com/bmaddy/minimal-shadow-cljs-nodejs
I start it with yarn shadow-cljs watch app
and then run/choose the following in emacs:
cider-connect-cljs
localhost
9000
shadow
node-repl
cider-switch-to-repl-buffer
from the src/server/main.cljs
file gives me this:
user-error: No cljs REPLs in current session "2021/minimal-shadow-cljs-nodejs:localhost:9000"
ok. so i did two different ways: first way: cider-jack-in-clojurescript
1. cider-jack-in-clojurescript, choose shadow then the app build. run "node target/main.js" to get the repl up. When i was in the shadow-cljs.edn file i ran cider-switch-to-repl-buffer and was told there are no *clj* buffers. going to server/main.cljs and tried again and it worked.
The other way i tried:
npx shadow-cljs -d nrepl/nrepl:0.8.3 -d cider/piggieback:0.5.2 -d cider/cider-nrepl:0.25.8 server
npx shadow-cljs watch app # from another terminal
node target/main.js
cider-connect-cljs from main.cljs ns
cider-switch-to-repl-buffer
it worked
So i can get it to work both if i use cider-connect and also cider-jack-in. The one issue i can see that might be confusing is if your cursor (point) is in the shadow-cljs.edn file it complains that there are no clj buffers, as its assuming you want a clj repl (not cljs) when visiting an edn file. It really out to take the first available, or perhaps be smart enough that shadow is cljs really and just try that rather than the clj replso i suspect you are running m-x cider-switch-to-repl-buffer
from an edn file and not getting your repl. Have you tried from src/server/main.cljs
?
omg that worked! I'm shocked that you have to start three separate proceses. Thank you so much for your help, @dpsutton!
When running from the command line , thheller says the server is much faster. Then the watch command is far faster. So it’s kinda shadow that does or or two processes. As for node, there is always this process. You run the browser. That provides the js environment. It just feels different here but it’s not.
watch app
will start an implicit server if none is running
the benefit of separate server
is that you can at any point stop and restart the watch
without fully restarting the server
but otherwise you can just use watch
without a separate server too. it is just my workflow to only use server
and then do the rest from the UI or REPL
Thanks! I didn’t want to ping you and drag you into tooling centric discussions. That’s awesome you commented. Appreciated