Поделиться через


What's New in the Visual Studio 2010 Editor

This page lists new and enhanced editor features that are available in Visual Studio 2010.

New in Visual Studio 2010

Enhanced Docking Behavior

Document windows are no longer constrained to the editing frame of the integrated development environment (IDE). You can now dock document windows to the edges of the IDE, or move them anywhere on the desktop (this includes a second monitor). If two related document windows are open and visible, for example, a designer view and an editor view of the same Windows Form, changes that were made in one window will immediately take effect in the other window.

Tool windows can now move freely between docking at the edges of the IDE, floating outside the IDE, or filling part or all of the document frame. They remain in a dockable state at all times.

For more information, see How to: Arrange and Dock Windows.

Zoom

You can zoom in or out in any code or text editing window by pressing and holding the CTRL key and moving the scroll wheel on the mouse. The zoom feature does not work in other windows.

Box Selection

In previous releases of Visual Studio, you could select a rectangular region of text by holding down the Alt key while selecting a region with the mouse. You could then copy or delete the selected text. VS 2010 adds the following new capabilities to the box selection feature:

  • Text insertion: Type into a box selection to insert the new text on every selected line.

  • Paste: Paste the contents of one box selection into another.

  • Zero-length boxes: Make a vertical selection zero characters wide to create a multi-line insertion point for new or copied text.

You can use these capabilities to rapidly operate on groups of statements, such as changing access modifiers, setting fields, or adding comments. For more information, see How to: Select and Change Text.

Call Hierarchy

Call Hierarchy, which is available in Visual C# and Visual C++, displays the following parts of your code so that you can navigate through it more effectively:

  • Calls to and from a selected method, property, or constructor.

  • Implementations of an interface member.

  • Overrides of a virtual or abstract member.

This can help you better understand how code flows, evaluate the effects of changes, and explore possible execution paths by examining complex chains of method calls and other entry points in several levels of code.

Call Hierarchy is available at design time, unlike the call stack that is displayed by the debugger.

The member name appears in a pane of the Call Hierarchy window. If you expand the member node, Calls To member name and Calls From member name subnodes appear. If you expand the Calls To node, all members that call the selected member are displayed. If you expand the Calls From node, all members that are called by the selected member are displayed. You can also expand the subnode members into Calls To and Calls From nodes. This lets you navigate into the stack of callers.

For more information, see Call Hierarchy.

You can use the Navigate To feature to search for a symbol or file in the source code.

Navigate To lets you find a specific location in the solution or explore elements in the solution. It helps you pick a good set of matching results from a query.

You can search for keywords that are contained in a symbol by using Camel casing and underscore characters to divide the symbol into keywords.

For more information, see How to: Search for Objects, Definitions, and References (Symbols).

Highlighting References

When you click a symbol in the source code, all instances of that symbol are highlighted in the document.

The highlighted symbols may include declarations and references, and many other symbols that Find All References would return. These include the names of classes, objects, variables, methods, and properties.

In Visual Basic code, keywords for many control structures are also highlighted.

To move to the next or the previous highlighted symbol, press CTRL+SHIFT+DOWN ARROW or CTRL+SHIFT+UP ARROW.

For more information, see How to: Use Reference Highlighting.

Generate From Usage

The Generate From Usage feature lets you use classes and members before you define them. You can generate a stub for any undefined class, constructor, method, property, field, or enum that you want to use but have not yet defined. You can generate new types and members without leaving your current location in code, This minimizes interruption to your workflow.

Generate From Usage supports programming styles such as test-first development.

For more information, see Generate From Usage.

IntelliSense Suggestion Mode

IntelliSense now provides two alternatives for IntelliSense statement completion, completion mode and suggestion mode. Use suggestion mode for situations where classes and members are used before they are defined.

In suggestion mode, when you type in the editor and then commit the entry, the text you typed is inserted into the code. When you commit an entry in completion mode, the editor shows the entry that is highlighted on the members list.

When an IntelliSense window is open, you can press CTRL+ALT+SPACEBAR to toggle between completion mode and suggestion mode.

For more information, see List Members.

See Also

Concepts

What's New in Visual Studio 2010

Other Resources

Editing Code and Resource Files