Marijn Haverbeke's blog (license)

CodeMirror 6 Enters Beta

Monday, June 29, 2020 javascript codemirror

I'm happy to announce that with version 0.8.0 the CodeMirror 6 project is entering its beta phase, and you're very much invited to start trying it out and poking at it.

Roughly, this “beta” status means:

You can read the change log if you want to see, in some detail, what I've been up to in the past months.

Project Goals

The retrospective for the Xi editor project has inspired me to also spend some time thinking about this project's goals, and how they developed.

In the initial announcement, we emphasized these goals:

Most of these we followed through on pretty much as planned. The exception to this is the bidirectional text and Unicode support—that did get implemented, but not by leaning on native behavior.

The reasons for this are:

Thus, the project has ended up with its own implementation of Unicode segmentation, bidirectional text ordering, and, on top of that, cursor motion. The original vision was that we could avoid this, but that didn't turn out to be realistic. On the bright side, not depending on native behavior makes the library a lot less susceptible to all the bugs and inconsistencies in those native implementations.

Of the remaining points, modularity is probably the one that I underestimated the most. Just organizing the library core as a number of separate modules was already a somewhat subtle exercise, but the real difficulty lies in making sure 3rd party code composes smoothly. The extension system went through four or five rewrites, and drove me to desperation at times, but I'm happy with what we landed on.

Avoiding performance cliffs has also required a lot of discipline to make sure complexity is only linear to document or line length when it absolutely needs to be, as well as careful API design to avoid making the slow approach the easiest or most obvious one. But I feel the vision has been realized well.

Having lived with a latent anxiety about whether I'd be able to deliver this project's promises for over two years now, I think I'm about to start actually believing I can. That's a relief.

What is Missing

The main thing you'll probably notice, when trying to integrate the library, is that a lot of languages don't have any support yet. This is the next thing on my roadmap. I'll implement proper support for some more major languages, and port most of the old CodeMirror 5 modes so that they can run in CodeMirror 6 (though, apart from some languages that are absolutely unparseable in a context-free way, the vision is to move to Lezer grammars for all important languages).

Next up would be the mostly-drop-in compatibility wrapper to the CodeMirror 5 interface that I've been talking about.

(But right now, we have summer holiday here, and the pace of work will be slow to nonexistant during the coming weeks.)