Questions tagged [code-folding]

Code folding is a feature of some text editors that allows one to ‘fold’ (collapse/hide) and ‘unfold’ (expand/reveal) large blocks of code.

Code folding is a feature of some text editors that allows one to ‘fold’ and ‘unfold’ large blocks of code. This can be helpful to see a quick overview of a source file:

A C source file with two collapsed (‘folded’) functions, <code>greet</code> and <code>main</code>. The body of the functions are not visible.

However, folds can be expanded to work on a particular part of a file:

The same file as above, but with the definition of <code>main</code> unfolded.

In some editors, folding is indicated by a disclosure triangle in the line number area:

I lied; there are no line numbers. However, in the pane where the line numbers *would* be, there are three triangles: two to collapse the unfolded <code>greet</code> function, and another, in orange, to expand/unfold the folded <code>main</code> function.

Resources

205 questions
2
votes
1 answer

Javascript Code Folding by Regions in Eclipse

I was looking after region based code folding for javascript files in eclipse. The only thing I could find so far was Coffee Bytes Code Folding which extends the editor folding settings in…
zbug
  • 1,043
  • 1
  • 8
  • 19
2
votes
1 answer

How to fold in ViM for data files?

I have a type of data file (ENDF, if your interested) for which I'd like to create a custom ViM folding file. The folds would be dependent on (defined by) the contents of columns 66-80 of the file. Columns 66-80 of the file(s) look something like…
jlconlin
  • 14,206
  • 22
  • 72
  • 105
2
votes
2 answers

How to mantain or export folds when copying a file in Vim

Every time I copy a file the folds are lost. I understand why this happens, but I can''t figure out out to "export" or "maintain" the folds. Any suggestions? (otherwise I have to rename the view files one by one if I copy a entire folder). EDIT: I'm…
alexchenco
  • 53,565
  • 76
  • 241
  • 413
2
votes
1 answer

How to modify vb.net editor to indent nested regions

How do I modify the vb.net editor (via add-ins or whatever) to indent nested regions like thus: #Region "Declared Variables" #Region "Private Variables" Private _werwer as integer = 0 #End Region #Region "Public Variables" …
ProtoNoob
  • 301
  • 2
  • 13
2
votes
1 answer

Collapse text - nstextview

I need to create a simple nstextview for write some html code, I'm not interested (for now) to have color on syntax but I must have the text collapse for some tag. I try to search around but I don't find any thread, post, article that explain some…
francesco.venica
  • 1,703
  • 2
  • 19
  • 54
2
votes
2 answers

How do I avoid expanding folded regions when I invoke the code formatter?

As you know, Delphi 2010 has built-in code formatting. However, formatting unfolds all folded code blocks. Any ideas how to fix it? This "feature" is particularly annoying for me and I was really astonished when I couldn't find any mention of this…
2
votes
5 answers

Is there any way to get code folding in Delphi 7?

I know this is a long shot - but is there any way at all to get code folding into Delphi 7? I'm working on some .. "suboptimal" .. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into…
Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
2
votes
1 answer

When custom mapping is set for :cn, :cp vim doesn't expand the fold that contains an error

I have noticed that when I use :cn :cp directly, vim always expands folds for me. But when I set my custom mapping to call :cn like :map n :cn, vim doesn't expand foldings when I use n in this case, I have to move horizontally…
egdmitry
  • 2,071
  • 15
  • 18
2
votes
1 answer

Eclipse: Java: Folding Code Blocks Smaller Than A Method

I'm new to Eclipse. I haven't found a way to fold blocks of code in Java smaller than a method. I have a legacy project to maintain with huge and frequent nested conditionals. Refractoring is not an option at this point. I searched StackOverflow,…
Steve
  • 3,127
  • 14
  • 56
  • 96
2
votes
2 answers

Vim Code Folding for Scilab

I've just recently started to use the folding functionality of vim and it's very helpful for the languages that it works really well for. My issue lies in the way vim comments out the fold markers in scilab code. It defaults to /*{{{*/ and…
aepksbuck
  • 367
  • 2
  • 10
1
vote
1 answer

Dreamweaver Auto Collapse Methods/Functions

In Dreamweaver (or in any other text editor), is it possible to automatically collapse, for example, all methods/functions in a class file? I know it's possible to highlight text and collapse manually, but due to file sharing I always lose my…
efru
  • 1,401
  • 3
  • 17
  • 20
1
vote
2 answers

Opening New Tab Undoes Code Folding in Vim

I have an HTML file with the CSS in the head. Usually I open the file in 2 tabs, so I can switch between the HTML and CSS easily, but I would also like to fold most of the code (especially the font-face declarations.) Unfortunately, whenever I open…
Jordan Acosta
  • 405
  • 4
  • 12
1
vote
2 answers

How to implement "CodeIgniter 2.0" code completion capabilities with Notepad++ ?

How could I make Notepad++ have an intellisense for CodeIgniter 2.0 so that if I press Ctrl + SpaceBar on the keyboard code suggestions would be shown?
1
vote
3 answers

How can you control folds by an external file in Vim?

I have been searching a solution which puts the fold marks and codes to an external hidden file. This way you could have permanent folds without extra fold signs. How can you control folds by an external file in Vim?
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
1
vote
1 answer

Customize code folding for .js and .jsx files in vscode to achieve folding of className='...'

I am looking to fold the className attribute in my react app, as I am using tailwindcss and thus the classNames get quite long, cluttering my files. I've come across code folding based on start and end identifiers using regex, but am unsure as to…