Visual Studio 2005 has several text editors or word (code) processors. Each text editor is based on a common core that provides the basic set of functionality for each editor such as the selection margin, the ability to collapse nested items, and colorization. Each editor derives from this core and is customized to give you the editors for code (C#, VB, and so on), the XML editor, the HTML (or aspx) editor, and style sheet editor. The Code EditorsIt is the code editor, for our money, where the magic happens. It is here that you get down to business leveraging your favorite language to define objects and their functionality. Of course, you can write code outside the Visual Studio editor, but why would you? You can also write a novel using Notepad or do your taxes by hand. A good code editor means higher productivity, plain and simple. and Visual Studio has some of the best code editors around. The code editor is front and center when you're working on code. It handles indentation and whitespace to make your code clean and readable. It provides IntelliSense and statement completion to free you from having to look up (or memorize) every object library and keyword. It groups code into blocks; it provides color codes for keywords and comments; it highlights errors; it shows new code relative to previously compiled code. All in all, the Visual Studio code editor does quite a bit to keep you productive. The C# Code EditorFigure 2.13 shows the C# code editor. Some items to note include the following:
Figure 2.13. The C# code editor.The Visual Basic Code EditorThe Visual Basic code editor works much the same way as the C# editor. Figure 2.14 shows the same code as in Figure 2.13 written inside the Visual Basic code editor. Some of the differences between the editors are as follows:
Figure 2.14. The Visual Basic code editor.Editor CustomizationsNearly every aspect of the text and code editors can be customized to your every whim. From our experience, it seems no two developers see their code the same way (except presenters and book writers, of course). From the Options dialog box, you can change the editor's background color or the color and font of various text within the editor; you can turn on line numbering, manage indenting and whitespace, and the list goes on. Figure 2.15 shows the Options dialog box set for Fonts and Colors. From here, you can tweak the many display items in the editor in terms of their color, font, and font size. Figure 2.15. The Options dialog box set to Fonts and Colors.If you dig a little deeper in the Options dialog box, you will come across the Text Editor node in the option tree. From here, you can manipulate even more settings for the text editor. For example, you can remove the horizontal procedure separators in the Visual Basic editor or turn off the automatic reformatting of code by the editor. Even better, you can control how the editor automatically formats your code inside the C# editor. If you like to see all your curly braces on separate lines or prefer them to start on the line that starts the block, you can do so from here. Figure 2.16 shows some of the options available for formatting C# inside the editor. Figure 2.16. Controlling code formatting from the Options dialog box. |