Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Problems with code formatter and legacy code - whatispossible at all?

The code to look at is CodeFormatterVisitor and friends in the org.eclipse.cdt.core plug-in.
The extension point "org.eclipse.cdt.core.CodeFormatter" is defined in the same plug-in.
 
If you want to work on an enhancement or fix, please open a bugzilla for it.
Unfortunately, I am quite busy at the moment, so my response time will vary.

Regards,
Toni


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Achim Bursian
Sent: Monday, April 20, 2009 9:47 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Problems with code formatter and legacy code - whatispossible at all?

Anton, thanks for your reply. I was on vacation, too... so again this is a bit late.

Leherbauer, Anton (Toni) wrote on 2009-04-15 10:44:
2) public/private alignment
      
The problem here is that the formatter works with one indentation unit
only.
I.e. every indentation can only be a multiple of that unit.
So, supporting this style would be a challenge.
  
Maybe it would be easier to change all the other indentations to a multiple of 2? But that#s not possible in the GUI at the moment, probably that would require some code changes, too? Do you have any pointers where in the code I could start to hack into this?
It seems this is one of the main issues for us, as it changes every single line in a header file, which is not acceptable under revision control.

Some general notes:

Instead of formatting a complete file you can also format a selection.
"Correct Indentation" (Ctrl+I) only changes leading whitespace.
  
Important point, thanks!
I've never used that, always use Sh-Ctrl-F. Maybe I should just instruct our team to use Ctrl-I only. That would solve halt of the problems.
You can contribute your own implementation of a formatter. 
There is an extension point for that?

Maybe we could chat a bit privately about that whole issue in German (phone or mail), it doesn't seem to be too much of value for the community...

Thanks,
  Achim

Back to the top