This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-31
Channels
- # babashka (23)
- # beginners (65)
- # calva (126)
- # cider (23)
- # clj-kondo (10)
- # clojure (41)
- # clojure-europe (5)
- # clojure-nl (2)
- # clojure-uk (6)
- # clojurescript (78)
- # contributions-welcome (1)
- # datomic (9)
- # events (1)
- # graalvm (2)
- # meander (10)
- # off-topic (81)
- # pathom (5)
- # shadow-cljs (3)
- # spacemacs (6)
- # vim (3)
- # xtdb (4)
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 = [email protected], 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?
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).
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!
It turns out I spoke too soon on this. The minimal node version worked for me, but when I tried to do it with the fulcro project using a browser repl, I still couldn't get the cljs window to associate with the cljs repl. I ended up finding two things that get it to work:
1. use the repl type shadow-select
(not positive this was a requirement, but I'm tired of testing)
2. I was using evil-window-left
/`evil-window-right` to switch between the cljs file and cljs repl, but that will not associate them. I had to be in the cljs repl and use cider-switch-to-last-clojure-buffer
to make cider-switch-to-repl-buffer
associate correctly.
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.
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
It turns out I spoke too soon on this. The minimal node version worked for me, but when I tried to do it with the fulcro project using a browser repl, I still couldn't get the cljs window to associate with the cljs repl. I ended up finding two things that get it to work:
1. use the repl type shadow-select
(not positive this was a requirement, but I'm tired of testing)
2. I was using evil-window-left
/`evil-window-right` to switch between the cljs file and cljs repl, but that will not associate them. I had to be in the cljs repl and use cider-switch-to-last-clojure-buffer
to make cider-switch-to-repl-buffer
associate correctly.