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/extend
is nowPrec.highest/high/lowest
.blockAtHeight
,visualLineAtHeight
,viewportLines
,visualLineAt
are now deprecated. The replacements work slightly differently but they should belineBlockAtHeight
,viewportLineBlocks
andlineBlockAt
.- Syntax trees
iterate
function has changed signature from 3 parameters(node, from, to)
to a single object parameter(obj: {node, type, from, to})
(details) scrollPosIntoView
,scrollTo
, andcenterOn
is nowscrollIntoView
- Plugin fields no longer exist, and providing decorations from a view plugin now happens by providing a function to the
EditorView.decorations
facet. Same for atomic ranges and scroll margins — you must use a facet for them now. - Many packages has been merged into other packages:
text
andrangeset
are merged intostate
.tooltip
,gutter
,panel
, andrectangular-selection
are merged intoview
.matchbrackets
,stream-parser
,fold
are merged intolanguage
. The custom exports fromstream-parser
are now available atlishid/cm-language
.comment
andhistory
are merged intocommands
.closebrackets
is merged intoautocomplete
.highlight
is split intolanguage
and@lezer/highlight
.
For more minor changes, check out the full breaking release notes.