In terms of "value for effort", this sounds like a cool idea.
I'd guess this approach also struggles with multiple-line input like if/else, loops, functions.
I'm reminded of https://github.com/jcartledge/sublime-worksheet which is language-agnostic on the other end of things. The two ideas might work well together in limited cases.