Fork me on GitHub
#cider
<
2022-12-07
>
andrea.crotti12:12:47

did anything change regarding cider-register-cljs-repl-type ? we have a custom repl type (shadow-repl) with has an init form that used to be evaluated when the repl starts. Since today probably cider prints in the repl buffer the form it should evaluate, but is not evaluating it anymore.

andrea.crotti12:12:43

actually I wonder if it's related with https://github.com/clojure-emacs/cider/issues/3236 since now it looks like the repl type is wrong even after starting it, not just when I switch from a code buffer to the repl

aiba17:12:18

@andrea.crotti I'm also experiencing this. my shadow cljs repls become clj repls and then cannot evaluate cljs code anymore. I reverted cider to commit "5064287ba71c4c8ede169b0f561d707f4a365c55" to get it working again.

Benjamin10:12:21

do you know if you tried it with b11991245f6fb6e183757da66f47cc5d04221ae1 ?

andrea.crotti10:12:49

as a side note, what's the easy way to use cider from source with use-package?

Benjamin10:12:11

do you use straight?

andrea.crotti10:12:16

I tried to pin it to stable as well actually but it didn't really work either

andrea.crotti10:12:22

no I'm not using straight

Benjamin10:12:40

can only think the readme of use-package will say 😅

Benjamin10:12:58

ok can confirm what you said, it stays clj instead of upgrading

Benjamin10:12:14

;; cider-repl--state-handler sets it to clj when we eval
;; cljs.core/demunge
;; this is why we see the broken behavior (new) 

cider-set-repl-type("clj")
  cider-repl--state-handler((dict "changed-namespaces" (dict) "id" "11" "repl-type" "clj" "session" "f5122c13-5224-482a-8a35-d243e1d80357" "status" ("state")))
  run-hook-with-args(cider-repl--state-handler (dict "changed-namespaces" (dict) "id" "11" "repl-type" "clj" "session" "f5122c13-5224-482a-8a35-d243e1d80357" "status" ("state")))
  nrepl-client-filter(#<process nrepl-connection<5>> "oneeed18:changed-namespacesde2:id2:119:repl-type3:...")
  accept-process-output(nil 0.01)
  nrepl-send-sync-request(("op" "eval" "code" "cljs.core/demunge") #<buffer *cider-repl clojure/acme-app:localhost:43155(cljs:shadow)*> nil tooling)
  nrepl-sync-request:eval("cljs.core/demunge" #<buffer *cider-repl clojure/acme-app:localhost:43155(cljs:shadow)*> nil tooling)
@U051BLM8F
;; how does it decide the repl-type here?
(nrepl-dbind-response response (repl-type changed-namespaces)
  )

Benjamin11:12:09

checking in cider-nrepl and it comes from (cljs/grab-cljs-env msg) maybe I need to say something in the message that I want to eval cljs or something

Benjamin11:12:21

pretty sure from ciders perspective the difference is whether ns is passed to the eval request. When I pass cider-current-ns I get repl-type cljs , else clj . I suppose this is basically a feature that is good. I will try around to figure out the correct way to check demunge being present.

bozhidar11:12:53

The repl-type is the responses comes from the track-state middleware in cider-nrepl.

bozhidar11:12:29

Basically it starts to return the cljs-type once a hosted cljs REPL gets started.

bozhidar11:12:38

This was considered the only reliable way to be sure that a connection's type actually got changed back in the day - is the ClojureScript env actually in the session or no.

Benjamin13:12:04

I have an okay fix I think. On the level of detail I understand it, I could fix it by changing the ordering so the "demunge" eval call is not the last, but the repl-init-form is the last (which sets the repl type). https://github.com/clojure-emacs/cider/pull/3282