Each user of Visual Studio picks a developer profile on first run. Discover what settings this profile affects in the IDE. This tour show how to reset the profile. Walt provides details about the various margin tools in the IDE and how they provide important indicators for your code sessions.
- As a programmer, you spend a sizable portion of your workday writing text. Oh, sure, we call it code. But think about it for a minute. Your code is just specialized text. And, you probably write other text documents, too. For example, HTML, XML, and JSON files are common in software projects. So, it won't surprise you to learn that Visual Studio has lots of text editors. In this video, I want to show you some of the basic settings that you can configure for any text editor. Now, I know that if you are a Visual Studio veteran, you've got your favorite settings.
Throughout this course, I'll share my preferred configurations with you. If you are new to Visual Studio, my goal is to show you how to set it up so that writing code is as effortless as possible. I'm in a Solution named ConfigureEditor that has a single project with the same name. I'll open this program.cs file, and then I'll talk about setting my Visual Studio to the default settings. When you start Visual Studio for the first time, it asks you to choose a default settings profile. I'm going to reset my Visual Studio to the defaults.
To do that, I go to the Tools menu, and choose Import and Export Settings. The setting I want is this last item, Reset all settings. I'll click Next. Visual Studio prompts me to save my current settings. I encourage you to do this periodically, so that you can always recover your settings. I choose the name of the file. I'll leave it at the default. I'll leave it at the default location for storing it. And then I'll click on Next.
When you started Visual Studio, you picked one of these settings. I usually pick General, so that's what I'm going to do this time. I encourage you, if you are following along, to choose the same one you picked, so that you are not changing your settings that you are used to. So, I'll check General, and then click on Finish. It tells me that the Reset is complete, now I click Close, and return back to Visual Studio. One of the first settings I'll change is to remove the CodeLens feature. You can see the CodeLens feature above the main method, and above the save file menu, where it says zero references.
This is a great feature. I really like it, as it provides valuable information about code references, unit tests, and source control check-ins. But it's not available for the free Visual Studio Community edition, so I'll remove it so it doesn't distract us in future videos. To do that, I need to open the Settings dialogue. I'll choose Tools, Options. There are lots of settings in here. I can use the Search feature at the top to filter down the list.
I'll type in lens, and then choose CodeLens. And, then I'll uncheck this first checkmark. And then click OK. Now, back in my code editor, you see that the main method, and the save and file method, no longer have the Lens text over the top. So, now it's time to talk about some of the general settings in Visual Studio. I'll return back to Tools, Options. I'm going to spend most of my time in this Text Editor section. There is a section here for All Languages. The one I want to look at right now is this General section.
Now I'll move down and talk about the Display section. This first one, Selection margins, displays a vertical margin along the left edge of the editor's text area. This is mostly used for the Track changes feature which I cover later in the course. I'll turn it on and off so you can see what it does. Before I turn it on/off, look at the margin here in the code editor, and see if you can see any differences when I uncheck this one item, and then click okay. Did you notice that? The text moved over about six or eight pixels.
I'll return back to the Options, and turn back on the Selection margin. Now we'll talk about the Indicator margin. The Indicator margin is the grey border that you see along the left edge of the editor text area. It is the place where Visual Studio puts symbols to indicate what is important about the line of text that you are looking at. So, if I uncheck this checkbox, and click OK, keep your eye on the margin. You'll see that the grey border disappears. When I turn it back on, the grey border appears.
And then you can see I can put things like break points in here. I'll move to this line of text, and click in the margin, and it puts a red dot there. That symbolizes a break point. Let's try this again. I'll move to the comment line, and I'll choose Edit, Bookmarks, Toggle Bookmark. And you can see another symbol there. So that's what that margin is for, to hold those symbols. There are more glyphs that can appear on the margin. For example, there are some that appear when debugging your code. You'll see them elsewhere in this course.
Let's look at one more setting, this Highlight current line. Do you like to know at a glance which line contains the text cursor? If so, then make sure that the Highlight line option is checked. Let's see what it looks like. Uncheck it, and click Okay. Now, I'm selecting lines of text. I'm selecting a line of text, you can see that I get a blue background on it. But, when I'm just moving my cursor up and down with the arrows, there's nothing to indicate which line I'm on other than the cursor.
Re-enabling this feature, now look carefully. You can see that as I'm moving my cursor up and down, now there's a slight grey border above and below the cursor. There are a lot of other settings in this area, called All Languages. I'll show my favorite ones in the next video.
- Exploring the code editor window and default settings
- Commenting code
- Using hover tips and IntelliSense
- Tracking changes
- Refactoring code
- Formatting and arranging code
- Navigating and inspecting code
- Using the Task List
- Working with snippets and smart tags
Skill Level Intermediate
Q: This course was updated on 08/21/2017. What changed?
A: New videos were added that cover visualizing code and markup with structure guidelines in Visual Studio 2017; refactor enhancements in Visual Studio 2017; format rules for C# in Visual Studio 2017; format rules for Visual Basic in Visual Studio 2017; smart peek options; and CodeMap in Visual Studio 2017.