New Features in the Microsoft Visual Studio 2010 Code Editor

Introduction

Many of the new features in Microsoft Visual Studio 2010 are related to developer productivity. And when it comes to the code editor, almost no other window in Visual Studio puts equal hours into the clock. Thus, Microsoft needs to make sure developers are productive, and stay so from version to version.

In Microsoft Visual Studio 2010, the code editor has gotten a facelift with the new, WPF based implementation. Alone, this would have been a nice technical advancement, especially when considering that all the previous features are still there. The new editor technologies also help provide cleaner visualizations and zooming (as you will see later). On top of that, Microsoft wanted to listen to developers and add additional features to the editor.

These new features both help developers write code and navigate in applications that are getting larger and larger. The features also help you to be more productive on modern hardware. Most of the new features are available to all supported languages: C#, Visual Basic .NET, C++ and F#.

A WPF Based Code Editor

Technically speaking, the biggest change in Visual Studio 2010 code editor compared to the previous Visual Studio versions is the all-WPF editing window (Figure 1). Migrating from a traditional Windows GDI interface to modern WPF technologies allows many advanced improvements in the future. Programming custom extensions is also easier, thanks to the new Managed Extensibility Framework, MEF.



Figure 1. Visual Studio 2010 has a new WPF based code editor

However, in the 2010 version the improvements in visualization features are still quite few. Nonetheless, cleaner views and the ability to zoom freely are features that help developers code more efficiently and pleasantly. For instance, a small but useful gray highlight (with the default color scheme) allows you to more easily see the block of code that is to be collapsed using the code outlining feature. The shading appears when you move the mouse over the minus sign on the left code editor margin (Figure 2).



Figure 2. A (slight) gray highlight helps in identifying blocks of code

The zooming feature is now available in Microsoft Visual Studio 2010 code editor, which is without doubt the most important text window in the product. However, the Visual Studio documentation also mentions zooming should be available on other text based windows such as Output and Immediate windows. However, this appears not to be the case in practice, as zooming won’t work the same in these windows as in the code editor.

Nevertheless, zooming in the code editor works just fine. If you are a mouse person, then hold down the Ctrl key while scrolling the wheel of your mouse to zoom in the code editor, just like for instance in Internet Explorer. If you instead prefer to use the keyboard, then the shortcut keys Ctrl+Shift+comma and Ctrl+Shift+period are your friends (Ctrl+Shift+, and Ctrl+Shift+.). The maximum zooming level is 400% (this ought to be enough); at the other end, 20% is the minimum zoom.

Notice also how there is a small zoom box at the bottom left of the code editor window (Figure 3). From there, you can select the zoom level you prefer. Of course, you can still change the font and font size used by the code editor; this affects how large the font will appear at 100% zoom. By the way, the new default font is now named Consolas, with a default font size of 10 points.

[Figure 3 – Zoom Box.pngFigure 4 – Vertical Edits.png]

Figure 3. The zoom box allows you to both see and change the zoom level in the editor

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read