Graying out inactive preprocessor directives in IAR Embedded Workbench

Is there a way I can have IAR Embedded Workbench grey out inactive blocks of code within preprocessor conditions? E.g.

#ifdef TEST some code #endif 
So if macro TEST is not defined the "some code" part is somehow greyed out? asked Aug 11, 2014 at 23:13 dccharacter dccharacter 431 1 1 gold badge 5 5 silver badges 14 14 bronze badges

I have been asking myself the same thing. Maybe there is a plugin or extension, because there's nothing int he menus.

Commented Aug 20, 2014 at 11:39

It is not possible as far as I know, the IDE is quite limited, but you may want to have a look and try with Atmel Studio 6.2.

Commented Apr 13, 2015 at 7:05

1 Answer 1

This feature has been implemented at some point in the later versions of the IAR IDE for Arm.

The checkbox to enable/disable it can be found under Tools - IDE Options - Editor - [x] Show Inactive code .

I am using it since 9.10 as well as the official IAR extension for VScode.

answered Dec 19, 2022 at 13:14 560 3 3 silver badges 19 19 bronze badges

. yes it does exist - as of 9.20.4 it uses the same color as "C++ comments" (green in my case). I would prefer "grey background" or having ability to select a unique color (i would pick grey).

Commented Aug 24, 2023 at 19:37

@Frederick I am on 9.40.1 mostly with VSCode, CMake Tools and the IAR Debug extension (pretty much similar to this setup). It seems the normal IDE only offers foreground color selector for individual elements (such as comments) as you previously mentioned. However, the only option available for background color selection is global. It might change in the future.