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)
- 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)
- T373649: Copying and pasting large pages causes misalignment between CodeMirror and VE surfaces
- T374072: CodeMirror 6 + 2017 wikitext editor race conditions
- T374196: Text misaligned when switching directionality using CodeMirror in 2017 Source Editor
- T379104: Automatically detect and report misalignment between VE and CodeMirror surfaces
- 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)
- 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)
- Autocompletion (T95100)
- Template folding (T30684)
- Revive instrumentation (T373710)
- Deprecate use of CodeMirror 5 (T373720)
Deployment task: T357795
Beta feature task: T376735
Short-term goals
Not necessary for rolling out CodeMirror 6 on the WMF cluster, or retiring CodeMirror 5, but we are still aiming to bring these the extension.
These features can be tried now on @Bhsd's demo page: https://bhsd-harry.github.io/codemirror-mediawiki/
- T373711: Add support for Scribunto, JavaScript, CSS, JSON and Vue to CodeMirror 6
- Match tags (highlighting the matching opening/closing tag)
- "Go to definition" for references
- Color picker for hex and RGB values
- Hover over magic words to get descriptions of what they do
- Parser function signature helper
- Foldable sections and tables
- Themes (T163533)
Longer-term maybes
- Librarization of the MediaWiki stream parser
- Collaborative editing (for use outside WMF wikis)
- Using CodeMirror to assist with Edit conflict resolution
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.
- AbuseFilter has a mode for the Ace syntax highlighter.
- VisualEditor has a widget for the Ace syntax highlighter.
- WikiLambda has a Vue component for the Ace syntax highlighter.
- 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).