The issue was finally closed the 22 Jun 2017. The lookahead was implemented in CodeMirror 5.27.0.
The function lookAhead
is able to handle the n-th line and thus is it possible to implement what I needed with a clean solution.
The variable height example was updated and the bug is not present anymore.