JonyEpsilon / gorilla-repl

A rich REPL for Clojure in the notebook style.
http://gorilla-repl.org
MIT License
887 stars 104 forks source link

Folded segments #192

Open puredanger opened 9 years ago

puredanger commented 9 years ago

In building some training material with Gorilla, it would be useful if segments (or possibly groups of segments, but I'm not that greedy) had a "folded" state and if you could toggle it in the UI. That way you can put:

JonyEpsilon commented 9 years ago

Section folding would be a great feature, and there was an issue where we discussed this a bit #163 . It eventually closed as "won't fix" because I couldn't figure out how to do it without unreasonable effort! I think to do it properly the worksheet would have to move to a tree-shaped data model, rather than the current list.

The simpler idea of having segments fold would be much easier to implement. To make this persistent I think we'd need to have some segment-level metadata. This is something I've been consistently resisting, as it seems like an increase in complexity, and also the thin end of a wedge - once the metadata exists there's some temptation to add feature-after-feature. But maybe it's time to accept that metadata is a necessary complication.

I guess an alternative implementation would be to have something like IPython's "cell magics", which are magic strings that can appear at the start of a segment. But I never thought this was particularly elegant, so I'm not sure it's a good solution.