==== Background
Existing metrics use the legacy EventLogging system, with its own [[ https://schema.wikimedia.org/#!/secondary/jsonschema/analytics/legacy/codemirrorusage | schema ]]. There was a [[ https://grafana-rw.wikimedia.org/d/uXX3yj1Mz/codemirror?forceLogin&orgId=1 | Grafana dashboard ]] but it is now marked for cleanup. This task is about creating new instrumentation for CodeMirror 6, starting from a clean slate. This data will help us evaluate which features are the most popular, and influence what is decided as the default set of features in the longer-term goal of having CodeMirror on by default for interest projects (i.e. T288161).
As part of this task, we should retire the older instrumentation.
==== Data questions
* How many people are using CodeMirror?
* Which editors are being used with CodeMirror (2017 editor, WikiEditor, or standalone CodeMirror)?
* Which [[ https://www.mediawiki.org/wiki/Help:Extension:CodeMirror#Features | CodeMirror features ]] are being used?
** Bracket matching What is the relationship of editor experience and the various features? (edit count bucketing)
==== Implementation
We will use the existing `VisualEditorFeatureUse` schema, despite it also being "legacy". This is to keep editing-related metrics in one place.
What we're trying to do is very similar to what was done for #realtime_preview (T306176).
We will use the new feature name `codemirror`, which has the following actions:
* `activated` – when CodeMirror is activated by any means
** Template folding* `deactivated` – when CodeMirror is toggled off
** Autocompletion* `search` – when the CodeMirrorSearch panel is opened
** Line numbering* `keymap` – when the keyboard shortcut dialog is opened
** Highlighting* `prefs-display` – when the active lineCodeMirrorPreferences panel is opened
** Line wrapping* `prefs-activeLine` – when the activeLine extension is applied
** Highlighting special characters* `prefs-bidiIsolation`
** Bidi isolation* `prefs-bracketMatching`
* What is the relationship of editor experience and the various features? (edit count bucketing)
==== Implementation
We will use the existing `VisualEditorFeatureUse` schema, despite it also being "legacy". This is to keep editing-related metrics in one place.`prefs-lineNumbering`
* `prefs-lineWrapping`
* `prefs-specialChars`
* `prefs-codeFolding`
* `prefs-autocomplete`
* `prefs-openLinks`
What we're trying to do is very similar to what was done for #realtime_preview (T306176)After the code is merged, the [[ https://www.mediawiki.org/wiki/VisualEditor/FeatureUse_data_dictionary | FeatureUse data dictionary ]] needs to be updated accordingly.