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 that allow DVT to collapse the code back to the original

  • in a separate editor: DVT opens a new editor to show 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. 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.

Warning

Do not modify the pragmas generated by DVT because this might break the collapse functionality!

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 all levels inline

Ctrl+Shift+=

Collapse inline expansion

Ctrl+Shift+-

  • 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.

../../_images/edt-macros-markers.png

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