Page MenuHomePhabricator

Upgrade to CodeMirror 6
Open, In Progress, Needs TriagePublicGoal


This is Epic task for the CodeMirror 6 upgrade. This is a complete rewrite of the library that fixes many of the fundamental issues with CodeMirror 5. Specifically, accessibility issues, mobile compatibility, and RTL should largely be addressed.


The migration will roughly entail:

  • Add new lib files and necessary packages and set them up in the ResourceLoader config (T317243)
  • Make sure jQuery.textSelection still integrates cleanly (tackled as part of T317243)
  • Rewrite the MediaWiki "mode" to be a proper language package, or port to a CodeMirror 6 stream-parser (T348019)
  • Re-implement the TagModes and PluginModules system to work with CodeMirror 6 (T348684)
  • Verify performance is as good if not better than the old version and optimize accordingly
  • Update CSS to match the new DOM structure, if necessary
  • Update any CodeMirror integration that exists in other deployed MediaWiki extensions and skins, as necessary (quick glance seems to indicate this would only effect CharInsert, GrowthExperiments, ProofreadPage and Timeless on the WMF cluster)
  • Give communities time to update their code that interfaces with CodeMirror


Explore introducing new features

Consider replacing other syntax highlighting systems

We should consider replacing other syntax highlighting systems (i.e. Ace) with CodeMirror to reduce maintenance burden and keep code DRY. (Tasks to be created once CodeMirror 6 has proven itself.)

  • CodeEditor could theoretically be completely replaced by CodeMirror. There's really no need for a separate extension as CodeMirror offers the same and even more features.
  • SyntaxHighlight could also theoretically be done away with.
    • At the very least, SyntaxHighlight could tie into CodeMirror so we get the correct syntax highlighting within the <syntaxhighlight> tag while editing.
  • AbuseFilter has a mode for the Ace syntax highlighter.

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

For everyone's information, CodeMirror 6 has been stable now:

Consider upgrading now?

Aklapper changed the task status from Stalled to Open.Jun 22 2022, 4:29 PM
MusikAnimal renamed this task from Upgrade to CodeMirror 6 [placeholder] to Upgrade to CodeMirror 6.Jul 21 2022, 10:53 PM
MusikAnimal updated the task description. (Show Details)
MusikAnimal changed the task status from Open to In Progress.Sep 28 2023, 1:27 AM