Calva: Clojure & ClojureScript support for VS Code
Welcome to Calva, an easy to use, integrated REPL powered environment for enjoyable and productive Clojure and ClojureScript coding. It includes inline code evaluation, Paredit (and some little Parinfer), a Clojure formatter, a test runner, Clojure syntax highlighting, and more. Much of the power is provided by The Orchard.
Calva is short for Calvados, a liquid gifted to humanity from God. It is distilled from Cider.
With Calva I hope to help lowering the barriers into the Clojure world. The idea is that by leveraging the strengths of VS Code and nREPL, I can offer a turn-key, productive, environment in which to learn and to use Clojure and ClojureScript.
How to Connect Calva to your project
Connect by letting Calva start your project (a.k.a. Jack-in).
When Calva has connected, it will open a REPL window giving you some getting started tips, and you can start hacking. The first thing you should always do to ”wake” Calva is to load/evaluate the current Clojure(Script) file:
Troubles connecting? Check here. (Please help keeping that wiki page updated.)
NB: Some project setups do not lend themselves to Jack-in, but Calva might still be able to connect. See Connecting to a running REPL server.
Something to try first
You might want to start with evaluating some code. Calva has this notion about the ”current” form (the symbol under the cursor or the paren enclosed s-expr immediately adjacent to the cursor). Issue the Evaluate current form (or selection) command:
There are also a command for evaluating the current top level form. Which I use even more often, especially since it works inside
See Calva Top 10 Commands for some more things to try.
The Calva Wiki
When something doesn't work and you think there might be a workaround for it, please see the wiki. Anyone can author the wiki so if you know about workarounds or gotchas or anything that is good to know about when usin Calva, please edit the approriate page (or create a new page).
At a glance
Demo: switch between clj and cljs repl sessions for cljc files:
More in depth (and some usage info)
Demo: Peek at defintions, etcetera:
Calva Paredit and Calva Formatter included
You really should have a look at the READMEs for those as well. One thing to note about it is that Calva Formatter sets the default keybinding of the Format current form command to
Clojure Warrior included
This extension bundles @tonsky's Clojure Warrior. Bringing you, amongst other things, rainbow parens and sane bracket matching. This allows Calva to disable VS Code's built in (not so sane) bracket matching.
Note. If you for some reason do not want rainbow colors, put this in your
Where is Calva heading?
There are lots of stuff that needs attention and lots of possible features to add. Please see the Github issue tracker for those things. And please regard it as a way to inform me about what is most important. (There are other ways for that as well, see below.)
Right now I am happy to have released a major upgrade to Calva (”Calva dos” as they say in Spanish), but I am not satisfied. I want to make Calva an even better choice for people starting with Clojure and ClojureScript, so that is where my focus will be. Please consider helping me!
How to contribute
I'm glad you are reading this section!
Calva is built using a combination of TypeScript and ClojureScript. The ClojureScript part uses the shadow-cljs toolchain. See the How to Contribute page on the wiki for instructions on how to hack on Calva.
Started from Visual Clojure
Calva once started off as a clone of the promising (but abandoned) visual:clojure extension.
Happy coding ❤️
I hope you will find good use for Calva. Please let me know what you think. PRs welcome, file an issue or chat me up in the