cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
2021-01-31T04:23:32.108800Z

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)

dpsutton 2021-01-31T04:24:31.109400Z

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?

dpsutton 2021-01-31T04:25:13.109600Z

https://github.com/clojure-emacs/cider/issues/2946

2021-01-31T04:25:42.110200Z

Nope, it still doesn't work when I do that.

2021-01-31T04:26:59.111100Z

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).

dpsutton 2021-01-31T04:29:23.111500Z

ah ok. interesting. let me see if i can repro

dpsutton 2021-01-31T04:32:52.111800Z

hmm. works for me.

dpsutton 2021-01-31T04:33:19.112200Z

think you can put up a simple repro and create an issue? tinies thing possible

dpsutton 2021-01-31T04:33:29.112500Z

and have you updated to most recent CIDER?

2021-01-31T04:33:54.112900Z

I updated today.

dpsutton 2021-01-31T04:34:07.113100Z

any chance you're dealing with docker stuff? is the shadow server local?

2021-01-31T04:35:12.113900Z

Nope, no docker. I realized I haven't restarted emacs in a while...trying that.

đź‘Ť 1
2021-01-31T04:40:07.115500Z

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.

2021-01-31T05:25:08.118Z

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"

dpsutton 2021-01-31T05:42:27.122500Z

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 repl

dpsutton 2021-01-31T05:43:17.123300Z

so 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?

2021-01-31T13:14:20.124200Z

omg that worked! I'm shocked that you have to start three separate proceses. Thank you so much for your help, @dpsutton!

dpsutton 2021-01-31T16:36:50.127Z

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.

đź‘Ť 1
thheller 2021-02-01T09:29:06.128100Z

watch app will start an implicit server if none is running

thheller 2021-02-01T09:29:31.128300Z

the benefit of separate server is that you can at any point stop and restart the watch without fully restarting the server

thheller 2021-02-01T09:30:14.128500Z

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

dpsutton 2021-02-01T14:35:44.130700Z

Thanks! I didn’t want to ping you and drag you into tooling centric discussions. That’s awesome you commented. Appreciated