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

180 questions
4
votes
2 answers

How to change the folded part color on Vim

I fold some of the functions on my C code. When I fold them, the color becomes gray. Is there any way to change the color of folded part to another color?
alex
  • 1,039
  • 1
  • 11
  • 26
4
votes
2 answers

Emacs how to show only the lines on or before the cursor in a file

I am a high school computer science teacher and would like to use emacs to present programs to my students. I would like to be able to present the programs, even short ones, one line at a time and not have the whole program show in the emacs buffer…
rainerpm
  • 153
  • 1
  • 5
4
votes
1 answer

How to unfold code one level at a time in Sublime Text 2?

Let's say I have a class, some subclasses in it (in Ruby, for example), some methods in them etc.. In ST2 I choose Edit -> Code Folding -> Fold all. When I click the small arrow next to the class name I want to see the class body, but the methods in…
Alexander
  • 17,699
  • 19
  • 72
  • 107
4
votes
1 answer

How to disable code folding in Qt Creator?

I have a project I'm working on in Qt Creator that requires breakpoints to debug. I would like to be able to add a breakpoint by clicking next to the line number, because it is intuitive to me. However, when I click in Qt Creator, the code is folded…
Wok
  • 4,468
  • 5
  • 34
  • 56
3
votes
0 answers

Dedenting multiple lines fail when code is collapsed - vscode

As seen in the gif when the code is collapsed and I try to dedent it, the content inside {} doesn't move, is it a bug or there's a special shortcut to dedent the lines in this case?
Frank
  • 227
  • 6
3
votes
2 answers

Emacs feature similar to JEdit's indent folding mode?

Possible Duplicate: Emacs equivalent of Vim's foldmethod = indent JEdit has a mode (specifically, folding mode: indent, in Options) that lets you fold code blocks based purely on indentation. It does not require any additional configuration, or…
Robin Green
  • 29,408
  • 13
  • 94
  • 178
3
votes
0 answers

How to get code folding with shiny embedding in the same rmarkdown html document?

I am trying to create an rmd html document which uses code folding as well as shiny embedding. I have tried to do this using the default shiny rmd doc but adding in code_folding: hide: --- title: "Untitled" author: "Author" date:…
KGee
  • 579
  • 5
  • 23
3
votes
0 answers

Code folding of round brackets in RStudio

Is there a way to add code folding arrows next to round brackets in RStudio? For example, in the picture below a can collapse using the little arrow next to it, but no arrow shows up to collapse b. Is it possible to make those round brackets…
JJJ
  • 939
  • 6
  • 17
  • 28
3
votes
1 answer

How to fold and unfold a if condition, loops, any other code blocks within "{ code }" other than Methods body in XCode 9?

Recently, I have updated my Xcode from version 8 to version 9. but now I face a weird issue and that is code folding ribbon. New version (9) doesn't having such thing in it. After research a lot I find out the way of folding the code but still it…
Ravi Raja Jangid
  • 355
  • 4
  • 14
3
votes
0 answers

R Studio - Code folding includes last blank line?

I'm using R Studio desktop and trying to use code folding. My code looks like this: # first ---- test1 <- 1 # second ---- test2 <- 2 # third ---- test3 <- 3 # fourth ---- test4 <- 4 When it folds, I want it to look like this: # first <> #…
3
votes
1 answer

Notepad++ Code Folding Opens and Closes are mispositioned by several lines

So I've made a user defined language in Notepad++ to organize a writing project. I know how to do code-folding, and for the past several months it has worked well. The problem is that recently, the code-folding function is several lines off from the…
3
votes
2 answers

Xcode expand/collapse braces/brackets {} side bar missing

The side bar, next to the code line numbers, that allows expansion/collapsing of brace/brackets {} is no longer showing in Xcode. I am trying to figure out how to get it back.
SAHM
  • 3,747
  • 4
  • 37
  • 77
3
votes
1 answer

Netbeans 8.0 - Preferences for code folding

I have recently switched to using Netbeans IDE 8.0 for a PHP project and would like to know if it's possible to either:- Configure NetBeans to remember my code fold status (open/ closed) when I save the file Automatically fold only functions upon…
Phill
  • 143
  • 1
  • 8
3
votes
1 answer

Is there a way to make the "Code Folding" Stay Folded In Delphi 2010

I absolutely love the Code Folding feature inside Delphi 2010. However, each time start Delphi 2010 and reopen my project the code I had peviously folded down is no longer folded. Is there a way to keep the folded code, folded when you close down…
3
votes
1 answer

Code folding in RichTextBox

I am working on a Code Editor derived from Winforms RichTextBox using C#. I have already implemented autocompletion and syntax hilighting, but code folding is somewhat a different approach. What I want to achieve is: The code below: public static…
devavx
  • 1,035
  • 9
  • 22
1 2
3
11 12