Super Simple Documentation in Delphi

Super Simple Documentation in Delphi
Save the pastebin document as xmld_XMLDoc_Summary.xml in 
XE..XE5 - RAD Studio\code_templates\Delphi
XE6... - Embarcadero\Studio\code_templates\Delphi
... or wherever your standard Delphi directory is.

Create a blank line above a class method or property in the interface declaration, then type xmld and fill in the blanks. If you need more than one line, add a line break and /// at the beginning of next line.

  protected
    /// Current log line number being
    /// processed

    property LogLineNo: Integer read FLogLineNo write FLogLineNo;

Now, hover your cursor over the method or property anywhere in your code and read what you just filled in ;)

Yes - you can add a lot more XML doc attributes - but for the bare minimum - this is pretty quick and easy.  You can of course change the magic xmld keyword to anything you prefer as well.
http://pastebin.com/BAEUYEST

Comments

  1. Stefan Glienke - Indeed, as DI allows for proper full-blown xmldoc.  However - it seems that a lite version of DI no longer is installed by default in XE6 and XE7?

    ReplyDelete
  2. AFAIK, there is a quite similar template included with Delphi named "summary". Although it seems to have invoke set to "manual".

    ReplyDelete
  3. Uwe Raabe - I should consult you before I even post! :)  I hadn't noticed that one before.
    One difference is that mine originally was designed for one-line shorties.

    ReplyDelete
  4. Lars Fosdal One small correction: the Embarcadero\Studio folder is since XE6 and not XE7

    ReplyDelete
  5. Lars Fosdal I didn't mean to diminish your solution - just mention an existing alternative. Regarding the consulting: you are always welcome.

    ReplyDelete
  6. Uwe Raabe - Nor did I feel that you did - I am just at awe of your level of knowledge :)
    Oh, and Thanks!

    ReplyDelete
  7. Unfortunately, I turn off IDE completion due all the distraction it brings along with writing ifs and fors. A hotkey like Ctrl-Shift-C would be nice. Am I missing how to set the hotkey for this completion.

    ReplyDelete
  8. Ilya S You can turn off autocomplete in which case no longer expands the template.  Instead you would press to expand the template.  Not sure if that is an improvement.  Depends on your typing style I guess.

    ReplyDelete
  9. Thanks Lars Fosdal! I'll try it.
    Btw, does Ctrl-D Ctrl-Chift-D work in XE6-XE7 if DocInsight is not installed? I could test myself, but have it installed. If it doesn't work it sounds like a valid FR, doesn't it?

    ReplyDelete
  10. Ilya S - Ctrl-Shift-D does nothing if DocInsight is not installed.

    ReplyDelete
  11. Apparently Ctrl-Shift-D doesn't work if DocInsight ia absent. Your suggestion Lars Fosdal to use Tab for completion suits my needs, thanks!

    ReplyDelete
  12. BTW - Marco CantĆ¹ - Are you aware that the XML Schema referenced in the template.xml files, no longer exists?

    http://schemas.borland.com/Delphi/2005/codetemplates"
    version="1.0.0">

    ReplyDelete
  13. I really miss DI Express in XE6 :( But I guess I can get used to these templates, thanks for the tip :)

    ReplyDelete

Post a Comment