More ideas on modelling filesystem.
Gave up on generic approach and going with TS/CodeMirror marriage again.