Question

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

Was it helpful?

Solution

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

The formatting engine of DelForExp has been integrated into the code base of GExperts. An experimental version of GExperts including a "Code formatter" here:
http://blog.dummzeuch.de/experimental-gexperts-version/

Separate information/downloads for DelForExp here.

Regards.

OTHER TIPS

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 to 7
  • Delphi 2005 to 2010
  • Delphi XE
  • Delphi XE2 to XE7

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 blog.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.

I found this: JEDI Code Format

lextudio - Code Beautifier Collection 6 for CodeGear RAD Studio 2007

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

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

BTW: There is an integrated Source Code Formatter since Delphi 2010.

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.

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.

I just made an online pascal code beautifier based on JCF. You may try it at https://pak.lebah.web.id/jcf

HTH.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top