Code Lens for Git in Visual Studio 2013 Ultimate Update 3

Jean-Marc Prieur

Yesterday we released Visual Studio 2013 Update 3 CTP1. This CTP brings new features in the area of CodeLens Team indicators. In this Blog post I’ll present the CodeLens Team indicators for Git.

CodeLens Team indicators

CodeLens is a heads-up display in your Visual Studio 2013 Ultimate editor where you can find information about your code in context. If you are not familiar with CodeLens, please see the following MSDN article Get history and other info about your code. Some of the CodeLens indicator for Team Foundation Server Version Control (TfVc) enable you to quickly identify the changes that have happened on the code and the authors of these changes. You can also see the code reviews, work-items and bugs associated with the changes. In addition, since Visual Studio 2013 Update 2, CodeLens shows you incoming changes from other branches. These CodeLens Indicators (Changes, Authors, Code Reviews, Work Items, Bugs & Incoming Changes) are collectively called Team Indicators.

Because they are computed on the server, they required you to connect to t least Team Foundation Server 2013.

Many of you have found CodeLens Team Indicators very useful, and even cool, but you asked us to extend the support of CodeLens Team indicators to other source control systems, including Git and Visual Studio online.

CodeLens Team indicators for Git

We are excited to announce that we are providing a preview of the CodeLens Team indicators for Git. With Visual Studio 2013 Update 3 CTP1, you will only get the Authors and Change indicators for Git, but that is just a start: a work item indicator will follow soon. The User experience with the CodeLens Authors and Change indicators for Git is very similar to the one you get with Team Foundation Version Control (TfVC), but of course this is about Git commits rather than changesets (see details below)

But there is another big difference: the CodeLens Team Indicators for Git are computed on the client side. This means that you will get them for any Git repository, either local, or cloned from TfGit, or even cloned from GitHub or other Git sources.

Deep dive into the Authors and Changes indicators for Git

In the example below, I’ve cloned the Roslyn open source repository from https://git01.codeplex.com/roslyn and opened the Roslyn solution. Let’s say that I’m working on a (hypothetical) problem where I’m trying to understand if some recent changes could have provoked a bug I’m investigating. For this, in the WorkspacesWorkspaces project, I’ve opened the SemanticModelWorkspaceServiceFactory.cs. I’m looking at the GetSemanticModelForNodeAsync method

Authors and Changes indicators

Similar to what we have in TfVc, I can see, in addition to the references indicators, that this method was last changed by mattwar, and another person did a change, and there were two changes overall:

clip_image001[4]

The details popup

Clicking on the author indicator (or the changes indicators: for the moment, the details are the same), I can see similar information to what we have in TfVc:

  • Commit ID,
  • the Description of the commit,
  • the Author of the commit, and
  • the Date of the commit

clip_image002[4]

Hovering on a line corresponding to a Commit in the Commit Details window shows a tooltip giving more detail:

clip_image003[4]

Right-clicking on a line corresponding to a Commit shows the contextual actions for this commit:

  • View the Commit Details (in the Team Explorer Commit Details page – see below)
  • Interact with the author of the change. This interaction will be more or less rich depending on what is installed on your machine. Here Lync is installed on my machine so I can interact with the author through Instantaneous Messaging. The Contact Card will also be very detailed, as we are in the same company so the Active Directory provides me with a lot of information.

clip_image004[4]

How to understand the changes to the method made in this commit

Requesting the Commit Details shows the details in Team Explorer. That will be a good location if you want to copy the commit short Id to use with command line tools, if you are used to using them. We know that for some of you this is important.

clip_image005[4]

Note that the Commit Details window shows you all the files in the commit, which is desirable for you to understand the whole story. However, if you are only interested in the changes for the file you are looking at, you can use the “View Options” drop down and choose to Show the Filter

clip_image006[4]

Then you’ll have to type, or copy / paste the name of the file (personally, if I’m only interested in seeing this file, I’d paste the full path that I would have got from the “Copy Full Path” contextual command on the file tab).

clip_image007[4]

From there you can compare the changes in this file with the previous version if you wish.

clip_image008[4]

 

When are the indicators refreshed ?

In this CTP, the indicators will not yet refresh automatically when you Commit a change, pull or Sync from a remote repository, or change the branch. This will be available in a later CTP or version of Visual Studio 2013 Update 3.

There is a work around which is to manually refresh the indicators by right-clicking on an indicator and clicking on “Refresh CodeLens Team Indicators”

clip_image009[4]

 

What if I don’t want to see the Git Team Indicators?

If you are not interested in seeing the Git Team Indicators, you can disable them through the CodeLens Options contextual command above, or through Tools | Options [ Text Editor / All Languages / CodeLens]:

clip_image010[4]

In closing

As always, we are interested in hearing your feedback on this feature. Please try it out, and let us know.

0 comments

Discussion is closed.

Feedback usabilla icon