Skip to main content

Using GitHub Copilot code review

Learn how to request a code review from GitHub Copilot.

Who can use this feature?

This feature is not available in GitHub Copilot Free.

Note

About Copilot code review

GitHub Copilot can review your code and provide feedback. Where possible, Copilot's feedback includes suggested changes which you can apply with a couple of clicks.

Copilot code review supports two types of review:

  • Review selection: Highlight code and ask for an initial review (Visual Studio Code only)
  • Review changes: Request a deeper review of all your changes (GitHub website and Visual Studio Code)

The current functionality and availability of the two types of review is summarized in the following table:

FeatureReview selectionReview changes
EnvironmentVisual Studio CodeVisual Studio Code and the GitHub website
DescriptionInitial review of a highlighted section of code with feedback and suggestionsDeeper review of all changes
Language supportAllC#, Go, Java, JavaScript, Markdown, Python, Ruby, TypeScript
Custom coding guidelines supportNoYes, see Customizing Copilot's reviews with coding guidelines
AvailabilityPublic preview, available to all Copilot subscribersPublic preview with waitlist, see Join the Copilot code review waitlist

Warning

Copilot isn't guaranteed to spot all problems or issues in a pull request, and sometimes it will make mistakes. Always validate Copilot's feedback carefully, and supplement Copilot's feedback with a human review.

For more information, see Responsible use of GitHub Copilot code review.

Requesting a review from Copilot

These instructions explain how to use Copilot code review in Visual Studio Code. To see instructions for the GitHub website, use the "Web browser" tool switcher at the top of the page.

Note

Copilot code review is only available in Visual Studio Code with version 0.22 or later of the GitHub Copilot Chat extension.

Reviewing a selection of code

You can request an initial review of a highlighted selection of code in Visual Studio Code.

  1. In Visual Studio Code, select the code you want to review.

  2. Open the VS Code Command Palette

    • For Mac:
      • Use: Shift+Command+P
    • For Windows or Linux:
      • Use Ctrl+Shift+P
  3. In the command palette, search for and select GitHub Copilot: Review and Comment.

    Screenshot of the command palette in Visual Studio Code with the GitHub Copilot: Review and Comment command selected.

  4. Wait for Copilot to review your changes. This usually takes less than 30 seconds.

    Screenshot of the progress indicator when Copilot is performing a review in Visual Studio Code.

  5. If Copilot has any comments, they will be shown inline in your file, and in the Problems tab.

    Screenshot of a comment from Copilot in Visual Studio Code.

Reviewing changes

Note

Reviewing changes is currently only available to a limited number of Copilot subscribers. To join the waitlist, see Join the Copilot code review waitlist.

You can request a review for your staged or unstaged changes in Visual Studio Code.

  1. In VS Code, switch to the Source Control tab.

  2. To request a review on your unstaged changes, hover over Changes in the sidebar, and then click the Copilot code review - Changes button.

    Screenshot of the "Copilot code review - Changes" button in Visual Studio Code. The code review button is outlined in dark orange.

  3. To request a review on your staged changes, hover over Staged Changes in the sidebar, and then click the Copilot code review - Staged Changes button.

  4. Wait for Copilot to review your changes. This usually takes less than 30 seconds.

    Screenshot of the progress indicator when Copilot is performing a review in Visual Studio Code.

  5. If Copilot has any comments, they will be shown inline in your file(s), and in the Problems tab.

    Screenshot of a comment from Copilot in Visual Studio Code.

Working with suggested changes provided by Copilot

Where possible, Copilot's feedback includes suggested changes which you can apply with a single click.

Screenshot of a comment from Copilot in Visual Studio Code with a suggested change.

If you're happy with the change, you can accept a suggestion from Copilot by clicking the Apply and Go To Next button. Any changes you apply will not be automatically committed.

If you don't want to apply Copilot's suggested change, click the Discard and Go to Next button.

Providing feedback on Copilot's reviews

You can provide feedback on Copilot's comments directly within each comment. We use this information to improve the product and the quality of Copilot's suggestions.

To provide feedback, hover over the comment and click the thumbs up or thumbs down button.

Screenshot of a comment from Copilot in Visual Studio Code with feedback buttons displayed. The buttons are outlined in dark orange.

Customizing Copilot's reviews with coding guidelines

Note

Custom coding guidelines are currently only available to selected participants in the public preview of Copilot code review. Being accepted from the waitlist does not provide immediate access. In addition, custom coding guidelines are only available as part of a subscription to GitHub Copilot Enterprise.

When using Copilot code review to review changes in Visual Studio Code or the GitHub website, you can customize Copilot's review with custom coding guidelines written in natural language. Copilot will give feedback based on your coding guidelines when it reviews your code. For more information, see Configuring coding guidelines for GitHub Copilot code review.

Comments generated based on a coding guideline will include a message, highlighting their source.