Develop with AI-powered code suggestions by using GitHub Copilot and VS Code

In this lab, you will learn how to use GitHub Copilot with Visual Studio Code to get AI-powered code suggestions and accelerate your development workflow. GitHub Copilot is an AI pair programmer that helps you write code faster and with less effort by suggesting whole lines or entire functions based on your context.

You will learn how to:

  • Install and configure GitHub Copilot in VS Code
  • Use GitHub Copilot for code completion
  • Accept and modify Copilot suggestions
  • Prompt Copilot effectively for better suggestions
  • Understand when to use Copilot's suggestions
  • Leverage AI assistance in your development workflow

This lab takes approximately 30-45 minutes to complete.

Before you start

To complete the lab, you need:

  • A GitHub user account. If you don't have one, you can create a new account.
  • Access to GitHub Copilot (requires a subscription or trial).
  • Basic programming knowledge (any language).
  • A web browser with access to the internet.

Complete the exercise on Microsoft Learn

In this exercise, you'll learn to use GitHub Copilot through a hands-on exercise that guides you through installation and usage.

Note: This exercise walks you through installing GitHub Copilot, prompting it for code suggestions, and learning best practices for working with AI-powered coding assistance.

The exercise consists of the following activities:

  1. Start a web browser and navigate to the exercise page: https://github.com/skills/getting-started-with-github-copilot

  2. On the exercise page, select the Start the exercise on GitHub button to begin.

  3. Follow the instructions provided to complete all the challenges.

  4. Work through each step, learning how to effectively use GitHub Copilot in your development workflow.

  5. When you finish, return to the module for a knowledge check and completion badge.

What you've learned

After completing this exercise, you should be able to:

  • Install and configure GitHub Copilot
  • Use Copilot for code suggestions
  • Write effective prompts for better suggestions
  • Integrate AI assistance into your workflow
  • Understand AI coding best practices

Congratulations! You've completed the GitHub Copilot exercise!