3 ms·
I’ve been playing around with using extra indentation for these sorts of purposes in the last couple of years, mostly at the sub-function level but also in the
by chrismorgan 3y ago
I’ve been playing around with using extra indentation for these sorts of purposes in the last couple of years, mostly at the sub-function level but also in the larger file situation described in the article. I’ve found it to work so well that it has even been significantly influencing the design of the lightweight markup language I’ve been using for my own purposes for the last year or two and further designing as I go.
The minor rough point is that text editors probably don’t support mixing line folding techniques, so you probably won’t be able to fold sections and functions, which it would sometimes be nice to be able to do. Maybe at some point I’ll get round to making a hybrid fold expression for Vim to mix multiple fold methods, though honestly I find Vim’s folding pretty janky (my Rust foldexpr works fine when you load code, but start editing it and the fold tree rapidly falls apart in painful ways and it’s absolutely Vim’s fault) and would probably prefer to shift the entire thing to FFI for more flexibility.
Some languages/IDE ecosystems support other ways of doing this sectioning, like Visual Studio’s “regions”, which gets around the folding problem since it’s all in the language rather than being a mixture of language syntax and independently-chosen convention.