TH3-Code Collapse » History » Version 5
Wil van Antwerpen, 06/01/2019 10:59 PM
| 1 | 1 | Wil van Antwerpen | # Code Collapse |
|---|---|---|---|
| 2 | |||
| 3 | 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. |
||
| 4 | This is one of those features that you don't miss until you actually have it. |
||
| 5 | |||
| 6 | 4 | Wil van Antwerpen | ## How does it work? |
| 7 | |||
| 8 | 2 | Wil van Antwerpen | You get to see a (-) symbol in front of the line of code that can be collapsed. |
| 9 | If you click that (-) symbol it will collapse a block of code into one line and the symbol will change into a (+) symbol. |
||
| 10 | 1 | Wil van Antwerpen | |
| 11 | 4 | Wil van Antwerpen | ## Supported collapse features |
| 12 | 2 | Wil van Antwerpen | Currently the following scope keywords automatically support the code collapse feature: |
| 13 | |||
| 14 | 1 | Wil van Antwerpen | * begin / end code blocks |
| 15 | * object / end_object |
||
| 16 | * class / end_class |
||
| 17 | * procedure / end_procedure |
||
| 18 | * function / end_function |
||
| 19 | * while / loop |
||
| 20 | * case begin / case end |
||
| 21 | * type / end_type |
||
| 22 | * struct / end_struct |
||
| 23 | 2 | Wil van Antwerpen | * #COMMAND / #ENDCOMMAND |
| 24 | 4 | Wil van Antwerpen | * comments (see below) |
| 25 | 1 | Wil van Antwerpen | * section metatags (see below) |
| 26 | 2 | Wil van Antwerpen | |
| 27 | ## comments |
||
| 28 | |||
| 29 | 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. |
||
| 30 | 1 | Wil van Antwerpen | |
| 31 | ## section metatags |
||
| 32 | |||
| 33 | 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. |
||
| 34 | |||
| 35 | It works as follows: |
||
| 36 | |||
| 37 | ~~~ |
||
| 38 | { #CodeSection YourSection } |
||
| 39 | .... your code |
||
| 40 | { #CodeSection YourSection } |
||
| 41 | ~~~ |
||
| 42 | |||
| 43 | This then looks as follows: |
||
| 44 | |||
| 45 | <insert screenshot here> |
||
| 46 | |||
| 47 | ## compiler listfiles |
||
| 48 | |||
| 49 | This one is pretty useful and not one you would think of immediately. |
||
| 50 | |||
| 51 | If you have a .prn/.prp file then you actually have code collapse in there as well (was broken, just fixed 2019-05-17) |
||
| 52 | |||
| 53 | 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. |
||
| 54 | 4 | Wil van Antwerpen | |
| 55 | ## Collapse options via context menu |
||
| 56 | |||
| 57 | 5 | Wil van Antwerpen | If you right click then under menu item "scope blocks" there is a way to quickly collapse or expand a code collapse feature for the current text. |
| 58 | 4 | Wil van Antwerpen | For example you can collapse ALL comments in your file. |
| 59 | |||
| 60 | The following options can be collapsed/expanded for the full source in one go are: |
||
| 61 | |||
| 62 | * All scopes |
||
| 63 | * Procedures |
||
| 64 | * Functions |
||
| 65 | * Objects |
||
| 66 | * Classes |
||
| 67 | * Line Comments |