Removed in the “Starter” edition of Delphi XE2, code formatting is easily reinstituted with at least two 3rd party tools that I’m aware of. The first, my personal preference and the only one I plan to cover [others may get suggested in the comments section] is “GExperts Experimental by TWM”. One specific reason I much prefer this particular rendition of a code formatter is that to get it you need to install GExperts and, it is my opinion, you really should have GExperts installed and available in any Delphi IDE.
GExperts Experimental by TWM ... “These versions are always based on the current SubVersion/CVS repository code of the GExperts project. In addition to the normal functionality they include the code formatter formerly known as DelForEx. The code has kindly been donated by Egbert van Nes.”.
It is pretty easy to install and get running but you need to read and follow the instructions.
To get it all installed and running ...
- download and install the release of GExperts for XE2 ,
- download the appropriate GExperts Experimental by TWM archive file - I prefer to save it into the GExperts installation folder,
- extract the file “preview.pas” and all the “.ini files” from the TWM archive file to the GExperts installation directory,
- depending on if you choose either the Editor Expert or the Regular Expert copy the “GExpertsRSXE2.dll” from the corresponding folder in the TWM archive file to the GExperts installation directory replacing the existing GExpertsRSXE2.dll file.
Now, with the exception of code formatting [and any of the other GExperts tools that you understand how to use and happen to need], go into the GExperts Configuration settings and turn them all off. Figure out how code formatting works and we’ve accomplished what we set out to do. I have not compared the one that comes out of the box to the one detailed above but it is quite possible that the one you now have could be a bit better in one aspect or another than what you would have had Embarcadero left it alone. Later and as needs arise, study and understand how each of the additional GExperts tools work, decide if you need to leave them “live” and slowly work up to having the tools fully configured and operating the way that works best for you.
Thanks for stopping by
Dave
Keep the progress reports coming. I'm following your posts avidly.
ReplyDeleteMax
Thanks Max. They're likely to be a bit on the slow side.
DeleteUnfortunately the code formatter has not been updated to support some of the more recent language features. In particular you get some really 'interesting' results when you are using private type declarations like
ReplyDelete[...]
.... class(...)
private
type
TBla= record
end;
public
[...]
The workaround is turning off the formatting for these parts by putting them in {(*} ... {*)}.
And as always: I want to encourage anybody interested in improving the code formatter to contact me.
Private Type declarations are likely to be edge cases for "Starters" but, you never know. Thanks for that information, very much appreciated.
DeleteMost Post-Delphi-7 language features have issues with the GExperts code formatter.
ReplyDeleteFrom the top of my head, things that will go wrong are:
- nested types (as TWM mentioned)
- consts and vars in your class
- operator overloading
- generics
The latter will be a hell of a job to get right.
I wasn't aware of the {(*} ... {*)} trick, thanks TWM for mentioning that!
--jeroen
Thanks for your comments Jeroen, very much appreciated. It seems, if you're using many of the new language features, that the formatting tool that come with the versions other than "Starter" would be the preferred route. Worth the cost of an upgrade ... hardly, but then using what does come with "Starter" [nothing] makes the GExperts formatting tool look a little attractive at least.
DeleteThe {(*} ... {*)} trick would come in handy - if there were code template tools to use.
Question: do you know if the {(*} ... {*)} trick works with the default code formatter? that would be great (I'm using some fluent interfaces in my code and I don't want to auto-format them!)
Delete@Leus ... It looks to be a feature specific to the TWM Formatting Tool. My trials in D2010Pro failed and there is nothing in the help files. It did however work as expected in DXE2Starter. You may want to ask on the NewsGroups/Stack Excange or wade through the information here:
Deletehttp://docwiki.embarcadero.com/RADStudio/en/Main_Page
Heya¡my very first comment on your site. ,I have been reading your blog for a while and thought I would completely pop in
ReplyDeleteAppear fervent about it. I’m developing a fresh blog plus I’m struggling to make it look good, as well as offer the best
quality content. I have learned much at your web site and also I anticipate alot more articles and will be coming back
soon. Thanks you.
Journal Editing and Formatting Service