Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Task 04 - Configure GitHub Copilot on your Dev Box (15 minutes)

Introduction

One way to accelerate developer productivity is to take advantage of generative AI solutions like GitHub Copilot. With Copilot, developers are still responsible for writing good code, but Copilot can offer suggestions on how to turn ideas into code and works well for common functions. This can let developers spend more time thinking about what they need to solve and fine-tuning suggestions to work with an existing code base.

To learn more about GitHub Copilot, read the following articles:

Description

In addition to seeing how DevOps practices can improve their existing business processes, the development team at Munson’s Pickles and Preserves would like to see how generative AI solutions - like GitHub Copilot - can help them with day-to-day development tasks.

In this task, you will ensure that your Dev Box has GitHub Copilot installed and that GitHub Copilot is able to make recommendations for C# code.

  1. Ensure that you have GitHub Copilot access associated with your GitHub account. Sign up for GitHub Copilot as a Microsoft employee if you have not done so already.

    We highly encourage you to use a personal account for GitHub Copilot rather than your Microsoft Enterprise Managed User (EMU) account. If you do use your EMU account, it will lead to management requirements that your Dev Box will not be able to meet and could lead to failure during sign-in. Instead, invite your personal account to GitHub Copilot using the Microsoft Open-Source org.

  2. Install the GitHub Copilot extension for Visual Studio Code.
  3. Open the GitHub Copilot completions panel.
  4. Ensure that the GitHub Copilot extension is working by entering the following comment in an existing C# code file: // Write a loop from 0 to 10 and print out the numeric value of the iterator for each loop iteration. Then, highlight the comment and review the suggestions.

Success Criteria

  • The GitHub Copilot extension for Visual Studio Code is installed on your Dev Box.
  • You are able to open the GitHub Copilot completions panel.
  • You are able to ask a question of GitHub Copilot, such as “When does it make sense to use the keyword yield in C# code?”

Learning Resources

Solution

Expand this section to view the solution
  • Microsoft employees have a specific process to access GitHub Copilot with their accounts. You should navigate to the following link to sign up.
  • If you have already signed up, you should simply need to sign in using the correct account.
  • The GitHub Copilot extension is available in the Visual Studio Code extensions store.
  • In order to open the Copilot suggestions window, strike Ctrl+Shift+P in Windows or Linux, and Cmd+Shift+P on Mac to open the navigation menu. Then, enter text until you can select > GitHub Copilot: Open Completions Panel.
  • Enter the question, “When does it make sense to use the keyword yield in C# code?” into the GitHub Copilot chat and then strike Enter. After a short wait, you should receive an answer to the question.