For determining which code to run we should take a look at the new code folding methods soon to come to Atom:
https://github.com/atom/atom/pull/16299
It's now on behind a feature flag on stable: http://blog.atom.io/2018/03/15/atom-1-25.html
Tree sitter finally fixes the issues we're having due to incorrect indentation based code folding.
Unfortunately it doesn't support highlighting of code cells anymore. I created a Atom issue for this: https://github.com/atom/atom/issues/18196
Most helpful comment
It's now on behind a feature flag on stable: http://blog.atom.io/2018/03/15/atom-1-25.html