Use ACE editor for test case code in question editor

Re: Use ACE editor for test case code in question editor

by Richard Lobb -
Number of replies: 0
I just looked into why the old rudimentary indentation and tab-handling code was no longer working properly in the question authoring form test fields. The setupAllTAs function in testareas.js was expecting to find textareas with a class edit_code, which was what edit_coderunner_form.php was requesting as the attributes of the textareas it created. But setupAllTAs wasn't finding any such textareas, so the initTextArea function was never being called. It seems a change in the Moodle-core forms module around Moodle 3.7 moved the requested class into a wrapper div instead!

I've pushed to github a change to textareas.js that re-implements the old functionality. It doesn't do much: just inserts 4 spaces when you hit tab and autoindents lines to match the previous line. But it might deal with at least some of your frustrations!