Fork me on GitHub
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.


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.


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


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


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

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


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


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"


And then it prints the shadow-cljs help text


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


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


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


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


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 


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


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


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


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


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


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


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


so that's progress


But now I'm getting an exception:

Unhandled clojure.lang.ExceptionInfo
   missing instance


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
    7177  clojure.lang.Compiler/eval
    7166  clojure.lang.Compiler/eval
    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
          152  clojure.lang.AFn/applyToHelper
          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*
       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
      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
           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
           22  clojure.lang.AFn/run
       834  java.lang.Thread/run


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


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


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


But I'll do that tomorrow 👋


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


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 ?