Fork me on GitHub

Dear Calva friends. This upstream issue (on VS Code) is causing confusion for new Calva users. The VS Code team is very driven by votes (thumbs up) on issues, so please throw yourself at this one and give it thumbs up:

šŸ‘ 6

I was going to share this as well šŸ˜„. You beat me to it.

aw_yeah 2
Alexis Schad17:06:05

Hi, is it normal that I can't compile functions in debug mode, or use breakpoint, inside an cljs app? Using cljc files it works. Got a failed compiling constant: #'cider.nrepl.middleware.debug/breakpoint-if-interesting; clojure.lang.Var is not a valid ClojureScript constant. Thanks!


Hello @schad.alexis , Iā€™m not completely sure I understand the problem, but if it is about the debugger, it only works in Clojure. That makes it work for cljc files if you are backing those with a Clojure REPL. You can toggle if they should be backed by a Clojure or ClojureScript REPL using a command, and also with the cljc/clj button in the statusbar.

šŸ‘ 2
Alexis Schad17:06:17

Thanks, yes it was about using the debugger in cljs.

šŸ‘ 2

Note to self: We should mention that in the Getting Started REPL.

Alexis Schad10:06:04

I tested it a bit more, with two REPL (one cljs and one clojure). I can switch as expected within a .cljc file, but in a .cljs, it is forced to the cljs REPL. I would have expected to be able to debug functions of "pure clojure" (without any JS dependency). Is it possible to force the clojure REPL in an cljs file?

Alexis Schad10:06:00

(For the initial question of the debugger in cljs, I've juste noticed the Note in the doc, I was just scrolling without reading it...)


Thatā€™s perfectly fine. šŸ˜ƒ


I try to factor things so that I can cljc files for cross platform code, but I havenā€™t entertained this use of a Clojure REPL for ClojureScript filesā€¦ I think it might often come down to that you still have some ns things you need to load and if it is a cljs file chances are that the Clojure REPL will not be able to load the file.


The output/REPL window is treated as a cljc file, however, so you can try debugging things thereā€¦

Alexis Schad11:06:00

yes the clojure cant parse the whole file, for sure, espacially the ns with JS requirements. I also have cljc files for the logic but my cljs are for reagent components (I'm making a web app). Thanks for the answer, now I understand well the why, I will find a solution (maybe putting the maximum code in cljc files, or just using console.log to debug cljs functions).


If you find a good way to do it, maybe you can write about it somewhere? Either off you have a blog, out it could fit in the Calva docs too