05 August 2010

Practical Uses of Visual Studio 2010 Productivity Power Tool Extensions

This is an unbiased review of practical uses for the new Visual Studio 2010 Productivity Power Tool Extensions.  I waited to post this for a good reason; there are numerous posts reviewing and highlighting the functions of the extension, but none about how they are really useful and actually used to increase your productivity.  Most users will figure these things out in time; however, for those who are unfamiliar with this extension, or extensions in general, it's great to get an idea of what what the Power Tool extension do for you.

I credit Scott Guthrie for blogging about a couple of his experiences: Some nice code editor features provided by the VS 2010 Power Tool Extensions. This post does not cover how to install the extension. Please refer to the extension download page, for installation and settings details.

Problems

I have one major complaint about this extension suite. When the extension is enabled (version 10.0.10608.1630 or older), the ability to <Ctrl>+Drag selected code to copy to another location is lost.  Instead, pressing the <Ctrl> key while dragging selected text results in a normal text selection action.  This a rather counter-productive "feature", which I hope will soon be resolved.

What is VS 2010 Productivity Power Tool Extensions?

Visual Studio allows external tools to be integrated into the program, to enhance its functionality. The Power Tools are a suite of extensions, created by Microsoft, that have been very popular, but are not directly integrated into the product.

Microsoft is famous for having countless utilities developed by its employees, for their own purposes. These get shared around their department, and soon to other parts of the company. These are generally not shared with the public, for liability reasons, but if you know or work with a Microsoft consultant, you quickly learn there is a staggering array of amazing things available to employees that you never knew existed. (It's just like the inside of Willy Wonka's factory -- a whole different world of products!)

Several of these cool tools became extensions, and were authorized for sharing with the public. These features could be included in VS 2010 (and will probably find their way into the next version), because they are things not found in most IDEs, and are generally considered "optional options", and not generally useful... until you need them!

Let's get started! I'll follow the outline provided on the extension download page, for cross-reference.

Solution Navigator

This is one of my favorite tools! It combines the functions of the object browser, class explorer, and solution explorer, by presenting an object outline in file-based hierarchy. I find this an invaluable asset, when starting a project involving pre-existing code. Solution Navigator allows me to quickly and easily see a summary of all objects contained in a file. This allows you to see a quick summary of what functionality a single file provides, and how it is significant.
  • Solution Navigator Solution Navigator appears in both a dock window tab, and as a tool tip. The tool tip is extremely handy, especially when you pin the tooltip during debug, or when analyzing an unfamiliar application.
  • Expand Expand a file node, to see its classes and other objects. These can also be expanded, as in the object browser. This is helpful, because solution navigator only shows you what is actually in the file, ignoring things included by the partial keyword.
  • Filter Filter objects to display only unsaved files, open files, and edited files. This is useful for quickly visualizing the impact your edits have made on the application.
  • Scope Scoping allows you to set a specific class or other object as the root! This is great for eliminating the outer nesting, which can get deep and messy, in a hurry. This is helpful when analyzing an unfamiliar application, and during debug.
  • Views Multiple views can be created, allowing you to see many Solution Explorer windows at once. I regularly keep views pinned for edited files, open files, and relationships of the current object (references, callers, callees, derived types, etc.). I use these as a quick reference, to see what impact code changes will have throughout the application. This helps reduce issues revealed by regression testing.
  • Image Preview A great feature for Web application interface developers, working in VS 2010. Image names quickly become cryptic, in large applications. The preview is very helpful to those who do not regularly work with the images, and/or are unfamiliar with the naming convention.

Quick Access

A large part of my day job and consultation services is teaching other developers .NET technologies. Some are new to .NET and have never used Visual Studio. Others are upgrading from .NET 1.1 or other versions, and don't know where to find the tools they need. Ctrl + 3 quickly becomes their friend!

Quick access has relieved me of many phone calls and questions about the VS 2010 IDE, because the tool tells users where to find the feature they need, including:
  • Menu commands
  • Project templates
  • Options pages
  • Tool windows (most frequently asked of me)
  • Open documents (in the tab well)
  • Tasks
  • Any of the above added by extensions
Tip: Pressing Ctrl + 3 again filters the category in which an item is selected. Pressing Ctrl + 3 again reverts to category view.

Auto Brace Completion

This is the Janus of the tool set -- it is extremely helpful and a delight to have enabled, and then becomes maddeningly obstructive, seconds later. I have an ongoing love-hate relationship with this little tool.
  • Helpful Great when typing new code, by automatically inserting closing curly brace "{}", parenthesis "()", square brackets "[]", and angle brackets "&lt;>". This ensures you don't forget to add that critical closing parenthesis, when nesting many functions on a single line. This has saved me the effort of having to count the opening and closing parens, too.
  • Hateful Auto brace completion is a major thorn in my side, when I want to enclose existing code within curly braces. For example, deciding to nest code inside an IF statement requires curly braces. Typing the curly brace causes a closing brace to be inserted immediately after the opening brace, requiring deletion and manual insertion later.

Tab Well UI

Tab Well UI - Vertical tabs, in
alphabetic order, and color-coded
by project.
(Click image for full size.)
Tab Well UI is essential, when involved in wide-spread code changes. This is the best productivity booster, when dealing with medium to large size applications, where you will have many files open. I'll order features by their usefulness to me:
  • Vertical Tab Well: Color coded and sorted by project How did I ever survive without this feature?! This is best used with tool windows docked to the left side unpinned, and on a wide-screen monitor, due to space requirements. This image illustrates a combination of vertical tabs, sorted by name, and color-coded by project.
  • Other featuresVisit the Document Well 2010 Plus blog post, to see a list of other features.

Searchable Add Reference Dialog

One of my pet peeves with Visual Studio is the Add Reference dialog. It seems the .NET assembly want is always dead last to load into the window. Or, I get stuck waiting for the seemingly endless parade of .NET assemblies, before switching to the Projects tab, that loads in a flash. Searchable Add Reference Dialog loads much faster than the default VS dialog, and provides searchability. The dialog also stays open, after adding a reference. The informational layout is also much better.

Highlight Current Line

This is another good/bad extension. Highlighting the line on which your cursor resides is extremely useful, especially when the cursor is placed by a Find tool.

GOOD: Easy to find your cursor! BAD: The default color is dark enough that it obscures other useful highlights, such as the character completion highlight seen when placing the cursor adjacent to parentheses, curly braces, etc.

I highly recommend the following adjustments to the VS 2010 Environment options, not only to prevent obscuring brace completion highlights, but to also make them highly visible:




  1. Open the Visual Studio Options dialog, by clicking menus Tools > Options...  The Tools & Options window appears.


  2. (Click image for full size)


  3. The Environment node of the tree menu should be selected and expanded, by default.  If it is not expanded, double-click it, to expand.  Select the Fonts and Colors tree node.  Settings for fonts and colors appear in the right side of the window.
  4.  In the Display Items list box, select Current Line (Extension).


  5. (Click image for full size)


  6. Click the Custom... button adjascent to the Item Background color selection drop-down list.  A color chooser dialog appears.
  7. I recommend creating a very light color that will not interfere with reading, but is dark enough to be easily seen.  I have set my cutom color to R:220 G:220 B:255.
  8. Confirm your color choice:


    1. If you selected a pre-defined color tile in the left side of the dialog, click the OK button.
    2. If you created a custom color:


      1. Click the Add to custom colors button
      2. Click the OK button


  9. Repeat steps 4-6 for the Brace Matching (Rectangle) display item.  I suggest checking the Bold ckeckbox to use bold font, and then set the item background color to something other than gray -- I use the orange custom color tile (R:255 G:128 B:64).

HTML Copy

If you have a blog and are not using something like SyntaxHighlighter to format code, this extension is extremely valuable. This blog uses SyntaxHighlighter, but HTML Copy has been very useful, when pasting code into HTML and RTF supported e-mail editors, and into word processors. I have found it useful, when creating documentation and training materials.

Triple Click

I assumed the triple-click feature was part of VS 2010. Triple-click, to select an entire line of code. I need not say more.

Fix Mixed Tabs

You must work in a development team with several lead developers, to truly appreciate this one! Some developers are hard-core "spaces only" indenters, and others are firmly rooted in the "tab only" indentation camp. Sit back and enjoy the fireworks that ensue (from a safe distance), when one of these developers starts editing a file that contains the offending indentation.

I prefer tabs, because tab characters are much faster to cursor through, and they are easier to align. This utility makes these troubles go away! No more fireworks... awwww.

Ctrl + Click Go To Definition

Possibly the most useless and counter-productive of the tools, Ctrl + Click jumps to the definition of the object on which you click ()more specifically, on which you click AND release the mouse button). This tool initially drove me crazy, then trying to perform simple cut-and-copy and click-and-drag events. I tuned this off on day 1, and still use the good old (and reliable) F12 key.

Align Assignments

This is a neat utility that cleans up cluttered assignment blocks. This only works when:
  • All selected lines have assignments
  • Selected code contains no empty lines
  • Only one object is declared, per line
Although I like the concept of this tool, I usually end up spending more time tyring to work around the exceptions listed above, because I tend to use it with blocks of declarations/instantiations.

Move Line Up/Down Commands

I have yet to encounter a situation in which I want to shift one or more lines of code one line at a time. I typically want to move up or down many lines, and find the mouse click-and-drag much faster. I consider this generally useless, for my coding habits.

Column Guides

I find column guides are extremely useful, when writing blocks of comments. Because I have a large, wide-screen monitor, I tend to write comment blocks that are too wide to be read on 4:3 monitors. The guides also help when formatting console window output.

I have a guide is permanently affixed to column 80. To keep it unobtrusive, I set the guide color to a light gray -- it does not interfere with reading code, but is visible enough, when I need it.

Colorized Parameter Help

Colorized parameter help is a subtle modification that provides faster reading, because we are accustomed to seeing the code in color.

3 comments:

  1. Hi Mike, thank you for your blog entry! Came in handy! In fact, I blogged about it too, hope you don't mind? I certainly gave you credit where credit is due! Thank you.

    http://www.pchenry.com/Home/tabid/36/EntryID/333/Default.aspx

    ReplyDelete
  2. Thanks for the post, Peter! I am glad to see this blog has helped.

    ReplyDelete
  3. Thanks Mike,

    It helped where I was looking for Brace Matching (Rectangle)!

    ReplyDelete

Please provide details, when posting technical comments. If you find an error in sample code or have found bad information/misinformation in a post, please e-mail me details, so I can make corrections as quickly as possible.