Fork me on GitHub
#cider
<
2021-11-08
>
David Pham08:11:44

I was wondering if anyone had some issue with cider-load-buffer with conditional reads and a clojure/jvm process? I get the error conditional reads are not allowed, so I resort to call cider-eval-buffer , is this expected? I am sorry if the question is trivial.

vemv09:11:27

assuming the file is a .cljc one it does sound like a bug

mico10:11:14

Hello, does anyone happen to make https://github.com/metosin/testit work with cider ? (currently it obviously fires the error that says that there is no 'is' defined in tests)

kari10:11:26

I think e.g. @U06QSF3BK is using Emacs / Cider. I'm a Cursive guy myself. 🙂 https://www.metosin.fi/blog/metosin-favorite-editors/

viesti10:11:52

I now use clojure-lsp also! 🙂

viesti10:11:47

on metosin/testit > https://github.com/metosin/open-source#project-lifecycle-model Deprecated: not actively maintained nor recommended for new projects

viesti10:11:10

but if you have it already, might not be worth to replace

mico10:11:00

@U76D9RZRR thanks for the redirect! @U06QSF3BK ok interesting, may be I should try clojure-lsp too though currently everything seems to work fine with cider except tests currently. Unfortunately have to support lots of testit-based codebase even it's deprecated.

vemv10:11:46

perform walk/macroexpand-all on a deftest and see whether in fact is has an is somewhere CIDER doesn't perform an heuristic, it just runs whatever you throw at it so it if contains an is (via macroexpansion), it should work

mico10:11:12

@U06QSF3BK but from the clojure-lsp docs I got the impression that it tries to leverage cider's run-tests so I would end up with the same problem

viesti10:11:48

too fast reply, so clojure-lsp just static analysis

mico10:11:15

This doc says https://docs.cider.mx/cider/testing/supported_libraries.html that cider run-test looks into metadata for filtering tests

viesti10:11:09

I haven't used midje style things myself, and haven't used metosin/testit, which seems to use clojure.test, so would think that loading a namespace with vars created by deftest should still work with cider

viesti10:11:17

have you loaded the namespace into repl?

mico10:11:42

yes, I did and here is the macroexpand results:

(def
 my-test
 (fn* ([] (clojure.test/test-var #'my-test))))
may be I am doing something wrong (or not doing smth)

mico10:11:24

oh! suddenly it started to work, don't know what I did though :)) suuri kiitos @U06QSF3BK

viesti10:11:50

Eipä kestä! 🙂

bozhidar11:11:17

CIDER cares only that the clojure.test protocol being implement by some particular library and it should work fine.

bozhidar11:11:53

I’ve avoided adding native support for different libraries as that’s a pretty slippery slope, plus in most cases you can easily run whatever tests you have in the REPL.

mico11:11:30

makes lots of sense! though this midje reference forced me to look into the different direction (emidje) @U051BLM8F Thanks for the amazing package!

1
bmaddy19:11:59

Does anyone have tips on how to debug a shadow-cljs repl not connecting with cider-connect-clj&cljs? I end up with two clj repls. Here's what I'm seeing in *Messages*:

[nREPL] Establishing direct connection to localhost:50636 ...
[nREPL] Direct connection to localhost:50636 established
[nREPL] Establishing direct connection to localhost:50636 ...
[nREPL] Direct connection to localhost:50636 established
user-error: The shadow-cljs ClojureScript REPL is not available.  Please check  for details
Version info:
;; Connected to nREPL server - 
;; CIDER 1.2.0snapshot (package: 20211108.621), nREPL 0.8.3
;; Clojure 1.10.3, Java 11.0.1
The project seems to be running fine. I see this in the js/console: shadow-cljs: #3 ready! and everything at http://localhost:9630/dashboard looks fine (although I'm new to using shadow-cljs). I'm just not sure where to look next. Does anyone know where I should look next?

bmaddy19:11:04

Oh, more info: I'm choosing shadow-select on the :main build. Some extra deps for the clojure repl:

{:extra-deps
 {nrepl/nrepl {:mvn/version "0.8.3"}
  refactor-nrepl/refactor-nrepl {:mvn/version "3.0.0"}
  cider/cider-nrepl {:mvn/version "0.27.2"}}
 :main-opts
 ["-m" "nrepl.cmdline" "--middleware" "[\"refactor-nrepl.middleware/wrap-refactor\",\"cider.nrepl/cider-middleware\"]"]}

bmaddy20:11:17

Well, immediately after I post here I found this: https://shadow-cljs.github.io/docs/UsersGuide.html#_troubleshooting Perhaps this is more of a shadow-cljs issue. I'll study this and maybe post over in #shadow-cljs if I still can't figure it out.

pithyless21:11:17

@U067Q76EP perhaps try: M-x cider-connect - select localhost and the nREPL port. Then M-x cider-connect-sibling-cljs

pithyless21:11:34

Not sure if that will be any different, but perhaps will bubble up a helpful error?

bmaddy21:11:16

Yeah, same issue. Thanks for the suggestion though.

pithyless21:11:45

Do you have the appropriate :deps {:aliases [:your-alias]} in shadow-cljs.edn?

bmaddy21:11:12

Yeah, it's just this code with the :sql and :xtdb aliases deleted. https://github.com/fulcrologic/fulcro-rad-demo

bmaddy21:11:32

I shouldn't say "just" there. It's a pretty complex set of dependencies. I bet there's something wrong in there but I'm just not sure how to debug it yet.

bozhidar06:11:29

The error you’re getting seems to indicate that the shadow-cljs library is not loaded, as CIDER does a trivial check to see if something is around, so it can invoke code from it safely.

bozhidar06:11:33

(defun cider-check-shadow-cljs-requirements ()
  "Check whether we can start a shadow-cljs REPL."
  (unless (cider-library-present-p "shadow.cljs.devtools.api")
    (user-error "The shadow-cljs ClojureScript REPL is not available.  Please check  for details")))

bozhidar06:11:45

Basically it’s a namespace check.

bozhidar06:11:02

If you think this has backfired for you, there’s a defcustom to disable such checks.

bozhidar06:11:37

See cider-check-cljs-repl-requirements.

bmaddy22:11:32

I figured it out. It turns out I was connecting to a clj repl insterad of a cljs one. I thought I was supposed to connect to a clj one and it would start a cljs repl, but I was wrong.

bmaddy22:11:57

Well, mostly figured out. cider-connect-clj&cljs only works with one of them depending on if I give it the clj port or the cljs port. I can call cider-connect-clj then cider-connect-cljs and that works.