Ask HN: Does Anyone Use Code Folding?
Does anyone use code folding? If so, what do you feel are the biggest benefits it gives you?
Also curious to see if anyone has any strong reasons against it?
The main benefit I can see is that you can use the folded code as an outline of the classes/functions in the file.
Comments
Code folding is awesome for Lisp. Once a function is working, you rarely have to look at it again. Seeing just the first part, eg: +(defun squared (x) tells just about everything you need to know for reference. If not, the documentation string can easily start on that line, too.
Of course a fold that pops up the documentation string on mouse-over would be the cream on top.
I use code folding in Xcode to quickly check if a method is being used in the code base. Code folding allows me to shrink down the amount of scrolling I need to do. Code folding allows me to access the methods I'm checking on that might be "below the fold."
Yep, and I here when people do not align line comments properly
Hate*, not here :)
I use code folding when editing the TXR man page, because it's close to 69000 lines long. I developed some custom Vim folding rules for that. Here is what it looks like fully folded:
Then if we open, say, the FOREIGN FUNCTION INTERFACE section, that looks like this: The Vim setup is this: It has quirks, but does the job more or less.I use it constantly. It helps visualize code flow in larger files by collapsing branches of loops or conditionals.