Introduction
This guide demonstrates how to set up a GitHub Copilot Individual subscription for your personal account, set up GitHub Copilot in Visual Studio Code, and get your first code suggestion.
To learn more about everything that Copilot can do, see "About GitHub Copilot."
To get started using Copilot in other coding environments, see "Using GitHub Copilot code suggestions in your editor."
Sign up for GitHub Copilot
Before you can start using GitHub Copilot through your personal account, you will need to set up a free trial or subscription for GitHub Copilot Individual. For more information, see "About GitHub Copilot Individual."
Install Visual Studio Code and the GitHub Copilot extension
-
If you don't already have Visual Studio Code installed, install it from the Visual Studio Code download page.
-
Install the GitHub Copilot extension from the Visual Studio Marketplace. For more information, see "Set up GitHub Copilot in Visual Studio Code" in the Microsoft documentation.
Get your first suggestion
Now that you've installed the GitHub Copilot extension, follow these steps to create a new file and get a code suggestion from Copilot.
This example uses JavaScript, however other languages will work similarly. GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. GitHub Copilot can also assist in query generation for databases, or generating suggestions for APIs and frameworks.
-
Open Visual Studio Code.
-
In Visual Studio Code, create a new JavaScript (*.js) file.
-
In the JavaScript file, type the following function header.
JavaScript function calculateDaysBetweenDates(begin, end) {
function calculateDaysBetweenDates(begin, end) {
GitHub Copilot will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
-
To accept the suggestion, press Tab.
Next steps
You successfully installed GitHub Copilot and received your first suggestion, but that's just the beginning! Here are some helpful resources for taking your next steps with GitHub Copilot.
- Configure Copilot in your editor - You can enable or disable GitHub Copilot from within your editor, and create your own preferred keyboard shortcuts for Copilot. For more information, see "Configuring GitHub Copilot in your environment."
- Get started with GitHub Copilot Chat - Learn how to ask Copilot for information and assistance, using GitHub Copilot Chat. For more information, see "Using GitHub Copilot Chat in your IDE".
- Use Copilot like a pro - Learn how to write effective prompts for GitHub Copilot. For more information, see "Best practices for using GitHub Copilot in VS Code" in the Visual Studio Code documentation.
- Troubleshoot issues - Learn more about how to troubleshoot common issues with GitHub Copilot. For more information, see "Troubleshooting GitHub Copilot."