There is a hacked version of CodeMirror + New WikiText Editor here: https://gerrit.wikimedia.org/r/#/c/343878/
This version works by loading CodeMirror underneath the WikiText editor surface, making the text and background of the WikiText editor transparent, and syncing user input from the WikiText editor to the CodeMirror surface as it is entered.
One potential issues with this approach is: "Due to the fact that VE edit surface is not fixed height, we lose CodeMirror's viewport performance optimisation (https://github.com/codemirror/CodeMirror/issues/4076). It may be possible to have CM resize to the viewport height and then sync scrolling, but this itself may be slow and/or cause alignment issues with the VE surface. I've experimented with doing partial syncs as doing a full document setValue is unnecessarily expensive, but even with that, the loss of the viewport optimisation still makes typing feel a little sluggish."
Use the hack to investigate this issue and see if there is a way to improve the performance.