Calva
tl;dr Calva seems like a pretty kick-ass Clojure development environment.
Most of my Clojure development these days is done in the excellent Cursive plugin for IDEA. That said, I’m hardly editor monogamous. While I do the bulk of my non-Clojure programming with Vim in a terminal1, I’ve started doing a lot of JavaScript and TypeScript development in Microsoft’s VS Code. I’ve been hearing a lot about Calva lately, which is a plugin for Code that provides a Clojure development environment. I’m always curious about new Clojure tooling, so I figured I’d kick the tires.
I haven’t had a lot of time to dig in,
but I’m already plenty impressed.
It is super duper easy to get going.
You start with a bare-bones deps.edn
in a directory:
deps.edn
{:aliases
{:nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.6.0"}}}}}
And then open the directory as a workspace in Code.
Then run the “Calva: Start a Project REPL and Connect (aka Jack-in)” via the command palette,
or just use the keyboard shortcut Ctrl-Alt-C, J
.
You’ll next be presented with a list of project types.
For this deps.edn
-based project,
you’ll want to pick the “Clojure CLI” option.
Calva parses the deps.edn
and displays checkboxes for the aliases to include in the command.
Pretty darn slick!
For this demo,
check the :nrepl
alias and proceed.
Calva downloads the dependencies,
including some CIDER middleware,
and automatically sets up Code for some a decent REPL-based development flow.
In my short time playing with it, I’ve been really impressed by the level of polish. Here are some of the things I dug:
- Keyboard shortcut for sending the top-level form to the REPL.
- Inline display of the evaluation results.
- Building on the last item, you can hover over an evaluated form to get the option to copy the results into the clipboard. This is super cool! I didn’t know I wanted it until I had it. 🙂
- Rainbow parens.
- There seems to be some support for parinfer (though not quite as good as my beloved Cursive, which I consider to be the gold standard).
-
There seems to be really good paredit support,
but I’ve only scratched the surface so far.
Calva already has some good documentation on the topic,
though.
One of my favorite bits is the “grow selection” (
Ctrl-W
).
This was a whirlwind tour that’s only scratching the surface of what Calva offers. It was a strong enough first impression that I’m definitely planning on trying it out with a larger project. In particular, it seems to have a good ClojureScript story2, so I’m excited to dig deeper there.
Questions? Comments? Contact me!
Tools Used
- Calva
- 2.0.72
- Clojure
- 1.10.1
- Visual Studio Code
- 1.41.0