Export (0) Print
Expand All

What's New in Code Editing 

This release of Visual Studio includes new features and enhancements in the text editor, Web page and HTML designer, and XML editor. For information on other new features, see What's New in Visual Studio 2005.

Text Editor

The following features are available in this release:

  • Code Snippets   Visual Studio now provides segments of sample code ready to insert into Visual Basic, Visual C#, or Visual J# projects. To display a list of available code snippets, right-click the active document in the Code Editor and then click Insert Snippet on the shortcut menu. Click the name of the snippet you want, and the code is inserted into the editor, ready for you to modify as needed. To manage the folders in which you store code snippets and to add new snippets, click Code Snippet Manager on the Tools menu. For more information, see How to: Manage Code Snippets.

    Figure 1: Inserting snippets in Visual Basic code

    Insert Snippet user interface
  • Smart tags   Similar to Office smart tags, Visual Studio smart tags make common tasks available that apply to the context of your work. For example, using smart tags you can now correct some common errors in Visual Basic with a click of a button.

  • Refactoring   You can now use tools to update the internal structure of your Visual C# and Visual Basic code, a process called refactoring. Available refactoring options include rename, extract method, extract interface, change signature, and encapsulate field. For more information on C# refactoring, see Refactoring. For more information on Visual Basic refactoring, see Refactoring and Rename Dialog Box (Visual Basic).

  • Track Changes   You can see where you have edited a file in the current IDE session. Edits are identified by a visual indicator in the margin. Lines that have been edited or lines adjacent to deleted lines are marked. When the margin is highlighted yellow, this means that the line was edited and the file has yet to be saved. If the margin is highlighted green, it means that you have saved the file since the line was edited. You can customize the highlight color in the Options dialog box by updating Track Changes before save in Display items on the Fonts and Colors page. You can turn this option off by clearing Track Changes on the General tab of the Text Editor page in the Options dialog box.

  • Bookmark window   This tool window enables you to manage and control your bookmarks. You can put related bookmarks in folders, name them, and re-order them as you see fit.

  • AutoRecover   This feature automatically saves files that contain changes every five minutes. If the IDE shuts down unexpectedly, files with changes are available for recovery. You can customize the AutoRecover options in the Options dialog box. For more information, see AutoRecover, Environment, Options Dialog Box.

  • Document Outline window   The Document Outline window now supports outline views for Windows Forms in addition to ASP.NET Web pages and HTML pages. You can use the Document Outline window to navigate among the controls on Windows Forms while in Design view of the editor. To access this window, on the View menu, point to Other Windows and then click Document Outline.

Web Page and HTML Designer

Visual Studio features a new Web page designer that includes many enhancements for creating and editing ASP.NET Web pages and HTML pages. It provides a simpler, faster way to create Web Forms pages than in Visual Studio .NET 2003.

Visual Web Developer features improvements in all areas of Web site development. You can create and maintain Web sites in local folders, as in Internet Information Services (IIS) applications, or across a File Transfer Protocol (FTP) connection. The Visual Web Developer designer supports all ASP.NET enhancements, including nearly two dozen new controls that simplify many Web development tasks.

Design view of the HTML designer includes many improvements that support new ASP.NET features or enhance the WYSIWYG Web page design experience. Task-based editing using smart tags guides you through performing the most common procedures with controls, such as data binding and formatting. You can edit the new ASP.NET master pages visually. Template editing has been improved to make it easier to work with data controls as well as new controls such as the Login control. Editing HTML tables for layout or to display columnar information is now easier and more intuitive.

Visual Web Developer produces XHTML 1.1 markup by default. At the same time, you can select from a list of schemas that help you produce markup to match the abilities of different browsers or standards. HTML validation points out markup that does not conform to the selected schema.

The HTML editor also provides options to allow you to precisely control the format of all HTML and of ASP.NET markup. Formatting is preserved exactly when you switch views.

You can easily move around your documents with the new tag navigator that shows you where you are in the current hierarchy. Using the tag outline feature, you can collapse sections of the document, such as large tables.

Figure 2: Tag navigator in the Web Page Designer

Tag navigator in Web Page designer

For programming, the code editor provides better productivity with enhanced IntelliSense. Visual Web Developer supports both ASP.NET models for writing the code for an ASP.NET Web page, including the single-file page model and the improved code-behind model. You can reference components automatically by simply adding them to a folder in your site. Data binding is substantially easier, and in many cases requires no code at all. At the same time, you can easily access data in databases, XML files, or business objects. For more information, see What's New in Web Development for Visual Studio.

XML Editor

A new XML editor is available in this release of Visual Studio. This editor takes advantage of the power of the System.Xml and System.Xml.Xsl classes in the .NET Framework and conforms with XML standards. Some of the features included are:

  • Full XML 1.0 syntax checking    XML and DTD syntax errors are reported while you type, and detailed descriptions appear in the Error List Window.

  • Validation   Many XML editors require that you manually check for XSD, DTD, or XDR validation errors. The Visual Studio XML editor uses a validation engine that can perform XSD or DTD validation while you type.

  • Code snippets   The XML editor adds dynamically generated code snippets based on your XML schemas. Press the TAB key after the element name to automatically populate the required attributes and child content. Many useful XML snippets are also provided, including a snippet for building new code snippets.

  • Flexible schema association   The editor searches for XML schemas and automatically associates them with your document. The editor can find schemas in a schema cache directory and in your project, or by using schemaLocation attributes or user-specified locations.

  • XSD-based IntelliSense   All IntelliSense is based on your XML schemas and the editor provides accurate IntelliSense with full support for XSD.

  • Auto-insertion   The editor inserts attribute quotes and end tags automatically, as well as required namespace and xsi:type attributes.

  • Auto-formatting   The editor supports the Format Selection feature, available on the Advanced submenu of the Edit menu, to auto-format when you type the closing tag or paste from the Clipboard. This feature also auto-formats code snippets.

  • Configurable text colors   The editor includes several customizable color options for text in the Fonts and Colors, Environment, Options Dialog Box that are separate from HTML color options so you can customize the XML colors differently.

  • Create XML schema   The editor can infer a schema from existing XML documents, which makes XSD schema design much easier. The editor can also convert your DTD or XDR schemas to XSD.

  • Editing XSL   Additional features and color-coding for XSL keywords are available when you edit XSL. In addition, a two-pass validation algorithm is applied to ensure better XSD validation and IntelliSense with the XSLT style sheets.

  • Secure XSL transformations   The Show XSL Output feature enables you to perform your XSL transformations securely with a single button click so you can preview the results. The editor supports writing HTML to a Web browser window and XML and text output to another code editor.

  • Debugging XSL   The XSL debugger is new to Visual Studio and is built on the IL generating XslCompiledTransform class provided in the .NET Framework. You can now step from your C# or Visual Basic applications directly into your XSLT transforms. The XSL debugger is based on the CLR debugger; it enables you to do all the things you can normally do with a debugger, including evaluating XPath expressions in the Watch window.

For more information, see XML Editor.

See Also

Community Additions

Show:
© 2014 Microsoft