Fork me on GitHub
#calva
<
2021-04-14
>
Faris07:04:09

Hi everyone, I have a question about something I read in the docs

Most importantly, make sure you have cider/cider-nrepl as a dependency, and cider.nrepl/cider-middleware as middleware loaded in your REPL
How do I check for cider-middleware? I’m not jacking in from Calva straight, I use the Connect to a running REPL server in the project command

pez09:04:50

@hewrin you can use the command Copy Jack-in Command to Clipboard to see how Calva starts the REPL. Then you can either start it in a similar way (I would, if the setup allows) or place those dependencies in your project.

pez09:04:58

Note to self: We should update the docs you refer to with info about this command.

Faris09:04:09

I got this from the Copy Jack-in Command

lein update-in :dependencies conj '[nrepl,"0.8.3"] '-- update-in :plugins conj '[cider/cider-nrepl,"0.25.10"] '-- update-in '[:repl-options,:nrepl-middleware] 'conj '["cider.nrepl/cider-middleware"] '-- with-profile +dev repl :headless
This means I have cider-middleware right?

pez10:04:43

It means you inject cider-middleware, but yes. 😃

pez10:04:46

Do you have any reasons to suspect you don’t have it? (Just curious about what got you to ask this.)

Faris14:04:10

Earlier debugging didn’t seem to work for me, but I think its because I ran the code that called the function I was trying to instrument from the browser and not sending it to the REPL, does the debugger only work when using it with the REPL?

pez15:04:48

I’m not sure. But I maybe you are running into the problem addressed here? https://clojurians.slack.com/archives/C0617A8PQ/p1618228902247400

pez15:04:05

You can try with that cider-nrepl version at least, and see if it works.

bringe17:04:53

@hewrin See this issue for info related to your question, and a possible solution. https://github.com/BetterThanTomorrow/calva/issues/1049

Faris07:04:02

I see, thanks for the help @U0ETXRFEW and @U9A1RLFNV!!

calva 6
flowthing11:04:27

I’m helping out a colleague getting started with Calva. The project uses Leiningen and shadow-cljs. I run “Connect to a Running REPL Server in the project”, start the web app, open it in the browser to establish the JS runtime, then run (shadow.cljs.devtools.api/repl :app). Then, if I try evaluating something from a ClojureScript buffer, nothing happens. I think Calva does not recognize that I’m in a ClojureScript buffer or some reason or something. What am I doing wrong?

flowthing11:04:03

The status bar says “nREPL <lightning emoji> clj”, not “cljs”, even though I have a ClojureScript file open.

pez11:04:00

@flowthing When you connect, do you get to select a project type? Calva needs to know that cljs is involved.

flowthing11:04:26

Yeah, I chose Leiningen, because if I choose Leiningen + shadow-cljs, I get this:

; Execution error (ExceptionInfo) at shadow.cljs.devtools.server.runtime/get-instance! (runtime.clj:11).
shadow-cljs has not been started yet!
In embedded mode you need to call (shadow.cljs.devtools.server/start!) to start it.

flowthing11:04:25

I do understand what that error means, but I'm not sure how to set up Calva such that I don't get that error and I get a ClojureScript REPL.

flowthing11:04:05

I suppose I could set up the project differently somehow, but I'd like it if I didn't have to do that.

pez15:04:45

I haven’t seen that error before… Full stack projects can be a bit troublesome to get going. I can think of two things to try: 1. For full stack: Use the lein-shadow plugin and then jack-in/connect to that project type. 2. ClojureScript only: Configure shadow-cljs to use leiningen for dependencies and select the shadow-cljs project type.

pez15:04:47

If you have some time right now, @flowthing, I can make a video call and we might be able to figure something out via screen sharing.

flowthing15:04:32

Thanks for the offer! Can’t do it right now (and I probably wouldn’t be allowed to), but I’ll give the pointers you gave me a try. Thanks!

pez15:04:21

Maybe it can help creating a Luminus project configured for Leinginen + shadow-cljs and see how it is wired. Last time I checked that, it worked well with Calva. There’s a video and some instructions here: https://calva.io/luminus/

alefeans17:04:37

I think i've asked this before, but just to check this again: isn't there any way to only show the evaluation results on the output.calva-repl window ?

pez17:04:37

There is no such option, @alefeans2

pez17:04:35

Wait. Maybe there is now. You can create custom command snippets that evaluate the current or top level forms, and bind those commands to the keys you want.

pez17:04:05

It will echo the evaluated form to the output window, though.