The following is my report for the May - June, 2023 period of Clojurists Together long term sponsoring.
As usual, the bulk of my open source energy is poured into Calva, a Clojure/ClojureScript/ClojureCLR/ClojureDart/Babashka/nbb/Joyride/etcetera development environment that takes Interactive Programming seriously.
I also got to contribute to Clojure related starter projects + was interviewed for Flexiana’s new Clojure Corner series: Clojure Corner with Peter Strömberg
Calva
Over at Twitter someone asked me if I was up to something exciting. Implicitly wondering if Calva was about to get some cool new big thing (I think). My answer was that it is mostly about maintenance currently. However,
I find Calva maintenance exciting!
Maintenance has many aspects. Is the documentation helpful? Are there bugs that create that extra friction making them priority? Is there some feature that could be made more powerful with some change? What about some new feature I feel curious about and that I can finish with one or two late night hacking sessions? The best part: I get to talk to Calva users and consider their feedback, questions and suggestions.
Here’s a summary of Calva maintenance May + June 2023. I’m including some of the rationales, to give you a feel for how we reason when maintaining Calva. Wall of text:
Calva now makes an effort to try format code with incomplete structure (missing opening or closing brackets). This is common when formatting a selection, or formatting pasted code. It gets extra important for beginners who do not ”see” the structure as clearly as us with experience from Clojure or some other LISP(s). Not being familiar with the structure also makes you less likely to use Calva’s structural editing power. Having the broken code formatted helps in highlighting the structure and what is missing from it. While at it we also got some glitches with format-on-paste feature fixed. It’s a bit more complicated than you might think, as this issue might illustrate. Thanks Alexander Kouznetsov for the help in figuring this out!
Closing/fixing incomplete structure is not new in Calva. It has been used for Calva’s commands for evaluating to the cursor from arbitrary deep before the cursor. Which is very handy for investigating the steps in threads with the REPL, and for including
let
bindings in what is evaluated. It has so far not been available for your custom REPL evaluation commands, which is now fixed with the$selection-closing-brackets
interpolation variable.The Custom REPL Commands have been available only from Clojure files. This is now changed so that you can fire these commands from any file, as long as the REPL is connected. Good for Clerk Markdown Notebooks, which was the driver for this change.
The command Expand Selection now considers binding pairs, making it easy to select key/value paris in maps or bindings in
let
boxes, etcetera.Stefan van den Oord fixed a long standing and mysterious issue we have had with the deps.edn + shadow-cljs REPL connect sequence. It turned out we didn’t handle the case of selecting multiple shadow-cljs launch builds. (This is correctly handled for the shadow-cljs sequence, making our suggestion to use this sequence instead work as a ”solution”.)
Selecting a
deps.edn
alias that provides:main-opts
can break Calva’s connection of the REPL, because calva provides its own main-opts to start the nREPL server. The warning message Calva used to put up worked to help users navigate around this, but it was also terribly confusing. Thanks to Dustin Getz and Sean Corfield for helping with finding a better Ux!Connecting a shadow-cljs REPL is now a more managed process than it used to be. I’m already noticing a drop in user support time for this. Freeing up you users and us Calva maintainers for higher level conversations. 😀
Traditionally REPL connect sequences have been intended per workspace. Babashka changes this. To fire up a Babashka REPL often the built in sequence works fine, but if you want to start it in WSL… Now you can define these sequences both globally and locally. Starting Babashka in WSL and connecting VS Code is simplified with a sequence like this one defined in your User VS Code settings file:
"calva.replConnectSequences": [ { "name": "Bashbabka (WSL)", "projectType": "custom", "customJackInCommandLine": "bash -c 'bb --nrepl-server JACK-IN-NREPL-PORT'", }, ],
Actually, in order to support that 👆 sequence we also needed to add support for fully custom connect sequences. The
"custom"
project type is new since a few weeks.Calva Notebooks are a bit of a special take on notebooks in that we insist that any Clojure file can be a notebook. This has been more than a tiny bit hampered by that evaluating a notebook has also evaluated the Rich Comments in there… This is now fixed. You dare evaluate a Calva Notebook if you dare evaluate the file in its regular form.
There were also numerous small fixes and things happening that I either skip mentioning here, or that I have forgotten about. 😀
For a few days of this period I was fire fighting. My changes introduced regressions, and my fixes for the regressions introduced regressions. Nothing super major, but there is a promise we want to keep with Calva: We prioritize regressions that we introduce. As can be picked up in The Tao of Calva: Moving fast is great. Breaking things is fine, as long as you fix them fast.
Starter projects
I am a big fan of small starter projects. They can load a lot of experimentation and failure experience into a simple and approachable package that is easy for beginners and non-beginners alike to pick up and use. Hopefully for a quicker and smoother experience than the starter project creator had. Hereby I am encouraging you all to consider this when you have experimented with some tech stack, or tech stack component. It is my experience that I learn better from creating them as well. Both by the activity of structuring the project and writing the README in a way that I can hope is understandable, and from the feedback and contributions I get from others trying to use my project.
Anyway. This period around I created one new starter project and gave some love to an old and still popular one.
- Dockerized ClojureCLR Starter Project. Celebrating that ClojureCLR got a new nREPL server, and confirming that it works well with Calva, the result was a starter project. As I am on a Mac and don’t have reasons for having .Net installed, I choose to use Docker Compose to set the project up. This also makes it super quick to go from Zero to a ClojureCLR REPL running and connected to your editor. Special Calva convenience added. Please consider contributing configuration for your favorite Clojure IDE.
- rn-rf-shadow is a
ClojureScript + Reagent + re-frame + React Native starter project,
powered by shadow-cljs and Expo. It has helped a quite a few
ClojureScript React Native projects to get started.
- It is now up-to-date with latest React, latest Reagent, latest everything.
- The dependency bumps were the result of me adding React Navigation to the project. This makes sense for a lot of projects and is easy enough to rip out if your project does not need it. There is now also a branch demonstrating how to use React Native libraries, in this case the react-native-countdown-timer (no README update for this yet).
Please follow me
Thanks for sponsoring me! ❤️
- Clojurists Together: This long term sponsoring is fantastic. It makes wonders for how I can fit open source contributions into my family life.
- Github Sponsors: Same here, it’s long term and it makes my family respect Clojure, Calva, Open Source and that I want to spend time with it.
- Agical: My employer. Enabling me to spend some of my day brain on Calva. Something users should be immensely grateful for. Because my day brain actually works.