Code folding allows you to hide some sections of code so you can focus on others. Sections of C or assembly code may be collapsed (hidden) or expanded (displayed), depending on your selected options.
Code folding is enabled by default. For most C or assembly code, sections of code that may be folded are signified by “-” and “+” icons to the left of the code.
Enable and Set Up Code Folding
Use the following steps to enable and set up code folding:
Expand/Collapse Code Folding
Within the editor, click the “-” icon next to a method and it folds. Click the “+” icon next to a folded method and it expands. Folded code is denoted by an ellipsis box. Hold the cursor over the ellipsis box and the IDE displays the collapsed method.
Code Folding – Inline Assembly and MPLAB C18 C
Code folding does not work for inline assembly code in MPLAB C18 when the
_asm
and _endasm
directives are used. The work-around
is to put the code block near the end of the code/file.
Custom Code Folding – C
To custom fold C code, do one of the following:
// <editor-fold defaultstate="collapsed" desc="user-description">
C code block to fold
// </editor-fold>
OR
fcom
and press the <Tab> key to
automatically enter the comment text above.After the comment has been entered, customize it for your code:
defaultstate |
Enter either
collapsed or expanded , |
desc |
Enter a description of the code. Once collapsed, this description can still be seen for reference. |
An example of custom code folding is shown in “Expand/Collapse Code Folding” above.
For additional information see the NetBeans help topic:
https://ui.netbeans.org/docs/ui/code_folding/cf_uispec.html
Custom Code Folding – ASM
To custom fold assembly code, do the following:
; <editor-fold defaultstate="collapsed" desc="user-description">
ASM code block to fold
; </editor-fold>
// <editor-fold defaultstate="collapsed" desc="user-description">
ASM code block to fold
// </editor-fold>
OR
fcom
; and press the <Tab> key to automatically enter the
relevant comment text above. fcom//
and press
the <Tab> key to automatically enter the relevant comment text above.Assembly code will fold in the same way that C code folds. For an example of code folding, see the C code example above.
Expand/Collapse Custom Code Folding
To expand/collapse code blocks, go to the View menu, or right-click in the Editor window, and select one of the following:
An example of custom code folding is shown in “Expand/Collapse Code Folding” above.