次の方法で共有


Track Changes in the Editor

Menu:  Tools -> Options -> Text Editor -> General
Versions:  2008,2010
Published:  4/14/2010
Code:  vstipEdit0048

 

Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!

 

image

To use this feature you need to have "Track Changes" and "Selection Margin" checked. 

 

Okay, so ever wonder how those colors to the left of your code actually work?

image

 

Let's begin with a clean slate.  Notice there are no colors:

image

 

Now let me add a couple of lines of code:

image

 

So, all new code will turn yellow to show you what part of the document is "dirty" (unsaved).  If we save the code then we get this:

image

 

The "clean" (saved) indicator will remain as long as you have the file open.  When you close and reopen the file, this is what you get:

image

 

New in VS2010:  There is now an orange indicator that is used to show a change that is different from the saved version.  This was added for the scenario where a user does an undo after a save operation:

image

 

 

Here is a grid to help keep the scenarios straight:

Marker Different from file saved on disk? Different from file that was opened?
Nothing No No
Yellow Yes Yes
Green No Yes
Orange Yes No

 

Very cool stuff!

Comments

  • Anonymous
    April 14, 2010
    The comment has been removed

  • Anonymous
    April 14, 2010
    This is a great tip.  I use it to let me know when I need to save something.  I have been using it with my database development projects.  It can be priceless when I am testing multiple changes on a large solution.

  • Anonymous
    April 18, 2010
    The comment has been removed

  • Anonymous
    August 17, 2010
    Has anyone figured out how to make the selection margin not take up so much space?  I want it to look like it does in VS 2008 where the change tracking just overlaps with the [+] buttons.

  • Anonymous
    September 22, 2010
    Hey David, AFIK, there is no way to adjust the Selection Margin size.   Z

  • Anonymous
    June 10, 2011
    Are there keyboard shortcuts to go to next/previous change?

  • Anonymous
    December 09, 2011
    Have the exact same question as Gary! How do I move the caret to the next/prev change?

  • Anonymous
    April 11, 2013
    Third person, third comment in a row, wondering whether there are keyboard shortcuts for navigating between them :)

  • Anonymous
    August 08, 2013
    Is there a way (or a way to write a plugin) that we can show all changed lines in a window say similar to the bookmark window?.. I work in large code base and code navigation is the difficult part, it would be so much better if we can have all changed lines tracked in a summary window!

  • Anonymous
    August 10, 2013
    Hey R :) If you can imagine it then it can probably be done. Since we went to WPF the sky is pretty much the limit. :) Z

  • Anonymous
    December 07, 2013
    Sure wish there was a way to clear the change bar without closing the document.  I like it to a point but sometimes it's all so green that it's useless.  

  • Anonymous
    February 13, 2014
    The track changes feature is quite useful.  I depend upon it regularly to navigate to recent edits.  In VS2013, however, it's width is very distracting.  The bright colors contrast sharply against the dark theme background.  The lines stand out as if a divider, while the actual window boundaries almost disappear.  Please provide a way to customize the width and make the colors appropriate to the theme.