views:

1824

answers:

8

Are there any utilities that reformat Delphi code ?

EDIT

I am using Delphi 2006

Some feedback

Thanks to all that answered this question

I have been using the JCF code formatter - it works well and my code is been formated to Object Pascal Style Guide

+15  A: 

You can try de "Jedi code Format". See more information here:
http://jedicodeformat.sourceforge.net/

Few days ago I have read about an experimental version of GExperts that include an "Code formatter". See more information here:
http://www.dummzeuch.de/delphi/gexperts/english.html

You can read too more information about DelForExp here.

Excuse for my bad english.
Regards.

Neftalí
Nice, I didn't know about the Jedi Code Format, I'll try it out, thanks.
Fabio Gomes
Tried to install the Jedi Code Format but it depends on Jedi, so it doesn't work for me.
Fabio Gomes
+4  A: 

I found this: JEDI Code Format

PEZ
+3  A: 

Yes,

I always used TWM's experimental version os GExperts which support this feature.

In Delphi 2006 and 2007 it works perfectly (Don't know about older versions though).

The current version is adding support to Delphi 2009, but I don't know in which stage it is, you can find more about it here:

http://www.dummzeuch.de/delphi/gexperts/english.html

Fabio Gomes
+1  A: 

The TWM version of GExperts works well and is nicely integrated into the IDE. It enables you to write and modify your code without worrying too much about exact formatting, then just hit the assigned hot-key and it instantly reformats. I have always found it easy to set up to match the style I prefer, and not as complex as JEDI Code Format, which looked like overkill to me.

The Delphi 2009 version is now available from the link posted above, though based on a beta release of GExperts. It is still much the same formatter underneath, though, and is unaware of the syntax of some of the newer Delphi enhancements.

frogb
+10  A: 

I have been for some time releasing experimental GExperts versions that include the code formatter formerly known as DelForEx with some improvements and fixes. The latest release is from 2008-12-26 and supports the following Delphi versions:

  • Delphi 6
  • Delphi 7
  • Delphi 2005
  • Delphi 2006
  • Delphi 2007
  • Delphi 2009

Please note, though, that I am using it only with Delphi 2007, so the other versions may have unknown bugs. Also, not all language improvements of later Delphi versions will work, e.g. nested types, generics and anonymous methods.

see www.dummzeuch.de for details.

btw: Any help improving the formatter, especially adding the new language constructs would be appreciated. The source code can be downloaded from the subversion repository linked from my homepage.

dummzeuch
I use it daily (more like minutely :-)) under BDS2006 and it works like a treat.
Ulrich Gerhardt
Seems to be working OK for Delphi2009.
TheSteven
+2  A: 

lextudio - Code Beautifier Collection 6 for CodeGear RAD Studio 2007

http://code.google.com/p/lextudio/

RRUZ
A: 

There is OPEdit II which is free, and works very well. It's a full text editor, with code refactoring and code browsing. There is a text formatter, which uses the internal code parser, therefore handle conditional defines just as a real Delphi compiler. See http://www.codefactor2.com

A.Bouchez
A: 

Free Pascal also has a codeformatter, ptop, but it only implements the more basic dialect (say D4-D6 level).

Lazarus recently changed to use the Jedi codeformatter afaik.

Marco van de Voort