Color Indicator for Code Changes – Track Changes in Visual Studio

Color Indicator for Code Changes – Track Changes in Visual Studio

“Track Change” one of the best interesting features in visual studio which indicates the code changes with a color indicator at the beginning of the line.  Generally we know about the two color indicator  “Green” and “Yellow” which are used indicting the color change till VS 2008 along with those VS 2010 introduced another new color “Orange” which indicates some additional track change for undoing file after save. In this blog post I am going to explain how those color indicator helps developers to track the code changes.

 

TrackChange_Green  Green color indicates the lines  which you have edited before your last save.  Save again the file and green mark will be disappear.

  TrackChange1

TrackChange_Yellow Yellow color indicates the lines which  you have edited since the  last save of that file.  Yellow becomes Green after saving of the file. Once you close the file that indication disappears.

 TrackChange2

TrackChange_Orange This color indication has newly introduced in VS 2010.  This color will come when  user does an undo after a save operation for that current file. Orange color indicates  that current changed line is different from the saved version of the file. 

 TrackChange3

 

How to Enable / Disable Track Change features ?

To enable or dai the “Track Change” features, Goto Tools > Options > TextEditor . In General section, you can checked or Unchecked the “Track Change” option .

TrackChange_Enabled

 

Key Note :  While you are using “Track Change” option, you have to select “Selection Margin” display option other wise, “Track Change” Won’t work.

TrackChange_Enabled_2

 

One Quick Flow of “Track Change”

You have opened one code file in visual studio 2010 which having below lines of code. By default there is not color indicator with line number.

example1 

Yellow indicator showing that, you have made changes on those line.

example2

Green indicator shows, all of your changes has been saved.

example3

Now, you have undoing the files after save, orange indicator saying that, the lines is different  than the save version. It means, you have changed some thing on original file, saved it and again undo it.

example4 

To get a clear understanding, just compare the below two image . Yes,  all the orange color  marked line are similar with default version image.

example1 example4

                 Default Code image                                                “Orange” Indicator Image

Similarly, This Track changes also works for config files also.

configcolor

Summary : “Track Change” is one very useful features in Visual studio , by which You can see where you have edited / saved on  a file for that current IDE session . Green color indicates the lines  which you have edited before your last save.Yellow color indicates the lines which  you have edited since the  last save of that file. Orange color indicates  that current changed line is different from the saved version of the file.

 

If you want to know more about editor setting options , please check the below link

How to: Set Text Editor Options

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.