Background
Historically, on the WMF cluster, MediaWiki-extensions-CodeMirror has only been used to highlight wikitext. It however can perfectly also do numerous other languages. While we already have CodeEditor, I'd like to add support for languages that have corresponding content models on the WMF cluster. At first, this is for 3rd party benefit (no need for an extra extension). Longer-term, we may propose to replace CodeEditor entirely in favor of CodeMirror on the WMF cluster.
Checklist
These should take effect only if:
- $wgCodeMirrorV6 is set, or the "Improved Syntax Highlighting" beta feature is enabled
- $wgCodeMirrorEnabledModes includes the applicable modes
- $wgCodeEditorEnabledModes (in CodeEditor) is not set for the applicable mode
Effectively this means Beta users will get CodeMirror instead of Ace/CodeEditor. This gives us time to collect feedback and ensure CodeMirror is a suitable replacement.
- Add Lua support, loaded on pages with the Scribunto content model
- Add a linter using Luacheck
- Add JavaScript support, loaded on pages with the javascript content model
- Add a linter using ESLint
- Add CSS support for pages with the css content model
- Add a linter using Stylelint
- Add integration with TemplateStyles (Related: T394965, T394964)
- Add JSON support for pages with the json content model
- Add basic linter
- Add integration with JsonConfig
- Add integration with UploadWizard
- Add integration with MediaWiki-extensions-Gadgets
- Add Vue support for pages with the vue content model
- Add linting with eslint-plugin-vue
- Performance/optimization review: Reduce RL module count, load workers and other large files via $wgExtensionAssetsPath, etc.
- Deploy to Beta cluster
Further down the road:
- T399673: Add CodeMirror mode for AbuseFilter syntax
- T400014: Add ve.ui.MWCodeMirrorEditorWidget for CodeMirror support in VisualEditor's code editor
- T400015: Add CodeMirror integration in WikiLambda as an alternative to CodeEditor
Replacing CodeEditor
This is an idea being toyed with. This is not a formal proposal (yet). Here's a quick list of pros/cons:
Pros
- User preferences are consistent across all editors (T261118)
- User experience is more consistent across all editors
- JavaScript integrations from extensions, gadgets, etc. work the same for all editors (even the 2017 editor, to a degree)
- Maintenance is simpler as everything is under one roof
- Users can opt to have syntax highlighting without WikiEditor (i.e. the toolbar), if they so desire
- Better autocompletion
- Better linting tools (T373711#10350551)
- Dark mode support
- Fully localized
Cons
- Complete feature parity is unlikely, but we should be to port over whatever users consider the most important features
- Fixes something that isn't broken
- If something in CodeMirror breaks, it may effect editing in all content models (counterpoint to the "pro" above of being able to fix everything at once)