Macro Expansion
Overview
You can inspect the code generated by the expansion of a macro in two ways:
- inline
- DVT replaces the macro call with the generated code in place; the expanded code is guarded by pragmas which allow DVT to collapse the code back to the original
- in a separate editor
- DVT opens a new editor window which shows the generated code
Triggering
- To expand
- Place the cursor on a macro call in the editor, right click, select from the pop-up menu Macros and then the desired expand type. Expansion also works for an entire region of code, and all macros in the selection will be expanded. DVT also marks inline macro expansions in the code and collects them in the tasks view to allow easy tracking.
- To collapse
- Place the cursor on the expansion start pragma, and select Collapse Inline Expansion. Do not modify the pragmas generated by DVT because this might break the collapse functionality!
You can chose to expand only the first level (i.e. further macro calls inside the top level macro are not expanded) or all levels. You can quickly collapse a macro expansion by right-clicking on its marker.

Tips
- Shortcuts
- There are some handy keyboard shortcuts you can use for triggering:
| Expand one level inline | Ctrl Shift = |
| Expand all levels | F5 |
| Collapse inline expansion | Ctrl Shift - |
- Selection
- Expansion also works for an entire region of code, and all macros in the selection will be expanded.
- Markers
- DVT also marks inline macro expansions in the code and collects them in the tasks view to allow easy tracking.
- Quick collapse
- You can quickly collapse a macro expansion by right-clicking on its marker.

IMPORTANT NOTE
Do not modify the pragmas generated by DVT because this might break the collapse functionality!
The pragmas are:
- @DVT_EXPAND_MACRO_INLINE_START
- @DVT_EXPAND_MACRO_INLINE_ORIGINAL
- @DVT_EXPAND_MACRO_INLINE_END