I’ve blogged in the past about the VS 2010 Productivity Power Tool Extensions – a free set of Visual Studio 2010 extensions that provide some nice additional functionality.
You can read my previous blog posts about it here and here. In today’s post I’m going to briefly highlight a few small, but nice, code editor capabilities that are enabled when you install the free extensions (and which I didn’t highlight in my previous blog posts).
Ctrl+Click “Go to Definition”
One of the small, but useful, features that I find myself using a lot with the extensions is the "Ctrl + Click” go to definition feature.
For those of you who haven’t tried it, it enables you to quickly navigate to the definition of a member or type within your code. You can accomplish the same behavior out of the box with Visual Studio by right-clicking on a member/type and then choosing the “Go to Definition” context menu item – or by moving your cursor over a type/member and then pressing the F12 key. But for some reason I’ve found the Ctrl+Click gesture provided by the VS 2010 Power Tool Extensions more natural and faster to use (since for my keyboard the F12 key requires a split-second extra finger move to use – whereas the control key is always in easy reach).
To try out the “Ctrl+Click” behavior, just hold down the “Ctrl” key and use your mouse to hover over a type or member in your code. When the extension is enabled you’ll find that this causes a hyperlink to appear under each type/member you hover over:
Clicking the hyperlink will immediately navigate you to the definition of the type/member within your code:
Note that the “go-to-definition” feature in VS can also be used on a type that you don’t have source access to. For example, like with the DbSet<T> collection I used in my EF “code-first” blog post yesterday:
When you click a type referenced from a binary library, VS will automatically generate a class definition based on the signature compiled into the assembly:
Triple Click Selection
Another one of the “small but useful” features provided with the power tool extensions that I find myself using a lot is the “triple click” feature.
Today with VS you can double-click on a word to automatically select it:
When the “Triple Click” extension is enabled you can now also triple-click on a line to automatically select the entire line:
This behavior has been supported in Word for awhile. Until I saw that there was a power tools extension for it I didn’t actually realize that VS didn’t already do it by default. Well – now you can.
“Alt Up/Down Arrow” Line Movement
Another “small but useful” feature provided by the power tool extensions is the ability to easily move lines of code up/down within the editor.
Simply select either a single line of code, or a block of multiple lines of code, within the editor:
Then hold down the “alt” key, and press either the up or down arrow on your keyboard. This will cause the editor to move the selected code up or down within the editor (without you having to copy/paste or move anything around manually):
This is another one of those features that Word has had for awhile – and which is nice to now have in VS.
Column guidelines allow you display a vertical band within the code editor. This is useful to help identify the maximum size a single line of text should be within your code (for example: to avoid wrapping when printing it out).
The power tool extensions enable you to add a column guide pretty easily. Just cursor over in your code editor to where you want the guideline to be (note: you can see the exact line column count at the bottom of the editor):
Then right-click and choose the “Guidelines->Add Guideline” menu command:
This will then cause VS to show a column guide-line in all code editor windows at that column width – making it easier to see when you’ve written code or a comment that wraps beyond that:
If you want to remove a guideline, you need to move your editor cursor to be at the same column width as the guideline. You can then right-click and use the “Guidelines->Remove Guideline” command to remove it.
In case you missed it, the Visual Studio team last week made a minor update to the VS 2010 Productivity Power Tool Extensions to fix a few bugs and performance issues that people reported with the last release.
Sean has a blog post with more details about the update here. The update included fixes for:
- Poor performance with Solution Navigator searches on large projects. In this revision, we've made some optimizations to the search algorithm. Search will also now only be initiated after two characters are typed in the search box.
- Items in Solution Folders were not sorted. In this revision, they are sorted alphabetically.
- Invoking Quick Access could cause a crash on some machine configurations. This issue has been resolved in the current revision.
- Ctrl+1 & Ctrl+2 were not configurable in the Solution Navigator, which blocked the ability to type @ on some keyboards. This revision provides the Edit.ShowSolutionNavigatorPopupForSelection & Edit.ShowSolutionNavigatorPopupForFile commands which can be rebound using Tools => Options => Environment => Keyboard.
If you have a previous build of the Power Tool Extensions installed you use the “Tools->Extension Manager” menu command, select the power tools extension and then click the “update” button to upgrade to the latest build.
If you haven’t tried out the VS 2010 Productivity Power Tool Extensions yet, I’d encourage you to give it a try. It includes some nice additional functionality which can help save you keystrokes and time as you work within Visual Studio. I’ve only covered a few of the features in this post and my previous two posts – there are a lot more cool things in there that I haven’t blogged about yet.
You can also now enable/disable each individual feature within the extensions pack – allowing you to selectively choose what you want to use. Use the “Tools->Options” menu command, and navigate to the “Power Productivity Tools” tree-view item to enable/disable individual features.
Hope this helps,
P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu