🧙♀️ Better Clojure Editing
We have long wanted to provide a great Clojure/Script experience in Nextjournal, which requires at the very least some form of structural editing. As our editor is built on CodeMirror 5, our first approach was to use Shaun Lebron’s
parinfer-codemirror plugin. Ideally, this would offer structural editing without discussions around what key bindings we should default to. Unfortunately, we ran into performance issues that blocked us from a release we were satisfied with.
Luckily, things have changed quite a bit since then! A complete rewrite of CodeMirror has arrived (CodeMirror 6) and reached a level of stability that allowed us to build a Clojure/Script mode based on Lezer — CM6’s lightning-fast, incremental parser system.
After months of testing, we are happy to make this the default for Nextjournal’s Clojure (and ClojureScript) code cells and provide the mode as open-source CodeMirror 6 plugin.
What does it do?
🧙 Precise evaluation
🔪 Structural editing
As already mentioned, it is really fast. Thanks to Lezer’s incremental parsing, you can paste the entirety of
clojure/core.clj into a Clojure code cell (or into the live demo) and it will still be a decent editing experience.
A big thanks for this goes out to Marijn Haverbeke for his support while we developed this mode and his relentless work on improving code editing on the web. CodeMirror 6 is a great feat of engineering and gives you accessibility, touch screen support, extensible, modular, full parsing and fast fast fast. Go check it out!