CodeMirror 6.0 is finally stable. That means Obsidian will be migrating from CM6 v0.19 to v6.0 soon.
In this post I will attempt to summarize everything you need to know about this upcoming migration with breaking changes.
When you upgrade your plugin to target CM6 v6.0, there is a possibility that it no longer works with older versions of Obsidian using CM6 v0.19. If this is the case, you should update your plugin’s manifest.json to indicate that your minAppVersion is 0.15.0, and also add the appropriate entries to versions.json to prevent users with older versions of Obsidian to upgrade your plugin.
Major changes:
Prec.fallback/override/extendis nowPrec.highest/high/lowest.blockAtHeight,visualLineAtHeight,viewportLines,visualLineAtare now deprecated. The replacements work slightly differently but they should belineBlockAtHeight,viewportLineBlocksandlineBlockAt.- Syntax trees
iteratefunction has changed signature from 3 parameters(node, from, to)to a single object parameter(obj: {node, type, from, to})(details) scrollPosIntoView,scrollTo, andcenterOnis nowscrollIntoView- 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. - Many packages has been merged into other packages:
textandrangesetare merged intostate.tooltip,gutter,panel, andrectangular-selectionare merged intoview.matchbrackets,stream-parser,foldare merged intolanguage. The custom exports fromstream-parserare now available atlishid/cm-language.commentandhistoryare merged intocommands.closebracketsis merged intoautocomplete.highlightis split intolanguageand@lezer/highlight.
For more minor changes, check out the full breaking release notes.