Search code examples
c++eclipse-cdtcode-formatting

How to disable Eclipse CDT code formatter for a code block


The CDT code formatter has a pretty decent selection of options, but it doesn't seem to have to a feature that allows one to tell it to ignore a block of code. This feature exists in the Java code formatter:

// @formatter:off
... // code that should not be formatted
// @formatter:on

Does this feature exist and I just don't know about it, or does anyone know of any decent work-arounds?

In my particular case, I'm trying to define data structures (enum types and arrays of strings) that I want to have specific layouts.


Solution

  • Yes, you can do it since CDT supports this feature starting from version 9.7. The behavior is exactly the same of JDT.