May 20th, 2019

Code Reviews Using the Visual Studio Pull Requests Extension

Taysser Gherfal
Principal Product Manager

The Pull Requests for Visual Studio is a new experimental extension that adds several code review tools to Visual Studio. This extension aims to make it easy for you to launch and view pull requests inside the integrated development environment (IDE) without needing to switch windows or use the web. We learned from customers that having a high-quality code review process is very important to increase productivity. To achieve that, this extension is enabling you to use existing and new Visual Studio code navigation, debugging and sharing capabilities in your code review process.

As of today, Pull Requests for Visual Studio only supports Azure DevOps and is available for you to download on the Marketplace. For those looking for GitHub pull request support, consider using the GitHub extension for Visual Studio.

This blog will focus on the basics of creating and reviewing a pull request, including:

  • Creating new pull requests
  • Reviewing pull requests
  • Providing expressive comments using markdown, emojis, and likes
  • Comparing code differences for over-the-shoulder and self-code review

With this extension you can also:

  • Review and checkout Pull Requests from Azure Repos
  • Get an inline peek to see more details about methods used in the code
  • View previous updates and understand how collaboration and discussion evolved over the course of the pull request

To learn more about this extension, please feel free to watch the following online demo, which talks about building the award winning app, Seeing AI, with Visual Studio 2019.

 

Creating a New Pull Request

After installing the pull requests extension and connecting to your Git repository on Azure DevOps, you can create a new pull request when pushing your branch to remote by clicking on create a pull request and filling the new pull request form.

Creating a pull request right after pushing your branch

 

You can also create pull requests using the pull requests page by navigating to Team Explorer > Home > Pull Requests and selecting New Pull Request.

Creating a pull request using the pull requests page

 

When you have local commits that have not been pushed to remote, the pull request extension reminds you to share your changes with remote before creating a new pull request. The Build & Code Analysis Results section will automatically expand and let you know about any failing unit tests, errors, and warnings. (Compatible only with C++, C#, and VB)

Un pushed changes warning + Build & Code Analysis Results

 

Reviewing Pull Requests

The pull requests page provides a summary of pull requests created by you and pull requests that have been assigned to you. You can do a brief review by opening the pull request, reviewing the changes that were made, and leaving comments or approving the pull request as shown below. To do a detailed review and be able to run and debug the pull request locally, you can use the Check out option.

Pull requests page

 

The pull requests details page is a focused screen that provides the pull request description and the discussion that the team is having. It also provides access to the code changes introduced by the pull request where you can add and view previous comments added by the team.

Reviewing the changes introduced by the pull request

 

You can add your comments by right clicking on the line of code that you would like to comment on and selecting Add Comment. Markdown and emojis are supported and you can use the preview option to view your comment before creating it. You can also reference bugs, team members, and other context that you might want to bring into your comment. Comments can also be marked as resolved which sends notification to their authors.

Comments and social coding

 

Reviewing Your Own Work

The Pull Requests extension for Visual Studio comes with a unique code diff tool that allows you to review your own work any time you want before creating a pull request. This allows you to see a history of changes as you code, which can be helpful when you are conducting over-the-shoulder code review and want to focus on the introduced code changes. To turn on code diff click on the Comparisons button on the tool bar.

Code diff (comparison)

 

With the Pull Requests extension, we now have integrated pull requests and code reviews inside of Visual Studio.

 

We Need Your Feedback!

We continue to value your feedback. As always, let us know of any issues you run into by using the Report a Problem tool in Visual Studio. You can also head over to Visual Studio Developer Community to track your issues, suggest a feature, ask questions, and find answers from others. We use your feedback to continue to improve Visual Studio 2019, so thank you again on behalf of our entire team.

 

Install the Pull Requests extension & give us feedback!

Author

Taysser Gherfal
Principal Product Manager

Taysser is one of the program managers for Visual Studio’s core IDE. Taysser joined the Visual Studio team in 2019 and focused on enhancing git tooling and team collaboration experiences.

8 comments

Discussion is closed. Login to edit/delete existing comments.

  • Shawn Mehaffie

    So when will this be added to VS2019 and and be an “experimental extension”.  Seems with all the GIT improvements in VS2109, this shoudl have been one of the features included in the initial release.

  • anony mouse

    Oh goody, just what the world of professional programmers really need; emoji and likes. This may be “fun” for some, but I’d rather you put the effort into fixing the error backlog.

  • Benny Skjold Tordrup

    Is this extension going to support Visual Studio 2017?

    • Taysser GherfalMicrosoft employee Author

      As of today, we don’t have immediate plans for supporting VS2017.

  • Pascal Berger

    Do you have plans to support on-prem Azure DevOps server in the future or will this always only be for Azure DevOps?Also do you have plans to unify the pull request experience in Visual Studio across different hosting plattforms? Meaning that workflow and UX would be the same if I’m working in a Azure Repos or GitHub repo (would probably mean that there’s a core pull request experience with adaptors for different hosting provider)

    • Taysser GherfalMicrosoft employee Author

      Yes, we plan to support on-prem Azure DevOps server in the future. We are also looking at unifying the pull request experience in Visual Studio across different hosting plattforms (bringing Azure Repos and GitHub PR experiences closer together)

    • Pete Burgess

      Didn’t expect it to but it’s worked with our local TFS git repos.

      • John Sturgeon

        This is awesome! Will need to validate that myself, but that is our workflow currently and would be great to use this rather than TFS’ web interface…