IDE Window: Editor Options Code Folding

From Free Pascal wiki
Jump to navigationJump to search
  • You can get this dialog via:
Menu / Environment / Editor options / Code folding
Source editor / popup menu / Options ...


About

Code folding allows certain structure or blocks of text to be "collapsed". This will hide all but the first line of the block, and the first line will be marked with the folded-symbol "[...]" at the end of that line.

Code folding is done by using a special area in the Gutter which displays the code folding tree. In the tree you will find nodes at the lines were a fold-able region starts.

  • [-] denotes the beginning of a fold-able block, which is not yet folded. This is called an expanded block. Clicking on the [-] Symbol will fold (collapse) this block.
  • [+] denotes the beginning of a fold-able block, which is folded (hidden). This is called an collapsed block. Clicking on the [+] symbol will unfold (expand) this block.
  • | a vertical line is shown in front of lines that belong to a fold-able region, but are not the top line of such a region. The vertical line always begins under the [+] sign and continues to the last line of the block. On the last line it displays a tiny edge.

Fold-able blocks can be nested or overlapped.

Settings

Code folding

The checkbox on top globally enables or disables code folding. If disabled, the Gutter will not display the fold tree neither.

Language specific options

Currently code folding is only supported for Pascal Source

Select (tick) the structures you like to be fold-able

Procedure
Entire procedures or functions
Var/Type (local)
Any var, type or const declaration block that is local to a procedure
Begin/End (procedure)
The begin-end block of a procedure or function. This is the most outer block only, which encloses the entire procedure
Begin/End (nested)
Any other begin-end block.
Repeat
Case
Try
Any entire Try-finally/except-end block
Except/Finally
Allows to fold the code between the Except of finally keyword, up to the "end" of the entire "try" block
Asm
Program
The entire code up to the "end." statement. (this is for "program" files not for units)
unit
The entire unit up to the "end."
unit section
Any interface, implementation, initialization or finalization block
uses
If your uses clause goes over more than one line.
Var/Type (globa;)
Any var, type or const declaration block (except for the ones local in a procedure)
Class/Object
public/private
Record
Nested comments
{$IFDEF}
Any IFDEF-ELSE-ENDIF
{%Region}
Allows to define your own blocks, by putting this special comment into the code. ends with {%Endregion}

Usage

Using the Mouse

Using the Context Menu

Using Keyboard