Delta Engine Blog

AI, Robotics, multiplatform game development and Strict programming language

How to write a CodeRush plugin: Commenter helps you to comment your code

Hey everyone. I've been busy doing some smaller projects and finishing up some things.

I just posted an article on Writing a CodeRush plugin: Commenter will help you to comment your code and make it easier to navigate through your code.

The program, including an installer and the complete sourcecode can be downloaded there. If you got any questions about this, please ask them there.
If you just want to download the tool or the sourcecode, you can do it also here: CR_Commenter Installer, CR_Commenter Sourcecode.
Remember you will need CodeRush to use this plugin.

We also have now a nice idea for a nice little game we might release just before chrismas. Last year we made just before chrismas.

I've also updated My Bookmarks and the Blogroll.

Click here to download v1.7
And here is the sourcecode for CR_Commenter v1.7

Older versions: v1.4 (VS2003 support), v1.5, v1.5 source


  • Initial version: 2004-12-08 (v1.0)
    Initial version supports commenting, adding header block and basic XML generation. Wrote the CodeProject article.

  • First Update: 2004-12-12 (v1.1)
    Lots of smaller improvements (more generated comments, click on auto generated comments to jump to function, etc.), very stable now!

  • Second Update: 2004-12-17 (v1.2)
    New version 2004-12-17 with some minor bug fixes (wrong comments, etc.)

  • Third Update: 2005-04-04 (v1.3)
    Several new features and some bug fixes, see TODO list. Supports now newest CodeRush version, auto XML comments work now for non-public methods too and will produce better comments. Also added better support for non c# files like fx, cpp, h, etc. If CodeRush does not parse them, Commenter will do it and still generate nice comments and the header section!

  • Another Update: 2005-10-27 (v1.4)
    Basically I was annoyed of some old bugs like namespace commenting (which produces a compiler warning in vs2005) or auto-commenting of initialized variables inside methods with xml (again, a compiler warning, but this happend only if all commenting features were turned on). I fixed those things and added a couple of cool new features:
    • Fixed: No more Xml Generation of namespace sections or for variables in methods.
    • Fixed: All sections are updated, the first one is not skipped anymore.
    • Fixed: Using directives section generation works now fine with multiple lines for a single using statement.
    • Fixed: Structs, enums and switch statements to now correctly generate comments and xml comments.
    • New feature: Added a bunch of keywords to translate abbrivations to full names. This one is very cool, it makes the Commenter look smart because it will automatically generate meaningful comments for methods and parameters. For example "xPos" becomes "X coordinate position" or "bmp" becomes "Bitmap", "descNum" becomes "Description number", etc.
    • Also made some of the choices smarter where to generate which xml parameters, e.g. variables and classes do not longer use the return xml comment.

  • And another update: 2005-12-28 (v1.5)
    • First version for VS2005 and using .NET 2.0 now for supporting generics and anoynmous delegates (more useful comments now inside of anoynmous functions and code blocks defined there).
    • Fixed again: No xml generation inside of methods (recent CodeRush version changed its behaviour somehow). Check is now performed inside the recursive method, this fixes all older issues too.
    • When commenter is disabled the globol hotkeys don't work anymore now.
    • Version number in options and a link to check if any new updates are available
    • Hotkey for generating comments and XML: Ctrl+1. Saves you typing '}' and doesn't require you to go to the last line of a block all the time.
    • If using defines in the using statements the surrounding region is now generated properly. Also adds automatically the #if DEBUG and #endif statements (which I use to exclude NUnit from the release build) around using NUnit.Framework, which is often generated by adding the namespace automatically or using some template.
  • Update to support C# 3.0/LinQ May 2006 CTP: 2006-06-08 (v1.6)
    • Added add namespace feature to support C# 3.0 (CTP May) in VS 2005.
    • Added action hint effects for commenting, regions and namespace adding.
    • Improved options screen a little, added more hotkeys and help
    • More hotkeys available, Ctrl+1, Ctrl+2, Ctrl+3, Ctrl+F9, Ctrl+.

  • Added some features and fixed some old bugs: 2006-08-06 (v1.7)
    • Bugfix: Long comment lines got now properly cut off (doesn't go over 80 anymore)
    • Bugfix: Fixed autogenerating header when user modified or shortened it
    • New feature: Generating comments will not longer expand any collapsed regions, at whichever file position we are. This means if you generate comments for a whole file, all collapsed regions will be collapsed again after everything was modified.
    • New feature: Parameter comment generating works now always, no matter if you add or remove parameters. This is a quite useful feature, even refactoring parameters is supported (moving, removing, adding stuff).
    • New feature: Autosorting feature for using directives, also fixed couple of using issues.
    • Improved hotkeys a little:
      • Ctrl+1: Does perform the same action as closing a block with '}', but can be used anywhere inside a method or class.
      • Ctrl+2 or Ctrl+.: Adds a namespace for the current word at the cursor. Used to support automatically adding a namespace in C# 3.0
      • Ctrl+3: Autogenerate region around the current block (method, property, constructor, etc.), for selections use Ctrl+R.
      • Ctrl+4: Toggle collapsing and expanding current selection.
      • Ctrl+5: Toggle collapsing and expanding everything at top level (also supports sub regions).
      • Ctrl+6 or Ctrl+F9: Update all comments and xml blocks for the whole file.