Fork me on GitHub
#calva
<
2018-11-29
>
Whiskas14:11:31

Hey guys, is it possible to jump to a function’s definition when using Calva with clojurescript?

pez15:11:11

Hello, @mateus.pimentel.w, yes, as long as it is a Figwheel project you can. Something is preventing it to work in shadow-cljs, I don’t know what.

Whiskas15:11:34

I’m trying to make it work with fighweel

pez15:11:38

Are you asking because you have tried it and it didn’t work, or because

pez15:11:44

ah… you beat me to it

lilactown15:11:06

make sure you have cider in your dependencies

Whiskas15:11:30

then i removed the :nrepl-port as recommended in one git issue

pez15:11:41

Which version of cider/nrepl are you using?

Whiskas15:11:47

but now i don’t know which port to connect to nrepl xD

Whiskas15:11:48

let me see

pez15:11:12

Are you using lein?

Whiskas15:11:18

i think it is 0.18.0

Whiskas15:11:35

starting the repl with lein figwheel dev

pez15:11:57

Let me check what my profiles look like. brb

pez15:11:07

So, what I have found things can be a bit sensitive to the order they are referenced. And that error message looks like it could be about that.

pez15:11:31

Also, I don’ see nrepl in those dependencies…

Whiskas15:11:48

do you know what should i put there?

pez15:11:21

Which might not matter if you are using lein, but anyway, try putting [org.clojure/tools.nrepl "0.2.13"] between piggieback and sidecar.

Whiskas15:11:41

So, one thing

Whiskas15:11:51

it looks that that error goes away when i remove :nrepl-port

Whiskas15:11:31

and, when i remove nrepl-port, how do i know which port to connect to?

pez15:11:05

How do you start your repl?

pez15:11:28

If you start it using lein repl then leiningen will spit a .nrepl-ort file out which Calva then uses to automatically fill in the port.

pez15:11:41

Then you start Figwheel and the cljs repl like so:

$ (require '[figwheel-sidecar.repl-api :as figwheel])(figwheel/start-figwheel!)(figwheel/cljs-repl))

Whiskas15:11:30

i was starting it with lein figwheel dev

pez15:11:47

Does it start without you getting that error back?

Whiskas16:11:25

yeap, i’m gonna try it now, sorry i was seeing one thing on telegram

Whiskas16:11:30

i mean, it started, but i’m actually trying to figure out what happened, because other thing is appearing now

pez16:11:11

When do you get this error?

Whiskas16:11:12

An illegal reflection operation

Whiskas16:11:19

and that error down there

Whiskas16:11:47

i’m going to edit with the full call stack

pez16:11:18

That nil on line 47 looks funny.

pez16:11:14

It looks to still be something with piggieback.

Whiskas16:11:16

hahahah xD

pez16:11:12

Did you put the nrepl dependency in?

Whiskas16:11:06

gonna try it, do i also put it on :dev profile?

pez16:11:33

I think so. We could also try putting all this in your ~/.lein/profiles.clj instead, mostly to see if starts working then.

pez16:11:30

Wedge it in between piggieback and sidecar.

pez16:11:11

I’ll go a bit unresponsive now, because my kids need food. 😃

pez16:11:31

Never seen those warnings. Can you paste your entire project.clj here?

pez16:11:28

Also try with this in your profiles.clj:

:repl {:plugins [[cider/cider-nrepl "0.18.0"]
                  [lein-figwheel "0.5.17"]]
        :dependencies [[cider/piggieback "0.3.10"]
                       [org.clojure/tools.nrepl "0.2.13"]
                       [figwheel-sidecar "0.5.17"]]
        :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}

pez16:11:39

Do you have it configed in both the project and profiles.clj now?

Whiskas16:11:37

i actually only have project.clj

pez16:11:53

Wait. now you have the :repl {} stuff in your :prod profile.

Whiskas16:11:00

i started a new project with that lein template ( +cider ) to see if i can make the extension to work this way

Whiskas16:11:11

do you know any git repo with a project that works out of the box?

Whiskas16:11:25

so i can see how it is like

pez16:11:45

lein new reagent should work.

Whiskas17:11:08

i made this last one with lein new re-frame re-frame-app +garden +less +10x +cider +test +re-com +re-pressed +breaking-point +routes

Whiskas17:11:28

gonna try with lein new reagent

Whiskas17:11:35

should i add +cider on the reagent one?

pez17:11:52

I haven’t tried the re-frame template. It might have old cider configs.

pez17:11:17

Yes, +cider, I forgot about that.

pez17:11:37

I am sorry about how hard it is to get this working. It is on my todo-list to do what Cider does and help with injecting the dependencies that Calva needs.

Whiskas17:11:41

It’s alright, at least we have something good for VSCode

Whiskas17:11:19

I think maybe it’s something on my computer

Whiskas17:11:34

i tried the reagent template with cider out of the box

pez17:11:30

I made that template work out of the box (at least on my machine).

pez17:11:16

You get the same strange warnings and the same error regardless what we try.

pez17:11:01

There is one thing we haven’t tried yet, though, I think. I doubt it will work any better, but at least we should give it a shot.

pez17:11:07

It’s to put the :repl map in your profiles.clj. That’s where I have these deps on my machine.

pez17:11:52

That’s actually where there could lurk something funny. What is in your profiles.clj now?

Whiskas17:11:42

i think there is no profiles.clj atm

Whiskas17:11:34

should i put it on root?

pez17:11:11

Are you on a Mac or Linux box?

pez17:11:50

Cool, then in ~/.lein/profiles.clj

pez17:11:28

Put this in there:

{:repl {:plugins [[cider/cider-nrepl "0.18.0"]
                  [lein-figwheel "0.5.17"]]
        :dependencies [[cider/piggieback "0.3.10"]
                       [org.clojure/tools.nrepl "0.2.13"]
                       [figwheel-sidecar "0.5.17"]]
        :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}

Whiskas17:11:24

should i modify project.clj?

Whiskas17:11:49

i think there is some problem with cider.piggieback

pez17:11:33

I think we should try with all this stuff removed from the project config.

pez17:11:27

You could try wiping piggieback from your local maven repo and have it downloaded again.

Whiskas17:11:37

just curious, i’m new to clojure in general. Where are these packages stored at?

Whiskas17:11:43

i was trying to find them in the folder

pez17:11:25

.m2 in your home directory.

Whiskas17:11:05

i’m gonna rm -rf .m2/cider/

pez17:11:26

Yeah, do it.

Whiskas17:11:04

still getting the error :thinking_face:

Whiskas17:11:22

gonna try to run it on a docker container to see if it works

pez18:11:20

I'm curious how it works out.

Whiskas18:11:10

i realized i forgot how to mess with docker containers

Whiskas18:11:14

so i’m using my linux vm instead

Whiskas18:11:24

waiting for the deps to be installed

pez18:11:12

You are a guy with patience.

Whiskas18:11:44

hahaha xD , i really want to have this working

Whiskas18:11:00

i’m even thinking about contributing to the extension development

Whiskas18:11:19

so, it looks that the problem is not exclusive to my envrionment

Whiskas18:11:41

I tried it on a linux vm and the error happened again

Whiskas18:11:46

i just downloaded lein from the official website

Whiskas18:11:07

moved it to ~/bin ( which is on $PATH )

Whiskas18:11:22

then created a new project with lein new reagent app +cider

Whiskas18:11:42

cd app && lein repl

Whiskas18:11:52

(require '[figwheel-sidecar.repl-api :as figwheel])(figwheel/start-figwheel!)(figwheel/cljs-repl))

Whiskas18:11:11

maybe someone broke the cider package? ( even though it is versioned )

pez19:11:03

I will try it too.

pez19:11:50

I am trying it on my regular machine first. It is downloading a lot of stuff so that template has been updated.

pez19:11:31

Ha! I also get the strange error with the unmatched delimiter.

Whiskas19:11:03

So, probabbly if i use an older version of some dependency it may work?

pez19:11:09

Yes, my old test projects work. I’ll push a working one to github so you can test cloning that one.

pez19:11:53

It is just a test project I am using when hacking on Calva. But it starts without any compliants.

pez19:11:33

It also has a those figwheel-starting commands packed into one function (start)

Whiskas19:11:38

nice, i have to learn how to do that

Whiskas19:11:17

i will copy the way you implemented it to the other project

Whiskas19:11:26

when i get it working heh

Whiskas19:11:11

hmm :thinking_face:

pez19:11:59

What does your profiles.clj look like now?

Whiskas19:11:03

i don’t have one atm

Whiskas19:11:13

but this was from the idg-code-night

Whiskas19:11:49

i had one profiles.clj in the prototype project with the contents you described

Whiskas19:11:54

but i removed it for now

Whiskas19:11:46

i think that maybe i messed up some stuff

Whiskas19:11:05

and that’s why idf-code-night did not run

Whiskas19:11:22

i’m going to continue this tomorrow hehe

Whiskas19:11:46

thanks for helping tho,

Whiskas19:11:30

i believe i will have the extension working here at some point =P

pez19:11:46

That project is relying on that my profiles.clj contains the deps.

pez20:11:25

And this time try start things with lein clean && lein repl. When I did it without the clean, sometimes I got funny errors.