Friday, 9 April 2010

The best Visual Studio editor feature ever!

In my last post I showed you some of the great features that have been added to the Visual Studio 2010 editor such as Quick Search and Visualisation.

All were great aids to productivity.

However they were small fry compared to the subject of this post.

How many times have you opened up Visual Studio and loaded a project only to struggle to read the code as it is too small ? So before you start, you open up Tool / Options / Fonts and Colors and change the font to suit.

 
 
Now this is no great hardship as you might do this a couple of times a day (unless you have configured it as a default) but it does take a couple of seconds to load.
I have to admit a bias at this point as I spend a great deal of my time demonstrating something in Visual Studio and am forever having to increase the font size so delegates can read the code. As the computer I use might vary by day or even session, I cannot simply set the font size as a default and so the first demo invariably includes me increasing the font size.
So here it is. The best Visual Studio code editor feature ever!
Other products have had it for quite some time and now Visual Studio 2010 has it too.
Ready ?
Open up your project and place yourself in a code window.
Now then. Hold down the Ctrl key and start rolling your mouse wheel.


 
 
Weyhey! How great is that ?
I love it !





See you soon

Phil Stirpé
"I don't do average!"





 


Tuesday, 6 April 2010

New Code editing and navigation features in Visual Studio 2010

Visual Studio 2010 is packed full of new features for the developer. In this post, I will focus on those that are of immediate benefit for code editing and navigation.

I recently reported on TechDays 2010 in Helsinki where I presented on (amongst other things) Visual Studio 2010.

So it's about time I shared some of the goodies with the online community.

Visual Studio 2010 is packed full of new features for the developer. In this post, I will focus on those that are of immediate benefit for code editing and navigation.

I'll begin by creating a new ASP.NET Web project although I could have created a Windows Forms or WPF application. It doesn't matter for this demo.

 
I have added a Button named buttonSend and a Label named labelMessage.
Inside the button's Click event handler, let's say I want to assign a value to the Label. Furthermore, perhaps I am not sure of it's name and am relying on intellisense to help me.
It might begin with lblxxxx or then again I might have begun with the prefix labelxxxx. However, I know that it contains Message. So I can simply type mes and then wait for intellisense to figure it out.

 
Intellisense is now able to use sub strings which is a great feature.
Now let's say that I have added a method called ChangeText that I call from my button's Click event and I want to call it from the Page_Load event also.


 
Now you have to pretend for a moment that you can't actually see the Page_Load event and that there are perhaps hundreds of lines of code here.
Well, no problem. We have another great feature called Quick Search.
Pressing Ctrl and a comma "," opens it up.
I could have searched for "Page" or even "Page_Load". Instead, I tried "PL".

 
That's right. Quick Search understands Pascal notation and so could have let me find LoadCustomerOrderItems by entering a search string on "LCOI".
Aside. I did consider contriving a method name that had a risqué Pascal search string but thought better of it.
Now let's say that I have invoked my ChangeText method from several locations in my code.
One useful feature allows me to simply click on the method name where it is declared and every calling statement is highlighted.


 

This new feature is called Visualization and is a nice touch. However, most times the calling statement isn't within a couple of lines of the method itself.

Time to roll out the Call Hierarchy feature.

Right click the method name and select View Call Hierarchy.




The resulting Call Hierarchy window displays every call to this method. It can even show you the actual line of code that makes the call and it's location.

 
Put all of these features together and you are likely to be much more productive when coding in Visual Studio 2010.
Now you are probably thinking that these features are absolutely brilliant and things couldn't possibly get any better.
Well you would be wrong.
There is an editor feature that is the single most useful feature to be added to Visual Studio since I had hair.
And I am not going to tell you what it is.
Not tonight at least.
I will tell you tomorrow.
Be warned though. It has to be the best Visual Studio code editor feature EVER !


See you soon

Phil Stirpé
"I don't do average!"