Getting Started With GitHub Copilot in VS Code (Docs Github Com)
Getting Started With GitHub Copilot in VS Code (Docs Github Com)
com
/en/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-visual-studio-code
Learn how to install GitHub Copilot in Visual Studio Code, and start seeing suggestions as you write
comments and code.
GitHub Copilot is available to GitHub customers with a personal account on GitHub.com and GitHub
Enterprise Cloud organizations owned by an enterprise account.
GitHub Copilot is free to use for verified students, teachers, and maintainers of popular open source
projects. If you are not a student, teacher, or maintainer of a popular open source project, you can try
GitHub Copilot for free with a one-time 60-day trial. After the free trial, you will need a paid subscription
for continued use. For more information, see "About billing for GitHub Copilot."
If you use Visual Studio Code, you can view and incorporate suggestions from GitHub Copilot directly
within the editor. This guide demonstrates how to use GitHub Copilot within Visual Studio Code for
macOS, Windows, or Linux.
Prerequisites
To use GitHub Copilot you must have an active GitHub Copilot subscription. For more information,
see "About billing for GitHub Copilot."
To use GitHub Copilot in Visual Studio Code, you must have Visual Studio Code installed. For more
information, see the Visual Studio Code download page.
1/5
1. In the Visual Studio Code Marketplace, go to the GitHub Copilot extension page and click Install.
2. A popup will appear, asking to open Visual Studio Code. Click Open Visual Studio Code.
3. In the "Extension: GitHub Copilot" tab in Visual Studio Code, click Install.
4. If you have not previously authorized Visual Studio Code in your GitHub account, you will be
prompted to sign in to GitHub in Visual Studio Code.
If you have previously authorized Visual Studio Code for your account on GitHub, GitHub
Copilot will be automatically authorized.
5. In your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve
these permissions, click Authorize Visual Studio Code.
6. In Visual Studio Code, in the "Visual Studio Code" dialog box, to confirm the authentication, click
Open.
2/5
2. In the JavaScript file, type the following function header. GitHub Copilot will automatically suggest
an entire function body in grayed text, as shown below. The exact suggestion may vary.
2. In the JavaScript file, type the following function header. GitHub Copilot will show you a suggestion.
4. Alternatively, you can hover over the suggestion to see the GitHub Copilot command palette for
choosing suggestions.
3/5
function calculateDaysBetweenDates(begin, end) {
function process() {
Using a framework
You can also use GitHub Copilot to generate suggestions for APIs and frameworks. The following
example uses GitHub Copilot to create a simple Express server that returns the current time.
4/5
1. To enable or disable GitHub Copilot, click the status icon in the bottom panel of the Visual Studio
Code window.
2. If you are disabling GitHub Copilot, you will be asked whether you want to disable suggestions
globally, or for the language of the file you are currently editing.
Further reading
GitHub Copilot
5/5