CodeMirror is a third-party library, which supports editing experience in Chrome DevTools. DevTools does not fork CodeMirror, thus all CodeMirror patches should go upstream to http://codemirror.net. Every once in a while, the CodeMirror dependency (which is located in Source/devtools/front_end/cm/ folder) should be updated to a newer version.
Run python devtools/scripts/roll_codemirror.js <codemirror_dir> <devtools_dir>
This requires the following steps to be done:
headlesscodemirror.js
is a runmode-standalone.js
file from CodeMirror distribution, but wrapped in (function(window) { ... }(this))
construction. This is needed to support in web workers.codemirror.css
contains both the default theme of CodeMirror and structural css required for it to work. Discard everything in the file up to the word /* STOP */
.front_end/cm/
folder should be substituted with their newer versions from the upstream.front_end/cm_web_modes/
and front_end/cm_modes/
should be updated with newer versions from upstream.DevTools wrap CodeMirror via CodeMirrorTextEditor.js
and cmdevtools.css
files. Although there are a couple of automated tests (web_tests/inspector/editor/) to verify overall sanity of the setup, a manual testing is mandatory before landing a roll. Here is a rough testing scenario outline:
function
, for
, var
are highlightedjquery.min.js
is formatted via “Pretty print” actionThe only changes allowed to front_end/cm/
folder are CodeMirror rolls. There's a presubmit check that enforces this, so make sure you include the phrase “roll CodeMirror” into your patch description.
Example CodeMirror roll patchset: https://codereview.chromium.org/273763003