Folding

Folding is primarily used with block structured languages. In addition to colorization, the language lexical analyzer (lex analyzer) performs fold point calculations. It scans the text for keywords or characters that indicate statement blocks.

The line introducing a statement block is marked as a fold point. The following lines through to, and sometimes including, the line where the block ends are linked to the fold point header line. Statement blocks can have other statement blocks embedded inside them.

Programming languages like C and C++ use brace characters ({ }) to mark the extent of statement blocks. The JADE language uses matched pairs of keywords (for example, the if and endif instruction pair) to mark the extent of statement (instruction) blocks. The JADE language lex analyzer also recognizes //{ and //} as fold block markers.

Some languages (including JADE) support the following styles of fold calculation (selected by using the named attribute fold.compact). See also the setNamedAttribute method.

A fold point can be in two states, as follows.

A fold point can optionally have a horizontal line drawn above or below it, to indicate its current state. The suggested setting for a fold point (used by the JadeEditor class) is a line drawn below a contracted fold point (foldFlags := 16).

The fold point symbols drawn in the fold margin can be completely customized, by using the setLinemarkAttributes method to modify the attributes of linemarks in the range 25 through 31.

Use the foldSymbols property to select one of the four available sets of fold point markers. The symbol set represented by the SC_FOLDSYM_TREESQUARE constant is recommended.

To contract and expand fold points: