Page MenuHomePhabricator

Upgrade to CodeMirror 6
Open, In Progress, Needs TriagePublicGoal

Description

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 support should largely be addressed.

Checklist

These tasks are considered vital to retiring CodeMirror 5.

  • 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)
  • Port the MediaWiki "mode" to a CodeMirror 6 stream-parser (T348019)
    • Re-implement mediawiki TagModes system to work with CodeMirror 6 (T348684)
    • Find solution to style section level headings (T351686)
    • Optimize HTML generation (T352917)
  • Verify performance is as good if not better than the old version and optimize accordingly (it's noticeably faster, even before we added new features)
  • Ensure RTL support is up to snuff (T170001)
    • Add bidi isolation to HTML tags in RTL languages (T358804)
  • Update integration with 2017 wikitext editor (T357482)
  • Update any CodeMirror integration that exists in other deployed MediaWiki extensions and skins (T357794)
  • Come up with general solution for gadget/user script integrations (T214989)
  • Formally deprecate use of CodeMirror 5, with it to be removed entirely after at least one MediaWiki release cycle.

Deployment task: T357795

Post-migration

Nice-to-haves, but not necessary for rolling out CodeMirror 6 on the WMF cluster, or retiring CodeMirror 5.

General

  • Come up with a way to toggle on/off CodeMirror when there is no toolbar (T190108)
  • Come up with a more fitting icon (T174145)
  • CodeMirror preferences panel (T359498)
  • Librarization of the MediaWiki stream parser

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 possibly tie into CodeMirror so that we get the correct syntax highlighting within the <syntaxhighlight> tag while editing (when the language is supported).

Related Objects

StatusSubtypeAssignedTask
OpenFeatureNone
OpenFeatureNone
ResolvedFeatureMusikAnimal
ResolvedFeatureMusikAnimal
ResolvedMusikAnimal
In ProgressGoalNone
ResolvedFeatureMusikAnimal
ResolvedMusikAnimal
ResolvedMusikAnimal
ResolvedMusikAnimal
ResolvedBhsd
OpenBUG REPORTNone
ResolvedMusikAnimal
StalledNone
In ProgressMusikAnimal
OpenTheresNoTime
OpenNone
OpenMusikAnimal
OpenBUG REPORTNone
ResolvedMusikAnimal
ResolvedMusikAnimal

Event Timeline

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

There are also caveats using CodeMirror for static Wikitext highlighting. The CodeMirror parser, essentially a one-pass parser, assumes that the code is being written and may have incomplete syntax, while it is not the case for a static code block. And here are two examples: T185072 and T185070.

We moved this to QA as the core functionality is now ready for general testing! However, I realize now the only way you can test it is to pass in ?cm6enable=1 in the URL when editing. That's a tedious ask for you to do, so I'm going to first get the feature deployed to the Beta cluster, then you can test there without having to use the URL parameter.

I also need to give a good summary of what we're looking for as far as QA… and I haven't done that yet. Moving to "Needs attention" for the time being. It's possible I won't be able to revisit the CodeMirror project until after the off-site and my subsequent holiday.

It's possible I won't be able to revisit the CodeMirror project until after the off-site and my subsequent holiday.

Thank you for all your contributions to this difficult task, and wish you a great holiday!

Thank you for all your contributions to this difficult task, and wish you a great holiday!

Thank you!! You've been a huge help :) Glad you saw this, as I wanted to make sure you and whomever else is interested in this project is aware I'll be away from January 26 to February 12. It is highly likely I'll be checking in occasionally and even doing some work, but just know that I'll be slow to respond, and that I'm not ignoring anyone :) By all means, keep things moving in the meantime as you see fit (or not moving at all, hehe). Myself and my team will be back to see this project through in the second half of February.