Page MenuHomePhabricator

Add preferences panel to CodeMirror 6
Open, Needs TriagePublic



With the advent of CodeMirror 6, we open the door to a lot of amazing new features:

  • Autocompletion (T95100)
  • Code folding (T30684)
  • Themes (T163533)
  • Modifier + clicking to open templates (T303392)
  • Bidi isolation (T358804)
  • HTML tag matching
  • Linting
  • Line numbering (would take precedence over $wgCodeMirrorLineNumberingNamespaces)
  • Active line highlighting
  • Rectangular selection
  • Editor direction (LTR/RTL)

These are amazing, but surely won't be desired by all. Meanwhile we want to avoid adding these to Special:Preferences both to not clutter it further, but also that ideally you could customize your editor in realtime, rather than having to save your preferences and refresh.

Proposed solution

Introduce a "CodeMirror preferences" panel, akin to the one seen in CodeEditor with the +, keystroke. Here we could house all the advanced features, most of which will probably be off by default.

Turning CodeMirror on/off by itself should still be done either via the toggles shown in WikiEditor (2010) and VisualEditor-MediaWiki-2017WikitextEditor.

Relevant links:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Please make the CM panel more discoverable. I know the CodeEditor panel exists, I use it every now and then, yet I struggle each time recalling/finding out the hotkey.

Meanwhile we want to avoid adding these to Special:Preferences both to not clutter it further

On the other hand, this cluttering would make it possible to configure the features in global preferences, which would probably be welcomed by people active on multiple wikis. Realtime customization would also be possible by interfacing the preferences both in Special:Preferences and in the panel (I don’t know how well it interacts with global preferences, but if someone wants global preferences, they can use that, if someone wants realtime customization, they can have that).

Good point about Global Preferences! I know I would want that. I'll see what's doable.