A cool thing with VS Code is that they have made it super easy to write extensions and to try your extensions out. With Calva the latter is this easy:
- Clone your fork of the Calva repository and checkout the
- Open the project in VS Code
- Run Build Task, and wait a minute, this will build and start the watcher.
- Hit F5 (shortcut for Start Debugging) .
This will open a new VS Code window running your dev version of Calva. It’s called the Extension Development Host. Open a Clojure(Script) project in this window. Place breakpoints in the Calva code and see them hit as you use Calva in your dev Calva.
Most of Calva is written in TypeScript. For now we don’t have any hot reload there. So when you have changed something in the code you’ll have to restart the debug session. However, parts of Calva is written in ClojureScript and if you hack on that you will have hot reload, thanks to shadow-cljs. But before you start to hack on the ClojureScript side of things you need to do one more thing:
- Jack in (choose to start both
:testand connect to
This will start the shadow-cljs watcher and REPLs, and connect Calva to them. You are now using Calva to hack Calva. It is pretty mind blowing, actually.
Read more here: How To Contribute to Calva
I hope you will try this and enjoy it. The Calva Team is in #calva-dev on the Clojurian’s Slack, ready to help you and receive feedback. Happy coding!