You could say the code editor is the most important feature of any development experience. After all, that’s what lets you create, see, and change your code. Without a code editor, no other features matter in an IDE. Around the editor is built the rest of the development environment.
Last week, we looked at three new features in Visual Studio 2010: multi-monitor support, multi-targeting, and code navigation. This week I’d like to spend a little time talking about improvements to the code editor in Visual Studio 2010.
IntelliSense is, in some ways, the most easily-accessible documentation of types and members. Before IntelliSense, development commonly meant you had your favorite class browser close by to help you find the type or member you were looking for. With IntelliSense, typing a period or Ctrl-J brings up everything you want to know about types or members.
In Visual Studio 2010, IntelliSense changes allow you to search based on any substring in the type or member, rather than strictly alphabetically. As you can see below, when I type in “Aircr”, I get suggestions of “Aircraft” and “AircraftStatus”, along with “AddToAircraft” and other methods that contain, but don’t start with “Aircr”.
IntelliSense now also supports finding members through their Pascal casing. Below, I can type in “ATP” to find “AddToPassengers”, “AddToPassengerStatus”, and “AddToPeople”.
Block Select and Block Edit
Sometimes you have to make the same change to many consecutive, similar lines of code at once. Perhaps you’re changing an access modifier or string literal in C#, VB, or C++ code, or perhaps you’re changing property values in HTML or ASP.NET. Block select lets you select columns of text and edit them as a group, rather than one line at a time. You can select columns of text in a box by holding down the Alt key while selecting with the mouse.
Once your block is selected, you can delete or insert text on all lines of the selection. If you’d like to simply insert something (such as a folder in a path string or a keyword), you can create a block selection with zero width and start typing; your typing will be inserted on all lines of the block selection. You can also use this feature to quickly add or delete a tab to a block of code as well.
You may have used the zooming features in Word, your internet browser, or other applications to quickly find your way around a large amount of content or highlight an area easily for others. Now, you can use the same gesture to zoom in the Visual Studio code editor. Hold down the Ctrl key and scroll with your mouse wheel to adjust the zoom factor. You’ll see the zoom factor change in the lower left corner of the editor window at the same time.
If you sometimes present to others, conduct code reviews on projectors, share applications using LiveMeeting or other programs, or build videos using screencasting programs like Camtasia, zoom can be an indispensible way to help your audience see your code clearly. For visual people, zoom can be used to quickly find a piece of code or understand the contents of a large file. And, while this feature isn’t new to Visual Studio 2010, collapsing code blocks in the editor can help with code understanding as well:
In my next post on Visual Studio 2010’s productivity improvements, we’ll focus on features built specifically for certain languages and tasks. Don’t miss the next one if you write for the web or build C++ MFC apps.