tags:

views:

238

answers:

3

I'm in the middle of sorting out a nested set of if/then begin/end pairs, and missing the heck out of CodeRush's structural highlighting (which I used to have in Delphi 6, and loved). Is there a freeware IDE add-in out there that will accomplish the same for Delphi 2007?

Note: I know Castalia does this as well. I tried Castalia a while back, and had trouble w/its stability; also don't really feel like spending $99 at the meoment for just this one feature, (plus maybe the split-editor feature). I may anyway, but thought I'd ask here first to see if there are cheaper alternatives.

Thanks in advance.

+19  A: 

cnPack has a feature like this (draws a tree showing the structure)

Gerry
CnPack is very good at this and it's fast than Castalia which I tried many years ago.
Edwin
Thanks Gerry! This was exactly what I was looking for, and more. : )
Jamo
+4  A: 

Step 1: edit the code to simply visually align the nested blocks according to good practice, with consistent indenting etc.

You might be able to use a "pretty printer" to assist in this one-off activity. There are lots of these out there (including one built in to Delphi 2010 these days, as of Delphi 2010, which is no use to you I imagine). I don't know how many of them work on code snippets, rather than relying on complete units however.

Step 2: if the number and level of nested blocks is such that it remains confusing and unclear, refactor to reduce the number and level of nesting.

The result: code that is readable in any medium, without needing to lean on IDE confections which won't always be available to you (e.g. if using SVN and viewing diffs via WebSVN or some other collaborative code review process that doesn't use an IDE with lots of bells and whistles installed).

Deltics
Thanks for the input. Ironically, this very kind refactoring is exactly what I am working on. : ) May try that "pretty printer" one-off idea though.
Jamo
+1 for the "readable in any medium"... Still not that simple if you throw in proportional vs fixed fonts, tabs vs spaces...
François
...varied length tabs...
Marco van de Voort
Anyone using proportional fonts and tabs is deliberately making things difficult for themselves. The answer to those complications is simple - don't do it.
Deltics
+1  A: 

GExpert is my favorite addin for Delphi. It is free, mature and I use it every day.

Some highlights:

  • VERY fast search in source. This is so valuable for me.
  • Convenient find function dialog by typing some characters en the name.
  • Match parantheses, begin/end, and some other types.
  • Everything can be handled by a shortcut.

Many other things that I don't use so much at the moment.

Roland Bengtsson