Fork me on GitHub
#calva
<
2020-03-15
>
Jaime Sangcap15:03:39

Hello. Is there a way for calva to run and connect to cljs repl in deps.edn setup? I have this below setup

{:deps {}
 
 :paths ["src"]
 
 :aliases 
 {:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.6.0"}
                       cider/piggieback {:mvn/version "0.4.2"}}
          :main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.piggieback/wrap-cljs-repl]"]}}}
Running in terminal clj -R:nrepl works. But how to run it in vscode calva

Jaime Sangcap15:03:14

I;m getting this error, when sending evaluation to repl (ctrl + alt + c, ctrl + alt + e)

pez15:03:30

@jaime.sangcap, Use Jack-in and choose the Clojure CLI option. Do not choose an alias.

pez15:03:55

Not sure it will fix that error though... please let me know how you fare.

Jaime Sangcap15:03:52

It can connect and go to namespace. But it seems like it does not load the file.

Jaime Sangcap15:03:06

Will it work with .cljs files?

pez16:03:49

It doesn't load the file automatically. There is a command for that. (And can be configured to do it on save as well.)

pez16:03:36

Yes, Calva works with cljs files as well. As long as you tell Calva that at jack-in.

Jaime Sangcap16:03:14

I think what I was missing is step 1 & 2 From calva docs

A Clojure nREPL connection needs to be established. We've covered that above. Calva makes an nREPL session clone to use for the ClojureScript REPL and then:
1. Your ClojureScript app needs to be compiled.
2. Your ClojureScript app needs to be started.
3. The Clojure nREPL session needs to be promoted to a ClojureScript nREPL session. (This is what piggieback helps with.)

pez21:03:03

Are you getting it to work, @jaime.sangcap? I'm off to bed now, but will check for questions first thing tomorrow and also there are others in this channel who are in a more awake TZ. 😃

Jaime Sangcap06:03:44

@U0ETXRFEW thanks 😄 I still can't get it to work. I'm still confused how repl works. I'm doing some reading now in calva docs and clojurescript. I will get back here if I failed to make it work 😆

pez06:03:03

It could be something with your project. Is Leiningen an opion for you? It's easier to set up a project from scratch there. Then we can isolate the problem easier when we try wit tools.deps.

Jaime Sangcap11:03:06

Actually I'm doing it only for learning purpose. My goal is to have minimum files required to run a cljs repl using clojure cli (deps.edn). Right now I only have one core.cljs file and deps.edn When using lein, there are a lot of files and dependencies involved and I'm confused what does what.

Jaime Sangcap11:03:24

Is this setup possible? and how to do it?

pez13:03:37

I'm not sure what the minimal setup is. You'll need something that compiles cljs. And Calva needs an nrepl server.

Jaime Sangcap17:03:13

oh alright, seems not for beginners, I'll park this for now. I guess I'll just use shadow-cljs. Thanks a lot 😄

pez18:03:50

Shadow is awesome. I don't think it is super complicated. You could ask on Clojureverse. What is the minimal http://tools.deps, cljs setup with support for Cider (and therefore Calva). I am also curious now. 😎

Jaime Sangcap20:03:47

😁 I uploaded a repo https://github.com/jaimesangcap/etudes-clojurescript That repo contains only core.cljs & deps.edn (thinking its the minimum required). I'm trying to connect with repl and evaluate form using calva. But getting some errors (see readme)