AI Tools in VS Code
The GitHub Copilot extension is an AI pair programmer tool that helps you write code faster and smarter. You can use the Copilot extension in VS Code to generate code, learn from the code it generates, and even configure your editor.
Prerequisites
You'll use the GitHub Copilot extension to power your AI suggestions in VS Code.

To use GitHub Copilot, you need an active GitHub Copilot subscription. In the content below, you'll learn how VS Code will help you activate your free trial directly from VS Code. You can also activate your trial starting from the GitHub Copilot signup page.
Note: For some of the latest features we'll explore below, you'll need to use the GitHub Copilot Nightly extension and VS Code Insiders. These provide you the latest updates in both Copilot and VS Code overall.
Sign in and sign up
If you have not previously authorized VS Code in your GitHub account, you will be prompted to sign in to GitHub in VS Code:

In your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, select Authorize Visual Studio Code.
Activate your free trial
If you haven't yet activated your free trial for Copilot, the extension will notify you in VS Code. Select Signup for GitHub Copilot to activate your trial.

You can learn more about billing for Copilot in the GitHub Copilot documentation.
Using Copilot
Now that you've signed up for Copilot and activated the extension, let's see its assistance in action!
GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, and it works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++.
There are three main ways to get assistance from Copilot:
- Inline suggestions: Harness Copilot's help automatically through suggestions it provides directly inline as you work in your code.
- Chat view: Ask Copilot for help with any task or question in the GitHub Copilot Chat view.
- Inline chat: Talk with Copilot while writing code, inline in your files.
Note: To get access to the chat view and inline chat, you'll need to sign up for the GitHub Copilot chat waitlist. You'll also need to use the GitHub Copilot Nightly extension and VS Code Insiders.
Inline suggestions
Copilot presents suggestions automatically to help you code more efficiently. There are just 3 steps to harnessing these suggestions:
- Start writing code (or code-related items, like comments or tests).
Copilot provides suggestions for a variety of languages and frameworks. For any given input, Copilot may offer multiple suggestions. You can select which suggestion to use or reject all suggestions.
- Receive a Copilot suggestion in gray ghost (faded) text.
Ghost text is placeholder text that will be replaced by input you type or select from Copilot.
As an example, a JavaScript file, you can type the following function header:
function calculateDaysBetweenDates(begin, end) {
Copilot will provide a suggestion like the following:

- Choose to accept Copilot's suggestion.
For any given input, Copilot may offer multiple suggestions. When Copilot offers a suggestion, you can use accept it with the Tab key, or hover over the suggestion to see the inline suggestion toolbar:

In the image above, Copilot presents three suggestions. You can accept the entire suggestion with Tab, or only part of the suggestion with Ctrl+RightArrow. You can switch between suggestions in the suggestion toolbar, or use the keyboard shortcut ⌥] (Windows, Linux Alt+]) instead.
If you don't want to accept any of the suggestions, you can continue typing, and Copilot will continue providing suggestions as you work.
Chat view
When developing a project or learning something new, it can be a big help to get AI assistance on your questions, big or small. Copilot enables an interactive Chat experience that understands the context of your code, workspace, extensions, settings, and more.
Once you've signed up and been granted access to Copilot chat through the chat waitlist, install the GitHub Copilot Nightly extension in VS Code Insiders. You'll be presented a new GitHub Copilot chat view in the Activity Bar:

Like other views in VS Code, you can move it anywhere. For example, you can move it to the secondary sidebar so that you can use other views like the Explorer at the same time:

Copilot will suggest potential questions to get started. You can select any of these questions or use the chat box to type your own:

As you continue asking questions, Copilot maintains the history of your conversation, and it'll provide related follow-up questions or commands in its response too.
You can help Copilot provide better answers by upvoting or downvoting responses with the thumbs up and down icons in the upper right of its response. This provides Copilot feedback on how much it helped with your scenario so that it can help you even better in the future.
Slash commands
To further help Copilot give you more relevant answers, you can choose a topic for your questions through "slash commands."
You can prepend your chat inputs with a specific topic name to help Copilot give you a more relevant response. When you start typing /, you’ll see the list of possible topics:

- /explain: Explain step-by-step how the selected code works.
- /fix: Propose a fix for the bugs in the selected code.
- /help: Prints general help about GitHub Copilot.
- /tests: Generate unit tests for the selected code.
- /vscode: Questions about VS Code commands and settings.
- /clear: Clear the session.

Inline chat
An additional key functionality of Copilot is answering questions inline as you're coding. This allows you to harness the power of AI while staying in your existing editor workflow.
In any file, you can press ⌘I (Windows, Linux Ctrl+I) on your keyboard to bring up Copilot inline chat:

You can ask Copilot questions that emerge as you write and iterate on code, such as "Explain this piece of code" or "How do I add functionality to do X?" Several slash commands also work in inline chat.
Additional resources
Congratulations, you've now used artificial intelligence to enhance your coding!
You can read more about Copilot and how to use it in VS Code in the GitHub Copilot documentation.