Fork me on GitHub
#cider
<
2023-08-21
>
hifumi12303:08:06

I have been attempting to use shadow-cljs recently, but I am getting this error message right before I get to choose a build target.

[nREPL] Starting server via /opt/local/bin/npx shadow-cljs -d nrepl/nrepl:1.0.0 -d cider/cider-nrepl:0.30.0 -d cider/piggieback:0.5.2 server
[nREPL] server started on 50770
error in process filter: parseclj--reduce-coll: parseclj: Syntax error: "At position 617, unmatched :rbrace"
error in process filter: parseclj: Syntax error: "At position 617, unmatched :rbrace"
How can I debug this?

dpsutton03:08:32

run /opt/local/bin/npx shadow-cljs -d nrepl/nrepl:1.0.0 -d cider/cider-nrepl:0.30.0 -d cider/piggieback:0.5.2 server from a command line and see what happens. Somewhere it’s parsing (or erroneously thinks) some bad edn. My money is malformed shadow-cljs.edn

hifumi12304:08:18

if that were the case, shadow wouldn't even start. ive attempted running npx shadow-cljs watch app then running M-x cider-connect-cljs but this results in the same error (shadow successfully parses the config and builds the specified target, but some EDN error occurs when connecting to the REPL)

dpsutton04:08:43

interesting. you can try turning on nrepl message logging and also set emacs to give you a stack trace on error

dpsutton04:08:00

you should be able to then debug the function in emacs and see what edn is acting problematically

vemv04:08:07

parseclj backs https://github.com/clojure-emacs/parseedn grep for parseedn in cider, luckily there are very few matches This one calls my attention: (parseedn-read '((shadow/env . identity))) Off hand, I have no idea what it does. Please give it a shot and report an issue if you aren't lucky

hifumi12304:08:42

Thanks @U11BV7MTK and @U45T93RA6. I will try seeing what exact EDN data is being given to CIDER and try to see what’s going wrong

vemv04:08:51

Cheers. Invoking (cider--shadow-get-builds) directly might give you a reproducible case (which doesn't appear to even need an nrepl connection)

hifumi12307:08:48

Here is what I see in the debug minibuffer

Debugger entered--Lisp error: (parseclj-parser-error "At position 562, unmatched :rbrace")
  parseclj--error("At position %s, unmatched %S" 562 :rbrace)
  parseclj--reduce-coll((#<hash-table equal 3/3 0x4653f237>) ((:token-type . :rbrace) (:form . "}") (:pos . 562)) parseedn-reduce-branch ((:tag-readers (shadow/env . identity))))
  parseclj-parser(parseedn-reduce-leaf parseedn-reduce-branch ((:tag-readers (shadow/env . identity))))
  parseedn-read(((shadow/env . identity)))
  cider--shadow-get-builds()

vemv11:08:09

Nice. May it be an instance of https://github.com/clojure-emacs/parseedn/issues/16 ? Either way, looks like there's a way to skip going down that code path in your particular project? The logic is:

(or cider-shadow-default-options
    (car cider-shadow-watched-builds)
    (completing-read "Select shadow-cljs build: " (cider--shadow-get-builds)))

vemv07:08:35

Curious, did you get to determine the cause?

hifumi12307:08:21

Haven’t tried yet, sorry

hifumi12307:08:31

or rather, I’ve been unable to determine whats really going wrong

vemv07:08:29

would be happy to help. Is there a namespaced map in shadow-cljs.edn? Like a :mvn{:version declaration?

hifumi12307:08:52

shadow uses the same syntax as leiningen for dependencies. the shadow-cljs.edn file is very barebones

hifumi12307:08:55

let me try finding where this project is

vemv07:08:12

feel free to DM me its redacted contents, could be an easy repro

hifumi12307:08:36

Sure. I will send the project causing problems

vemv07:08:57

(shadow-cljs.edn will be enough)

pithyless09:08:16

I'm assuming there is, but I can't find it: is there an easy way to disable switching my focus to the *cider-test-report* buffer when running a test?

practicalli-johnny10:08:07

(setq cider-auto-select-test-report-buffer nil)
I believe the report still shows bit the report buffer doesn't become active https://practical.li/spacemacs/reference/cider/configuration-variables/#tests

pithyless11:08:59

@U05254DQM sorry for bringing up an old thread, but I had asked a question and then stepped away to do something else... and next thing you know, a week has passed. Just wanted to let you know, this is exactly what I was looking for and you answered my question. Many thanks! gratitude and sorry for the radio silence.

👍 2