views:

197

answers:

2

The code formatter in Delphi 2010 is a useful tool for developing coding standards, or at least this is my opinion, however it has a horrid habit of ruining comments.

A nicly commented block like this..

SomeFunction(SomeVaribleWithALongName,             // Comment
             Option2,                              // Comment
             FieldByName('SomeField').AsSomething; // Comment

Becomes harder to read

SomeFunction(SomeVaribleWithALongName, // Comment
             Option2, // Comment
             FieldByName('SomeField').AsSomething; // Comment

I have set everything I can see to either False, As Is or None, yet CTRL + D still moves my poor comments.

Does anyone have a solution to this or shall I just join the vast group of disappointed Delphi programmers that hate the Formatter?

+2  A: 

RAD Studio 2010's pascal code formatter is rather immature and crude. Check out open source one, it is very flexible (however, i never practiced such style, so i cannot promise you will have tolerance to your comments w/o touching the source)

I liked JCF in Delphi2006, but couldn't get it to work in 2010. I assumed it didn't support 2010. Anybody know otherwise?
awmross
Yes, works OK. You have to build it from source distributive.Despite of the name, JCF is not part of JEDI initiative.
+4  A: 

Why don't you give GExperts a go (www.gexperts.org). There is an "experimental" version which is a patch on the latest version which is 1.33 which includes a code formatter. This code formatter was originally a separate tool called DelForEx which had been an excellent formatter since the early days of Delphi. The code formatter in GExperts has an option which allows you to align simple comments to a specific column position.

GExperts is available for D2010. You need to first install the latest version and then copy the relevant files from the patch to add the code formatter. Even though the patch is labelled experimental it is pretty stable so I wouldn't worry about that too much.

chillijay
www.gexperts.org offers a much better code formatter, I am sure Code-Gear will sort it out for D2011, its a very immature feature at the moment.
Reallyethical