Project

General

Profile

TH3-Code Collapse » History » Version 4

Version 3 (Wil van Antwerpen, 06/01/2019 10:53 PM) → Version 4/5 (Wil van Antwerpen, 06/01/2019 10:58 PM)

# Code Collapse

The Hammer 3.0 is based on the scintilla control and as such it wasn't too hard to add code collapse specifically for the DataFlex language.
This is one of those features that you don't miss until you actually have it.

## How

##How
does it work?

You get to see a (-) symbol in front of the line of code that can be collapsed.
If you click that (-) symbol it will collapse a block of code into one line and the symbol will change into a (+) symbol.

## Supported collapse features
Currently the following scope keywords automatically support the code collapse feature:

* begin / end code blocks
* object / end_object
* class / end_class
* procedure / end_procedure
* function / end_function
* while / loop
* case begin / case end
* type / end_type
* struct / end_struct
* #COMMAND / #ENDCOMMAND
* comments (see below) (1)
* section metatags (see below)

## comments

If you have multiple lines of comments then you can collapse those lines to one line by clicking on the (+) symbol in front of the line.

## section metatags

If you want to be able to collapse a whole bunch of code so that you can quickly hide specific parts of code then use the section metatag collapse feature.

It works as follows:

~~~
{ #CodeSection YourSection }
.... your code
{ #CodeSection YourSection }
~~~

This then looks as follows:

<insert screenshot here>

## compiler listfiles

This one is pretty useful and not one you would think of immediately.

If you have a .prn/.prp file then you actually have code collapse in there as well (was broken, just fixed 2019-05-17)

It can really be a drag having to plough through all that code. Being able to use code collapse in here does help quite a bit.

## Collapse options via context menu

If you right click then under menu item "code blocks" there is a way to quickly collapse or expand a code collapse feature for the current text.
For example you can collapse ALL comments in your file.

The following options can be collapsed/expanded for the full source in one go are:

* All scopes
* Procedures
* Functions
* Objects
* Classes
* Line Comments