How are folks connecting Calva to the Exercism Clojure exercises?
If use exercism download
to get a local copy of one of the exercises, and then open a parent folder in VS Code (the parent clojure
folder will do), I can then open the .clj
file in the src
directory.
Now I follow the “Jack-in” instructions and hit ctrl-option-c
, ctrl-option-j
. That pops up the “Jack-in” menu where I’m asked for the “Project Type”. I know the test runner on the server uses Babashka, and there’s a projects.clj
file (provides Leiningen support?), but I just went with a softly-softly approach and chose deps.edn. I opted to not pick a launch target on the next pop-up because I figure :tests
is not for launching a REPL??
This seems to do the trick, and I can option-enter
and ctrl-enter
to my heart’s content. I still run the tests from the command line, and I don’t know what else I’m missing out on. Is there a better way?
If you like, you can make use of the Calva test runner or debugger, but I find them to be somewhat superfluous.
I run the tests directly from the editor by evaluating (clojure.test/run-tests)
from the test namespace.
There’s no reason not to select Babashka
from the project type menu, which has the benefit of instantaneous startup.
One tool I really enjoy is RCF: hyperfiddle/rcf: RCF – a REPL-first, async test macro for Clojure/Script (github.com)
It gives you a tests
macro that lets you define test cases in the same file as your source code, so then you don’t need to switch files all the time!
Here is a video demo I made: Fizzbuzz demo with RCF - YouTube
Great, that clears it up a lot!
deps.edn
is not causing me trouble so far, but nice to know about Babashka
. And I see the “Calva test runner” ctrl+alt+c t
command is quite handy for running all the tests.
Great vid too. I’m very new, but standard RCF’s are serving me well at the moment. Again, great to know of options.