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.
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.markselection.js
is a mark-selection.js
from CodeMirror distribution. The “dash” is removed due to the restriction on the chromium grd generator./* STOP */
.DevTools wrap CodeMirror via CodeMirrorTextEditor.js
and cmdevtools.css
files. Although there are a couple of automated tests (LayoutTests/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