Take the 2-minute tour ×

Years ago, I wrote a code template that took a few simple parameters (points) and produced a class skeleton. Since some of the method bodies had code in them, I couldn't call InvokeClassCompletion and just placed the implementations with the declarations (user had to move them).

It has occurred to me that I can write a code template script engine to insert these methods in the correct position, but I don't see how I'm supposed to navigate the file. There are declarations for IOTAEditReader and IOTAEditWriter in ToolsAPI.pas, but I'm guessing there is a step missing - certainly I don't need to manually parse the Delphi code just to find the implementation section?

Does anyone have experience with it?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

The IDE has plenty of parsers in it, but not one is made available for IDE plugins (ToolsAPI). So you have to write your own parser or use an existing one like http://delphiblog.twodesk.com/using-the-castalia-delphi-parser

share|improve this answer
No wonder the IDE gets sluggish when you have a couple of experts installed... :( –  Marjan Venema Jun 15 '12 at 19:42
My IDE gets faster after I install an expert or two and then turn OFF the built in IDE code completion. I use grep search for everything these days because the IDE's "code insight" features are so brutal. –  Warren P Jun 16 '12 at 0:56
add comment

You might find that GExperts or CNPack contains almost all the code you need, in one of its editor wizards.

If not, then, those two are the best reference I know for writing IDE plugins. As far as writing parsers, see Andreas' answer.

If you just want better code templates, you could consider buying Castalia, as it has an improved code template feature over the builtin delphi IDE plugin features. Castalia internally uses the Castalia delphi parser mentioned by andreas. It's quite good.

share|improve this answer
add comment

Your Answer


