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?
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.
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)
精彩评论