Fork me on GitHub
#cider
<
2018-08-03
>
bozhidar05:08:41

Btw, not sure if I mentioned it here or not, but shadow-cljs also supports the new nREPL. We’re almost completely done. 🙂

dumrat06:08:22

Hi, how do I get two repls (clj, cljs) running with cider? (I'm using spacemacs).

bozhidar07:08:04

If you’re on 0.18 just do M-x cider and select clj&cljs from the prompt you’ll see.

dumrat09:08:14

Doesn't work for me

dumrat09:08:40

[nREPL] Direct connection to localhost:62698 established
error in process filter: user-error: Piggieback is not available.  See  for details
error in process filter: Piggieback is not available.  See  for details

dumrat09:08:50

I get this error or something like this always

dumrat09:08:08

I followed instructions

dumrat09:08:22

And doesn't work

manuel08:08:24

Is it possibile (maybe in .dir-locals.el) to specify a default build when the CLJS REPL is run with figwheel-main? Just to bypass the prompt

manuel08:08:15

ok, obviously you already thought of that: cider-figwheel-main-default-options. Thanks!

bozhidar09:08:59

Yep. A problem that solves it self. Sounds like a job for me! 😉

dumrat09:08:46

1. Reinstalled spacemacs 2. Freshly create project with luminus template 3. Try to run clj and cljs repl together 4. ERROR!!!

dumrat09:08:25

Exasperating

dumrat09:08:08

[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.13\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[refactor-nrepl\ \"2.4.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.18.0-SNAPSHOT\"\] -- repl :headless :host ::...
[nREPL] server started on 62773
[nREPL] Establishing direct connection to localhost:62773 ...
[nREPL] Direct connection to localhost:62773 established
[nREPL] Establishing direct connection to localhost:62773 ...
[nREPL] Direct connection to localhost:62773 established
error in process filter: user-error: Piggieback is not available.  See  for details
error in process filter: Piggieback is not available.  See  for details
mwheel-scroll: End of buffer [19 times]

dumrat09:08:33

Can someone help?

bozhidar09:08:53

I don’t see piggieback injected in the command line string you’ve shown, so I assume it’s not a dependency of your project as well.

dumrat09:08:40

[com.cemerick/piggieback "0.2.2"] inside dev profile

bozhidar09:08:50

Oh, that’s ancient.

bozhidar09:08:08

You should have cider/piggieback there.

bozhidar09:08:21

I think the current version is 0.3.8.

dumrat09:08:14

How about

:figwheel
  {:http-server-root "public"
   :nrepl-port 7002
   :css-dirs ["resources/public/css"]
   :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
instead of having :nrepl-middleware in repl-options?

dumrat09:08:23

Is that also an issue?

bozhidar09:08:38

It’s cider.piggieback/...

bozhidar09:08:42

When Chas handed us over the project we had to change the deployment coordinates.

dumrat09:08:03

Jeez, it's working now

dumrat09:08:46

Thanks @bozhidar very much. /\

bozhidar09:08:03

You’re welcome!

mikerod17:08:58

Is there anyway in lein to configure the middleware that is used by cider-nrepl - rather than just taking all the defaults? If so, can it not be accomplished via the plugin?

mikerod17:08:15

Pretty sure I have hit a problem with cider.nrepl.middleware.out/print-stream, which is in the wrap-out middleware. Using figwheel + piggieback, during a CLJS compilation pass, it looks like (resolve *out*) returns nil and I get a NullPointerException here - I think the bound *ns* is cljs.user at the time and potentially is why.

mikerod17:08:41

Anyways, that’s some more background, but in general, I am now just wondering about the configurability of the middleware that you get with cider-nrepl

devn17:08:52

hey, anyone here have a working org-babel setup with cider these days?

devn17:08:15

I have ob-clojure loaded up, and org installed via source, but it doesn't seem to be able to connect to CIDER

devn17:08:45

When I attempt to evaluate the code block, it says "Not connected" in the minibuffer

devn17:08:21

looks like there's a new package ob-clojure-literate

devn17:08:45

while i got it basically working, it seems to include nil in every result evaluated:

devn17:08:58

#+begin_src clojure :results value
(+ 1 4)
#+end_src

#+RESULTS:
: nil5

richiardiandrea18:08:04

today I learned this, for .dir-locals.el awesome!

((nil . ((projectile-grep-default-files . '("*.clj" "*.cljs" "*.cljc"))
         (cider-preferred-build-tool . "clojure-cli")
         (cider-default-cljs-repl . shadow-select)
         (cider-clojure-cli-global-options . "-A:test:dev")
         (mode . cider)))) <- super useful!

👍 4
bozhidar18:08:23

> Is there anyway in lein to configure the middleware that is used by cider-nrepl - rather than just taking all the defaults? If so, can it not be accomplished via the plugin?

bozhidar18:08:30

You’ll have to list all the middlewares you want to use in Lein’s repl options. You can use the plugin for this, as it generate options with all the middleware in it. 🙂 We can probably improve the plugin, but no one asked about this.

bozhidar18:08:14

Be sure to also report the bug you encountered. There’s also a config somewhere to disable this particular middleware as not everyone likes it. Don’t remember the exact name, though.

mikerod19:08:04

@bozhidar Ok, I wasn’t sure if I could list them all there. I was thinking it was a “whitelist” only thing and not a “blacklist” - meaning I have to list everything i want to leave 1 out. I haven’t seen anything about how to disable with-out middleware

mikerod19:08:09

as far as the bug, it’s complicated

mikerod19:08:50

I’m still hunting down a complete understanding, but there is an issue having resolve called during macroexpansion in CLJS compilation. The code was actually calling (.println System/out ^String s), but this middleware has System/out set to something that uses resolve. resolve results in nil, so there is a NPE due to it assuming (resolve *out*) won’t be nil in this with-out middleware.

reefersleep19:08:15

I’m trying to use CIDER more effectively. I just tried using cider-eval-last-sexp-and-replace, great functionality. However, when doing so in a CLJS file, using a function I’ve defined after starting the repl, I get

#object[TypeError TypeError: Cannot read property 'call' of undefined]

reefersleep19:08:57

This is regardless of whether I do cider-load-buffer beforehand.

reefersleep19:08:10

Oh, and the sexp gets replaced with nil.

reefersleep19:08:16

So, a sequence like this:

reefersleep19:08:10

;; This is my buffer initially
(defn add [x]
  (+ x 10))

(add 30)
;; If I do cider-eval-last-sexp-and-replace here, the sexp gets replaced by 40
;; Now I add a new function
(defn subtract [x]
  (- x 3))
;; and save the file, and do cider-load-buffer
(subtract 10)
;; If I do cider-eval-last-sexp-and-replace here, the sexp gets replaced by nil, and I get #object[TypeError TypeError: Cannot read property 'call' of undefined] in the repl

dpsutton19:08:16

I just tried (+ 1 1)| where | is point and i eval it and i got 2

dpsutton19:08:59

can you eval the expression you think should work in the repl?

dpsutton19:08:34

and did you eval subtract's definition?

dpsutton19:08:56

i just used your subtract definition and it works for me TM.

reefersleep19:08:13

If I eval the sexp calling subtract after calling cider-load-buffer, I get the same error and returning nil as the result.

reefersleep19:08:47

If I send the subtract definition to the repl first and then send the calling sexp, I get the correct behaviour.

reefersleep19:08:20

The implication is that for every sexp that I would like to call cider-eval-last-sexp-and-replace (or similar functionality), I would first need to send each of the vars involved to the repl… individually.

reefersleep19:08:31

Rather than just loading in all buffers to my repl.

dpsutton19:08:20

> f I eval the sexp calling subtract after calling cider-load-buffer, I get the same error and returning nil as the result. this is a bug here. that needs to be solved before anything else happens

dpsutton19:08:42

there's no sense in doing anything if you have undefined things after calling cider-load-buffer

reefersleep19:08:57

I thought it was related to the eval functionality only, but it’s a general problem. Hm.

dpsutton19:08:54

yeah. that's just things fundamentally not wired up correctly

dpsutton19:08:59

what kind of cljs repl are you using?

reefersleep20:08:53

I get no errors in my cljs repl when loading in the buffer, but I do get an error in the browser console

reefersleep20:08:58

Hadn’t noticed that

reefersleep20:08:04

It’s a Figwheel repl

reefersleep20:08:12

ioc_helpers.cljs?rel=1532007149410:42 Uncaught TypeError: goog.net.jsloader.load is not a function

dpsutton20:08:24

no idea. there is #figwheel and #figwheel-main if you want to ask questions

dpsutton20:08:44

i wish i could help you further but i think things are breaking before CIDER gets a chance to have a bug 🙂

reefersleep20:08:56

oh yeah, I think you’re right about that 🙂

mikerod20:08:48

@bozhidar > Be sure to also report the bug you encountered. There’s also a config somewhere to disable this particular middleware as not everyone likes it. Don’t remember the exact name, though. I did this https://github.com/clojure-emacs/cider-nrepl/issues/542

bozhidar20:08:54

@mikerod You’re looking for cider-redirect-server-output-to-repl.

bozhidar20:08:41

Middleware can only be whitelisted with lein, that’s true, but… This middleware has to be explicitly initialized when a connection is established and when this option is nil it won’t be initialized.

bozhidar20:08:05

And thanks for looking into the bug!

mikerod20:08:45

Interesting, I’ll look into cider-redirect-server-output-to-repl

mikerod20:08:49

I actually just updated that issue

mikerod20:08:10

I think it can be reproduced easily:

(ns fail-wrap-out-middleware
  (:refer-clojure :exclude [*out*]))

(.println System/out "10")

reefersleep20:08:24

@dpsutton I figured it out. Had updated my figwheel dep without also updating piggieback and figwheel-sidecar. CIDER works great now! 😄

cider 8
mikerod20:08:29

and thanks for the reference @dpsutton

cider 4