The opinions expressed in these materials are my own and are not necessarily those of Microsoft.
Copyright © Microsoft Corporation. All rights reserved. Unless otherwise indicated, all source code provided is licensed under the Microsoft Public License (Ms-PL).
Keyboard: CTRL + K, CTRL + H [toggles the shortcut on or off]Menu: Edit -> Bookmarks -> Add Task List ShortcutCommand: Edit.ToggleTaskListShortcutVersions: 2008,2010Published: 6/8/2010Code: vstipTool0030
You can create shortcuts to lines of code that you want to revisit later. It's easy! Just go to any line of code then press CTRL + K, CTRL + H (toggles the shortcut on or off). This will create the shortcut glyph in the Margin like this:
To see all your shortcuts, go to the Task List (CTRL + \, T) and choose "Shortcuts" from the drop-down list:
Now you should see all your shortcuts:
You can now treat them like any other task and set priority levels as well as mark them complete:
NOTE: You can RIGHT CLICK any task and choose "Delete" to remove it from the list.
Wanted to get your input on this one. I'm working on the new Tips and Tricks book and had a concept for how I want to show the information. The format is basically the same it is now except heavier use of graphics so instead of SHIFT + ALT + [UP or DOWN ARROW] I use pictures instead. I'm also going to include keyboard mappings if they are different than the default and add mouse commands. There will also be some graphic to represent the version(s) supported and, finally, a list of related tips. This is a VERY rough draft but wanted to get folks engaged early on to get your thoughts.
Here is the prototype tip that I was thinking of:
Zero-length box selection
Related Tips: vstipEdit0006, vstipEdit0007, vstipEdit0008
Let's assume that you have a situation with some variables like the ones below and you want to make them all public:
The answer is a zero-length box selection. Hold down your ALT key and Left Mouse Button, then drag straight down. Note the line that is created:
Release the ALT key and the Left Mouse Button. Now, just start typing:
Bask in the wonder and glory that is the zero-length box selection! :)
Keyboard: CTRL + ALT + I Menu: Debug -> Windows -> Immediate Command: Debug.Immediate Versions: 2008,2010 Published: 9/28/2010 Code: vstipTool0095
When using with the Immediate Window, you can work with class and object members directly:
You can use any method or property as long as it is in context. So, for example, when you are in debug mode, you can call any method that is in scope:
A less-known feature is you can work with properties and methods while in design mode. If you have static methods on a class, for example, you can just execute them right away:
For object members, obviously, you need to create an instance of the object before working with the members:
WARNING: When working with members at design-time a build will occur. This could have unintended consequences so make sure you have experimented with this feature a bit before you use it.
Menu: Tools -> Options -> Text Editor -> GeneralVersions: 2008,2010Published: 4/14/2010Code: vstipEdit0048
Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!
To use this feature you need to have "Track Changes" and "Selection Margin" checked.
Okay, so ever wonder how those colors to the left of your code actually work?
Let's begin with a clean slate. Notice there are no colors:
Now let me add a couple of lines of code:
So, all new code will turn yellow to show you what part of the document is "dirty" (unsaved). If we save the code then we get this:
The "clean" (saved) indicator will remain as long as you have the file open. When you close and reopen the file, this is what you get:
New in VS2010: There is now an orange indicator that is used to show a change that is different from the saved version. This was added for the scenario where a user does an undo after a save operation:
Here is a grid to help keep the scenarios straight:
Very cool stuff!
The last one! This series is DONE! Keep an eye out for more my next series in a month or so.
Wecast is here and files are attached.
This post is a bit overdue but better late than never. So let’s talk about Visual Studio Update 1…
Soma originally introduced Update 1 in his November 26th post here:
Since some of you may want to install this update immediately there are a few options for you.
From inside the IDE, go to Tools | Extensions and Updates:
Then look under the updates section and install from there:
If you want a more direct route you can click this link: http://go.microsoft.com/?linkid=9821199
You will get this dialog and can just click Run to execute the small .EXE and begin the online install:
Although many believe you can only install via online resources this is actually not true. A quick look at vsupdate_KB2707250.exe /? shows us the /layout switch:
So when I run vsupdate_KB2707250.exe /layout c:\ziptemp\vsup1 on my system this is the dialog I get:
This will download the source files to the designated location so you can make them available on a network share, thumb drive, or other media for stand-alone installation.
The most obvious question is, “Why should I care?” Despite the bug fixes and new features, this particular update represents a major shift in the timing for delivery. We have now committed to a shorter update cycle so we can deliver critical fixes and incorporate new features more quickly. What this means for you in real terms is that blocking issues may be resolved much more quickly and/or you will get a new feature that will help you get work done better/faster/stronger.
So what exactly did we deliver? Fundamentally there were two things we provided: Bug Fixes and New Features. You can find all the details here:
I’m going to repeat the bug fixes here and then address the new features in another article right after this one.
After an extended period of time looking for the list of bug fixes included in the package I was initially unable to find a comprehensive list anywhere. It looks like the team recognized there was a gap and updated the KB article on 1/13 to include all the relevant information. I’ll just repeat the information here verbatim for convenience.
The original Code Map was introduced in the product with Visual Studio 2012 Update 1. You need to read my original post before moving on:
My assessment at the time was that it was a good feature but had poor performance and didn’t really add much value relative to Dependency Graphs. With debugger integration however Code Maps have definitely come into their own and the performance is very good.
Note: Code Map Debugger Integration is a feature in the Ultimate edition of Visual Studio.
Assuming you have a handle on Code Maps now let’s see how the debugger integration works. First, I’ll take the TailSpin Toys sample code and set a breakpoint within the code base (ShoppingCart.cs, line 61):
I’ll press F5 and add an item to my cart to trigger the debugger:
Ordinarily, we would step though the code and hope we remember how we got to a particular place. Those days are gone! Now we can turn on the Code Map feature while debugging:
You can also find this on the Menu Bar at Debug | Show Call Stack on Code Map:
If we take a closer look at the current map, we can see that it shows how we arrived at the current call (the squares above the last AddItem call) and our current location (yellow arrow). Although the current location indicator is partially covering it, you can also see the breakpoint indicator:
Stepping through the code we see the map keeps updating so we don’t have to keep the path in our heads:
The Code Map will continue to update for our debugging session showing where we have been and where we currently are in the call stack:
The graphs can get quite large:
For this reason it’s important to use the map tools at your disposal. The context menu items when you Right Click any node are a great example of common tools:
You can Double Click any node to view the code from that location in the stack. A green arrow will indicate your current position:
If you happen to choose a node that isn’t part of the current active call stack then you will get a slightly different indicator:
When you stop debugging the Code Map will be preserved so you can save it if desired and keep a map of the code base you just went through. I think this is an exceptional addition to the debugging experience!
Traditionally when you want to view the definition of a method you place your cursor inside the call:
Then press F12 to go to the document where the definition exists:
But what if you don’t want to leave your current location:
No problem! Just take advantage of the new Peek Definition feature by pressing ALT+F12:
This feature will actually open a small window below the method call so you can view its definition. This makes it very easy to view a definition without losing your place in the current document.
If I want to go to another definition from here I can just place my cursor inside the item:
And press ALT+F12 again. It will update the window to show the new definition:
But something else also happens. Notice the dots showing up in the top right-hand side of the window:
The Peek window is keeping track of the definitions you have been to so you can navigate easily between them:
You can use your mouse to click any of the dots or the forward and back links. Also, as you can see, you can use CTRL+ALT+Minus(-) and CTRL+ALT+Plus(+) to move backward and forward respectively.
I’m not sure what the upper limit is on number of entries it will remember but at 18 entries the More indicators showed up to allow navigating through a higher number of definitions. I suspect the number of entries can go quite high:
The next most obvious question is: “Can I edit the code in this definition window?” Currently the answer is “no” however it is something that is being considered before we ship. Let me know your thoughts.
This is a collection of about 4 or 5 tips I wrote on using Box Selection for my book a while back. I think a lot of folks don’t know all the great things you can do with with this feature because they just don’t think about it much.
The traditional use of this feature is to simply have some text you want to get rid of. Let’s say I have multiple lines of code:
And I need to get rid of some extra text. I can simply hold my ALT key and my left mouse button to highlight a vertical selection:
(NOTE: You can also hold the ALT key and use your ARROW keys to get the same result)
Now I can just press the DELETE key to remove the extra text:
While this is the traditional use of Box Selection there is much more here. Let’s take a look at some other things you can do.
Let’s say I want to change “bubba” to “cool” in the example code. Normally I would have to go to each line and replace the entries individually. However, in Visual Studio 2010, we introduced a feature called Zero-Length Box Selection. To use it, just go to where you want to start changing multiple lines of code:
Now you can use ALT+UP (or DOWN) ARROW to make a Zero-Length Box Selection:
(NOTE: You could also use ALT+Left Mouse to do the same thing but it’s a lot harder)
This creates a multi-line cursor (the thin blue line) you can use just like you are editing a single line of code. In this example, just press the BACKSPACE key to begin changing this text:
As you can see, all the lines are changed at the same time! Continue to remove “bubba” and then replace it with “cool”:
Now you have a multi-line cursor you can use to modify several lines at the same time. I love using this feature!
There is actually a faster way we could have replaced “bubba” with “cool” than the example above. Let’s reset the code:
Now, using ALT+Left Mouse or ALT+ARROW keys, select all the “bubba” entries:
And just type the word “cool”:
The word “bubba” will be instantly deleted and you will get a multi-line cursor that allows you to put in the new text.
Another thing you can do is replace one set of text with another. Let’s say we have some variables:
And we want to replace “Int16”, “Int32”, and “Int64” with just “int”. No problem! Just select all the “int” entries and copy (CTRL+C) them:
Now select the destination:
And paste (CTRL+V):
It will replace the old contents with the contents you copied earlier.
You can also use a single selection to replace multiple entries. If I have the following sample code:
I can copy the word “double” (CTRL+C):
Select all the “int” entries:
It will replace every “int” with the word “double” for every line! Another one of my favorites.
As you can see there are a lot of things you can do with Box Selection and Zero-Length Box Selection. Give it a try!
Really nice article Agile meets Waterfall. It's technology is Java but easily translated to our world: