Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Using special code formatter and 'Indent Line'

thinking again about your reply, I wonder if it wouldn't be a good idea to have an extension point for the indenter?
Basically, if there is a need for a special formatter, it might be quite common to have some special indentation needs, which calls for a special indenter too.

Some general words about this topic:
All this is no problem at all if you start a new project, but for huge amounts of legacy code it is cricial to have the possibility to configure CDT in a way that it does not change the existing code formatting. Otherwise you get a big problem if you have to maintain several branches in source control over years. Nobody would reformat millions LOC just because of a new editor or IDE.

At least in our company I see the tendency to evaluate Eclipse/CDT even for very large existing C++ projects, but the formatting problems is what keeps a lot of teams from switching to CDT - which is a shame.
A lot of code has been written with Emacs or XEmacs, and to support these teams in switching to CDT, it should be possible to mimic all the Emacs c++-mode indentation rules. That is currently not the case, unfortunately.

All the best,

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Leherbauer, Anton (Toni)
Sent: Friday, January 08, 2010 11:44 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] Using special code formatter and 'Indent Line'


yes, the indenter engine is separate from the formatter, but they share the same style settings to accomplish consistency.

There is no extension point to replace the indenter, so I suggest to configure the code style to match your custom formatter settings as much as possible.

See IndentAction and CIndenter.


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Achim Bursian
> Sent: Thursday, January 07, 2010 3:44 PM
> To: CDT Dev Mailinglist
> Subject: [cdt-dev] Using special code formatter and 'Indent Line'
> Hi everybody,
> I managed to run a special purpose code formatter by using the 
> org.eclipse.cdt.core.CodeFormatter extension point. That works fine.
> But if the user presses Ctrl-I, another indentation engine is used, 
> and my formatting gets garbled.
> Which code is run when Ctrl-I is pressed? I can't find it.
> I'd like to run part of my own formatting code in that case, too, to 
> have consistent results with Sh-Ctrl-F and Ctrl-I.
> Thanks for help!
>   Achim

Back to the top