Delphi code formatter
Asked Answered
R

11

27

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

Rhinoplasty answered 31/12, 2008 at 11:2 Comment(0)
S
30

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.

Simulcast answered 31/12, 2008 at 11:14 Comment(4)
Nice, I didn't know about the Jedi Code Format, I'll try it out, thanks.Globe
Tried to install the Jedi Code Format but it depends on Jedi, so it doesn't work for me.Globe
You probably downloaded the sources. Just download the latest executable and unzip it. JCF Notepad worked fine for me. Excellent, no-nonsense tool...Delphi seems to breed such high-usability software :)Sizzle
Afaik JCF is nowadays available in Lazarus.Monastic
H
22

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 2020-10-23 and supports the following Delphi versions:

  • Delphi 6 to 7
  • Delphi 2005 to 2010
  • Delphi XE
  • Delphi XE2 to XE8
  • Delphi 10 to 10.4
  • Delphi 11 (Danger, Alpha version for now 2021-10-24)

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

Holism answered 31/12, 2008 at 12:22 Comment(1)
I use it daily (more like minutely :-)) under BDS2006 and it works like a treat.Otranto
D
5

I found this: JEDI Code Format

Demoniac answered 31/12, 2008 at 11:14 Comment(0)
T
4

lextudio - Code Beautifier Collection 6 for CodeGear RAD Studio 2007

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

Thuja answered 7/5, 2009 at 12:15 Comment(0)
G
3

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

Globe answered 31/12, 2008 at 11:18 Comment(0)
M
3

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

Mores answered 24/4, 2012 at 12:20 Comment(1)
True. But I don't like it.Raised
M
2

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.

Monastic answered 26/8, 2010 at 12:18 Comment(1)
I like that ptop works on Linux out of the box. Quite useful for legacy code;)Yanez
B
1

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.

Bullough answered 31/12, 2008 at 12:19 Comment(0)
G
1

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

HTH.

Goolsby answered 2/6, 2018 at 10:49 Comment(0)
G
0

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

Gerstein answered 7/8, 2010 at 7:51 Comment(0)
Q
0

There is a program PascalFormat enter image description here

Quatrain answered 15/10, 2021 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.