[Lazarus] user defined code folding regions using $REGION comments

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Nov 26 09:42:15 CET 2008

On Wed, Nov 26, 2008 at 10:20 AM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> Any thoughts on the above?  Anybody code folding code experience
> willing to take up the challenge in implementing something like this?

Another use for user defined code folding regions.... I found this
hint on some Delphi website.

Like you I don't use cold folding however I recently found a use for it.

Create a LiveTemplate something along these lines.

{$REGION 'Assert'}Assert(Condition, 'Message');{$ENDREGION}

Use it every time you write an assertion and fold it up straight away.

Your distracting full length Assert statement is reduced to a single
word, Assert, and because the region starts and ends on the same line
you don't have line numbers jumping unexpectedly.

I also change my editor colours so that the collapsed region label is
less prominent than the regular code lines.

That could be handy for hiding all kinds of debug code... I could see
a use for this in my code.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list