Fork me on GitHub
#cider
<
2020-12-21
>
Gleb Posobin02:12:24

@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 Posobin02:12:50

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

datran04:12:40

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.

datran04:12:24

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

datran04:12:36

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

datran04:12:24

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"]}
   }}

datran04:12:51

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

datran04:12:41

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"

datran04:12:58

And then it prints the shadow-cljs help text

datran04:12:46

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

datran04:12:10

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

datran04:12:07

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"]'

datran04:12:58

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

datran04:12:38

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 

datran04:12:53

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

dpsutton05:12:58

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

dpsutton05:12:50

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

datran05:12:49

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

datran05:12:46

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  for details
error in process filter: The shadow-cljs ClojureScript REPL is not available.  Please check  for details

datran05:12:18

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

datran05:12:39

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

datran05:12:45

so that's progress

datran05:12:17

But now I'm getting an exception:

Unhandled clojure.lang.ExceptionInfo
   missing instance
   {}

datran05:12:37

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

datran05:12:56

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

dpsutton05:12:21

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

datran05:12:40

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

datran05:12:13

But I'll do that tomorrow 👋

jrychter12:12:56

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 Sless13:12:55

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])

gon20:12:32

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 ?