SmartOutline is a tool for creating regions in your code without having to use Region / EndRegion tags. Available at http://submain.com/default.aspx?nav=products.smartoutline, this tool took third place in the Microsoft Visual Studio Extensibility Contest packages category.
SmartOutline is a product that’s easier to show you how it works than describe, so let’s look at a few pictures. Let’s say I have a simple if statement. Highlighting it gives me a new pop up, as you can see below.
Clicking on the Create new SmartOutline Region command brings up the following dialog, where you key in the name for your region.
In this example I’ve keyed in “My If Statement” for the name. Assuming I then check the “Collapse region” box, my code will update as you see below.
Clicking the + button will expand my region back to the original state, as you can see.
SmartOutline is useful for hiding long lengths of code that add safety but not value. For example, you might have to do a lot of validation to input parameters, but they don’t add to the real purpose of the method. SmartOutline is a great way to hide that.
You might assume that SmartOutline is altering the source files using Region tags and intercepting them. Not so, as this command window dump of the source file proves:
Some useful situations to use SmartOutine to hide code segments might include:
- Lengthy error handlers
- Long parameter checks
- Long comments
- Code that is commented out, perhaps something for a future version or older version that you’re not sure you want to delete
- Using (or Imports) sections
- Entire Methods
These are just a few ideas, feel free to post a comment with your own thoughts.
My one complaint / wish list item for enhancement is that SmartOutline left aligns the name you give to the smart region. This breaks up the visual flow of indents. You can add spaces yourself when you give the name, for example I could have keyed in six spaces then “ My If Statement”, but if I were to indent the code later SmartOutline doesn’t change to reflect this. You should also know this is a VS2005 tool only, sorry 2003 users.
Overall a useful tool for adding to the readability of your code, well worth the download, and like many of the other tools mentioned so far, it’s free.