Questions tagged [folding]

Code folding is a feature of some text editors and IDEs that allow some text to be temporarily hidden or "collapsed" in order to hide detail.

Most text editors and IDEs offer some way of hiding sections of the code in order to traverse the code more easily, only view the code currently being edited, and to show an outline of what code currently is in the file.

What code counts as a section and hence can be hidden, can be user specified or automatically added based on the syntax of the language, indentation or tokens (such as brackets).

454 questions
36
votes
3 answers

Vim: Fold top level folds only

I have a long code file with syntax folding in Vim. I know how to open all folds (zR) or close all folds (zM), and I know how to increase or decrease the foldlevel (zm, zr). However when I increase the foldlevel the inner most folds are closed;…
driax
  • 2,528
  • 1
  • 23
  • 20
36
votes
2 answers

How can I save text folds and folded code block data to .sublime-workspace?

Seems like there are no features in Sublime Text 2 that keep code folding between file sessions close\open. I'd like to write plugin for this, but have a question. Where should I store fold-data such as which file, or region on the page is folded?…
gridsane
  • 519
  • 4
  • 13
32
votes
5 answers

Is their a "region-like" folding feature for Android Studio

I'm developing on Android Studio and as others IDE, Android Studio has a feature to create "regions" in the java code that can be folded. (see below) With this kind of code //region INITIALIZATION private int myVaribale; private String…
MHogge
  • 5,408
  • 15
  • 61
  • 104
30
votes
1 answer

How to use Coffee-Bytes code folding

How to use "Coffee-Bytes code folding"? I want to use user defined region but don't know how to use it. Can anyone guide me? And how to use it in java code?
Bangkok Apartment
  • 1,487
  • 3
  • 12
  • 7
28
votes
7 answers

Why is there no code-folding in emacs?

There are several questions on SO about how to get code folding in emacs, without having to add any special characters like "markers" in the comments for example. Someone said that there was "no perfect solution." It seems that it could be done by…
ppbitb
  • 519
  • 1
  • 7
  • 19
28
votes
9 answers

Does Sublime Text 2 have the ability to region code similar to Visual Studio?

In Visual Studio you can minimize huge chunks of code using regions; they essentially just surround the code and minimize it in the window. Does Sublime have a feature similar to this?
Piper
  • 1,266
  • 3
  • 15
  • 26
27
votes
2 answers

Code folding in RStudio: Creating hierarchy in the code

I'm writing R scripts in RStudio and I use the code folding a lot. I found that you can see the hierarchy of the folding by pressing cmd + shift + O. This is super helpful. # to my dear love…
M. Beausoleil
  • 3,141
  • 6
  • 29
  • 61
27
votes
4 answers

Is there any way to manually fold code in Eclipse?

Is there any way to manually create fold points in code in Eclipse? I know how to enable folding and how to set the auto preferences, but i like being able to set my own fold points so I can ignore certain parts of my code. Think regions in VS. I…
WolfmanDragon
  • 7,851
  • 14
  • 49
  • 61
26
votes
14 answers

How to implement a list fold in Java

I have a List and want to reduce it to a single value (functional programming term "fold", Ruby term inject), like Arrays.asList("a", "b", "c") ... fold ... "a,b,c" As I am infected with functional programming ideas (Scala), I am looking for an…
Peter Kofler
  • 9,252
  • 8
  • 51
  • 79
26
votes
24 answers

How do you feel about code folding?

For those of you in the Visual Studio environment, how do you feel about wrapping any of your code in #regions? (or if any other IDE has something similar...)
Bryan Denny
  • 27,363
  • 32
  • 109
  • 125
24
votes
1 answer

Three curly brackets together in php source code

I just downloaded complete source code of PHP from php.net (PHP 5.4.0 [tar.bz2]). They are often using three curly brackets together as given below (The following code snippet extracted form ext/ctype/ctype.c.) /* {{{ proto bool ctype_digit(mixed…
Mohammed H
  • 6,880
  • 16
  • 81
  • 127
24
votes
5 answers

In WebStorm, is there a way to collapse all the elements at my current level

We have a common structure in our code where we have several related classes in the same file with several methods in each. What I would like to achieve is to fold all the methods in the class I'm in so that I could get a good overview of the…
Alex Zak
  • 1,924
  • 2
  • 18
  • 26
22
votes
3 answers

Folding tags in emacs nxml-mode

The interwebs are full of ancient doctrines for folding code in the Glorious Emacs Editor. Among them are folding.el, outline-minor-mode, and fold-dwim.el. Alas, my poor unenlightened mind cannot write the necessary elisp configuration. Please help…
Natan Yellin
  • 6,063
  • 5
  • 38
  • 57
20
votes
4 answers

Eclipse, How to activate Folding in XML file?

I have problem with folding when I'm writing code in XML. Actually, when I'm writing Java code there is no problem and I can expand/collapse my codes. However, in XML there is no folding icon although it is active. In side bar (line number), I right…
Hesam
  • 52,260
  • 74
  • 224
  • 365
19
votes
1 answer

Could someone explain a particular use case of ‘foldexpr’ syntax in Vim?

Could anyone please provide an explanation of the syntax in the following example, or post me a link where there is a more general explanation of the individual symbols used in this expression? I found Vim help to be incomplete in this regard. :set…
xralf
  • 3,312
  • 45
  • 129
  • 200
1
2
3
30 31