I have just tagged a 0.20.0 release for all the @codemirror packages (and 0.16.0 for the @lezer packages). These introduce some package restructuring and a few minor breaking changes (listed below). I will tag 6.0 with this interface in a few weeks, if no significant issues are encountered.
To update your codebase, these are the things you’ll want to look at:
If you were still using
Prec.extend, you must move to the new names.
The old height querying system on the view (
visualLineAt) has been replaced with a simpler system where all y offsets are relative to the document top (see here).
The scroll control effects and method (
centerOn) are now replaced by the more general
Plugin fields no longer exist, and providing decorations from a view plugin now happens by providing a function to the
EditorView.decorationsfacet. Same for atomic ranges and scroll margins — you must use a facet for them now.
The exports from the @codemirror/text and @codemirror/rangeset packages have been moved into @codemirror/state, and the old packages are no longer available.
The exports from the @codemirror/tooltip, gutter, panel, and rectangular-selection packages have been moved into @codemirror/view.
The exports from @codemirror/matchbrackets, @codemirror/stream-parser, and @codemirror/fold have been moved into @codemirror/language.
The exports from @codemirror/comment and @codemirror/history have been moved into @codemirror/commands.
commentKeymaphas been merged into
The @codemirror/closebrackets package has been merged into @codemirror/autocomplete.
The @codemirror/highlight package has been split between @codemirror/language (the editor-specific parts) and @lezer/highlight (a new package containing the generic syntax-highlighting functionality). Lezer parser packages are now expected to provide highlighting information.
HighlightStylesobjects no longer directly act as editor extensions, but have to be wrapped with the
Languageobjects no longer export a
topNodeproperty, and if you want to use per-language highlighting you should pass the entire
Languageobject to the
In completion results, the rather confusing
spanproperty has been renamed to
validFor(and may be a function, not just a regexp).
If you’re using
iterateon syntax trees, the signature of the
leavefunctions was simplified in a breaking way.
The less granular module structure should make setting up your editor a bit more straightforward, and the changes to the highlighting logic make it a lot easier to do syntax highlighting based on Lezer parsers without pulling in a bunch of irrelevant editor code.