Fork me on GitHub
#calva
<
2018-11-29
>
mateus.pimentel.w14: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.

mateus.pimentel.w15: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

mateus.pimentel.w15: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?

mateus.pimentel.w15:11:47

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

pez15:11:12

Are you using lein?

mateus.pimentel.w15:11:18

i think it is 0.18.0

mateus.pimentel.w15: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…

mateus.pimentel.w15: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.

mateus.pimentel.w15:11:51

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

mateus.pimentel.w15: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))

mateus.pimentel.w15:11:30

i was starting it with lein figwheel dev

pez15:11:47

Does it start without you getting that error back?

mateus.pimentel.w16:11:25

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

mateus.pimentel.w16: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?

mateus.pimentel.w16:11:12

An illegal reflection operation

mateus.pimentel.w16:11:19

and that error down there

mateus.pimentel.w16: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.

pez16:11:12

Did you put the nrepl dependency in?

mateus.pimentel.w16: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?

mateus.pimentel.w16:11:37

i actually only have project.clj

pez16:11:53

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

mateus.pimentel.w16:11:00

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

mateus.pimentel.w16:11:11

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

mateus.pimentel.w16:11:25

so i can see how it is like

pez16:11:45

lein new reagent should work.

mateus.pimentel.w17: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

mateus.pimentel.w17:11:28

gonna try with lein new reagent

mateus.pimentel.w17: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.

mateus.pimentel.w17:11:41

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

mateus.pimentel.w17:11:19

I think maybe it’s something on my computer

mateus.pimentel.w17: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?

mateus.pimentel.w17:11:42

i think there is no profiles.clj atm

mateus.pimentel.w17: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]}}}

mateus.pimentel.w17:11:24

should i modify project.clj?

mateus.pimentel.w17: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.

mateus.pimentel.w17:11:37

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

mateus.pimentel.w17:11:43

i was trying to find them in the folder

pez17:11:25

.m2 in your home directory.

mateus.pimentel.w17:11:05

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

pez17:11:26

Yeah, do it.

mateus.pimentel.w17:11:04

still getting the error 🤔

mateus.pimentel.w17: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.

mateus.pimentel.w18:11:10

i realized i forgot how to mess with docker containers

mateus.pimentel.w18:11:14

so i’m using my linux vm instead

mateus.pimentel.w18:11:24

waiting for the deps to be installed

pez18:11:12

You are a guy with patience.

mateus.pimentel.w18:11:44

hahaha xD , i really want to have this working

mateus.pimentel.w18:11:00

i’m even thinking about contributing to the extension development

mateus.pimentel.w18:11:19

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

mateus.pimentel.w18:11:41

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

mateus.pimentel.w18:11:46

i just downloaded lein from the official website

mateus.pimentel.w18:11:07

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

mateus.pimentel.w18:11:22

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

mateus.pimentel.w18:11:42

cd app && lein repl

mateus.pimentel.w18:11:52

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

mateus.pimentel.w18: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.

mateus.pimentel.w19: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)

mateus.pimentel.w19:11:38

nice, i have to learn how to do that

mateus.pimentel.w19:11:17

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

mateus.pimentel.w19:11:26

when i get it working heh

pez19:11:59

What does your profiles.clj look like now?

mateus.pimentel.w19:11:03

i don’t have one atm

mateus.pimentel.w19:11:13

but this was from the idg-code-night

mateus.pimentel.w19:11:49

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

mateus.pimentel.w19:11:54

but i removed it for now

mateus.pimentel.w19:11:46

i think that maybe i messed up some stuff

mateus.pimentel.w19:11:05

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

mateus.pimentel.w19:11:22

i’m going to continue this tomorrow hehe

mateus.pimentel.w19:11:46

thanks for helping tho,

mateus.pimentel.w19: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.