cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
574 stars 7 forks source link

Cursive repl clj/cljs dropdown configuration #2902

Open maiq123 opened 1 month ago

maiq123 commented 1 month ago

Hi,

Just wanted to confirm if we can configure the clj/cljs dropdown in cursive repl to use custom port when cljs is selected?

image

Currently, I have to open a new server repl to connect to my shadow-cljs nrepl to evaluate cljs stuff and need to open a clj local repl for clj stuff. I was wondering if its possible to define some config so if cljs is selected, my local repl automatically connects to that shadow-cljs nrepl or maybe not connect to shadow-cljs repl but I still can somehow evaluate cljs stuff in local repl? Right now when I run (:require 'some.core) where some.core is a .cljs it runs but the repl doesn't gets changed to cljs and it doesn't let me run any js/command either.

I'd appreciate if someone can help.

cursive-ide commented 1 month ago

That dropdown doesn't do anything like connecting to a new REPL. All it does is tell Cursive: this REPL is currently a CLJS (or CLJ) REPL. Cursive will try to switch automatically based on what it sees in the output, but it can't know about all the different ways of switching REPLs from CLJ to CLJS and back, so that's there for manual switching when required.

maiq123 commented 1 month ago

Thanks for getting back, So as you said it can automatically switch when running clj or cljs command, does that mean it can do that in a same repl tab? or it has to be a different tab for cljs? In my scenario, I had a backend clojure application and I used to run local repl for that and it works fine. Now I'm adding a frontend for that app which is in a same project so src/clj and src/cljs. but the local repl doesn't run for cljs commands even after when I manually switch it to cljs so I have to open another server repl tab which connects to shadow-cljs repl. Do you know if I can also run cljs commands in the same local repl by either by specifying a port in project.clj or using some middleware or something? I'd appreciate your help.