There were numerous issues like that with the CodeMirror 5 pg language syntax highlighting. For WeBWorK 2.20 that has all been completely rewritten for CodeMirror 6, and generally will do a much better job with syntax highlighting. It also features code completion suggestions.
WeBWorK Main Forum
TeX affecting the Problem Editor text coloring
This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day