Community
Participate
Working Groups
Build Identifier: I20110613-1736 In our legacy code, an indentation of 4 spaces is used, but only 2 spaces for the access specifiers (public:, protected:...) That was not supported in the CDT formatter up to now, but I was happy to find the new setting formatter.indent_access_specifier_extra_spaces in Indigo, which provides exactly what I need. I set org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces to 2, and org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header to false. These settings work fine with the CDT formatter, but if you select a code area that includes one of the access specifiers and use the indenter (Ctrl-I), the code gets indented wrongly: Using this as base: class OutDp: public OutDriver { public: OutDp(); ~OutDp(); void reInit(int axisNr, int outputNr); void checkInit(int axisNr); }; after indenting: class OutDp: public OutDriver { public: OutDp(); ~OutDp(); void reInit(int axisNr, int outputNr); void checkInit(int axisNr); }; Every line adds 2 more spaces. If the line with the "public:" specifier is not included in the selected area, the indenter works fine! Reproducible: Always Steps to Reproduce: 1. copy test code (see above) into a *.h file 2. select the whole class 3. press Ctrl-I
Created attachment 199553 [details] Exported style settings
Do you still experience this problem? I imported the attached file and indented the code example you provided, and could not trigger the problem.
Closing per comment 2. Feel free to reopen if you're still seeing this.