cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
Gleb Posobin 2020-12-21T02:52:24.350600Z

@brandon149 Do cider-pprint-eval-last-sexp and cider-pprint-eval-defun-at-point do what you want? They open a new buffer with the result, which doesn't change if you eval other forms, unlike the inspector.

Gleb Posobin 2020-12-21T02:53:50.351100Z

Or you can eval to comment, if you want to stay in the same buffer.

2020-12-21T04:06:40.352200Z

I'm trying to cider-jack-in-cljs with a shadow-cljs project that's using deps.edn for dependency resolution, and I'm running into some trouble.

2020-12-21T04:07:24.353100Z

I know the shadow-cljs side of things is working fine, because I can do a clj -A:shadow-cljs watch client, and then cider-connect-cljs to the resulting nrepl server without too much trouble

2020-12-21T04:07:36.353400Z

But I'd like to be able to launch it from emacs : )

2020-12-21T04:08:24.353900Z

Here's the outline of the deps.edn file:

{:deps [,,,]
  :src-paths [,,,]
  :aliases
 {:shadow-cljs
  {:extra-deps {thheller/shadow-cljs {:mvn/version "2.11.9"}}
   :main-opts ["-m" "shadow.cljs.devtools.cli"]}
   }}

2020-12-21T04:08:51.354400Z

and here's my .dir-locals file: ((clojure-mode (cider-clojure-cli-global-options . "-A:shadow-cljs watch client")))

2020-12-21T04:10:41.356400Z

When I jack in, there are several messages complaining about unqualified libs ("change nrepl => nrepl/nrepl"), and then it complains about unknown options:

Unknown option: "-m"
Unknown option: "--middleware"

2020-12-21T04:10:58.356700Z

And then it prints the shadow-cljs help text

2020-12-21T04:11:46.357700Z

I've checked the shadow-cljs and cider docs for how this should work, but I couldn't find much to help with this setup

2020-12-21T04:12:10.358200Z

And unfortunately I need access to some unpublished libraries, otherwise I'd just forsake deps.edn for now

2020-12-21T04:15:07.358800Z

I suspect those unkown optiosn are coming from this connection string:

[nREPL] Starting server via /run/current-system/sw/bin/clojure -A:shadow-cljs -Sdeps '{:deps {me.raynes/fs {:mvn/version "1.4.6"} compliment {:mvn/version "0.3.6"} com.cemerick/pomegranate {:mvn/version "0.4.0"} org.tcrawley/dynapath {:mvn/version "0.2.5"} nrepl {:mvn/version "0.8.2"} cider/piggieback {:mvn/version "0.5.1"} refactor-nrepl {:mvn/version "2.5.0"} cider/cider-nrepl {:mvn/version "0.25.3"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware", "cider.piggieback/wrap-cljs-repl"]'

2020-12-21T04:15:58.359600Z

looks like it's injecting some middleware, but for some reason it doesn't understand the stuff following the -Sdeps arg

2020-12-21T04:16:38.360Z

There is this:

error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: DEPRECATED: Libs must be qualified, change compliment => compliment/compliment 
DEPRECATED: Libs must be qualified, change nrepl => nrepl/nrepl 
DEPRECATED: Libs must be qualified, change refactor-nrepl => refactor-nrepl/refactor-nrepl 

2020-12-21T04:16:53.360400Z

Does anybody know where these are defined? I could try fixing that and seeing if it works

dpsutton 2020-12-21T05:10:58.361100Z

You can’t use your own main. Cider needs the main

dpsutton 2020-12-21T05:11:50.362200Z

There’s an issue relating to how to do this. One issue is that you need to make sure that shadows nrepl middleware are present as well

2020-12-21T05:13:49.363Z

that's useful! I'll see if it works if I don't use the alias

2020-12-21T05:15:46.363400Z

ah, I see what you mean about the middleware:

error in process filter: user-error: The shadow-cljs ClojureScript REPL is not available.  Please check <https://docs.cider.mx/cider/basics/clojurescript> for details
error in process filter: The shadow-cljs ClojureScript REPL is not available.  Please check <https://docs.cider.mx/cider/basics/clojurescript> for details

2020-12-21T05:16:18.364Z

But that's a new error, and I think a very helpful direction.

2020-12-21T05:26:39.364800Z

Ok, I only had the thheller/shadow-cljs {:mvn/version "2.11.9"} dep in the :extra-deps section of the :shadow-cljs alias, I added it to the regular deps and that removed the error in process filter messages

2020-12-21T05:26:45.365Z

so that's progress

2020-12-21T05:27:17.365600Z

But now I'm getting an exception:

Unhandled clojure.lang.ExceptionInfo
   missing instance
   {}

2020-12-21T05:27:37.365900Z

runtime.clj:   11  shadow.cljs.devtools.server.runtime/get-instance!
               runtime.clj:    8  shadow.cljs.devtools.server.runtime/get-instance!
                   api.clj:  122  shadow.cljs.devtools.api/worker-running?
                   api.clj:  120  shadow.cljs.devtools.api/worker-running?
                   api.clj:  206  shadow.cljs.devtools.api/watch
                   api.clj:  200  shadow.cljs.devtools.api/watch
                   api.clj:  204  shadow.cljs.devtools.api/watch
                   api.clj:  200  shadow.cljs.devtools.api/watch
                      REPL:    1  user/eval28454
                      REPL:    1  user/eval28454
             Compiler.java: 7177  clojure.lang.Compiler/eval
             Compiler.java: 7166  clojure.lang.Compiler/eval
             Compiler.java: 7132  clojure.lang.Compiler/eval
                  core.clj: 3214  clojure.core/eval
                  core.clj: 3210  clojure.core/eval
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  665  clojure.core/apply
                  core.clj: 1973  clojure.core/with-bindings*
                  core.clj: 1973  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   84  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  152  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  202  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  201  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  834  java.lang.Thread/run

2020-12-21T05:27:56.366400Z

So it's finding the shadow.cljs.devtools namespace now!

dpsutton 2020-12-21T05:42:21.366800Z

yeah. that's' because you're missing the shadow middleware

2020-12-21T05:53:40.367600Z

Thanks for digging up that issue. I'll try it out the solution in there and see how it goes

2020-12-21T05:54:13.368Z

But I'll do that tomorrow 👋

jrychter 2020-12-21T12:15:56.371200Z

Hi — I've been pulling my hair out trying to track down this problem — thought I'd ask, perhaps it looks familiar to someone. Some time within the last 2 months or so, something broke and I can no longer use helm-M-x reliably if I'm in a Clojure buffer or in CIDER repl. The error message is cryptic and ends with:

(fn C1 C2)]] 5 

(fn COMPLETIONS)])) last completion-metadata-get display-sort-function nil copy-sequence] 10 

(fn STR PRED ACTION) complete-with-action helm-completion-style helm-current-buffer completion-styles completion-flex-nospace helm-pattern] 10]’ 
 (user-error \"No linked CIDER sessions\")")
Things work fine until I connect with CIDER. Tried debug-on-error, but I can't make the debugger window stay on screen, the moment I start marking in it, it disappears. What's more frustrating, I can't find the string "No linked CIDER sessions" anywhere in CIDER sources. Any ideas?

Ben Sless 2020-12-21T13:18:55.372400Z

Hi all, are you familiar with a way of configuring cljfmt or zprint in such a way they would indent defrecords like CIDER? This is what cljfmt emits:

(defrecord Bar
-    [a b])
+           [a b])

gon 2020-12-21T20:37:32.378400Z

Hi, I have updated to last Cider cider-20201216.1330, at jack-in now I have the error "if: Wrong number of arguments: memq, 1", inspecting the buffer nrepl-messages only "(-->" is shown. nrepl is running, but Cider not. I see that in the last version in nrepl-client.el the line (specialq (lambda (pair) (seq-contains '("id" "op" "session" "time-stamp") (car pair)))) has changed to (specialq (lambda (pair) (seq-contains-p '("id" "op" "session" "time-stamp") (car pair)))), reverting the line to seq-contains made Cider working well again. Is it just me affected by this ?