About GitHub Copilot Chat and Visual Studio Code
GitHub Copilot Chat is a chat interface that lets you ask and receive answers to coding-related questions directly within a supported IDE. Copilot Chat can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see "About GitHub Copilot Chat."
Prerequisites
-
To use GitHub Copilot Chat you must have an active GitHub Copilot subscription. For more information, see "About billing for GitHub Copilot."
-
To use GitHub Copilot Chat in Visual Studio Code, you must have the latest version of Visual Studio Code installed. For more information, see the Visual Studio Code download page.
-
To use GitHub Copilot Chat in Visual Studio Code, you must be signed into Visual Studio Code with the same GitHub ID that has access to GitHub Copilot.
Enabling or disabling GitHub Copilot Chat
Note: If you have a GitHub Copilot for Individuals subscription, you are automatically granted access to the GitHub Copilot Chat beta.
The GitHub Copilot Chat public beta is available to all organizations and enterprises that have an active GitHub Copilot for Business license. You can enable or disable GitHub Copilot Chat for your organization or enterprise in the GitHub Copilot for Business settings page.
Enabling or disabling GitHub Copilot Chat at the organization level
-
In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
-
Next to the organization, click Settings.
-
In the "Code planning, and automation" section of the sidebar, click Copilot, and then click Policies.
-
To the right of GitHub Copilot Chat Beta, select the dropdown menu, and then click Enabled or Disabled.
Enabling or disabling GitHub Copilot Chat at the enterprise level
- In the enterprise account sidebar, click Policies.
- Under " Policies", click Copilot.
- To the right of GitHub Copilot Chat Beta, select the dropdown menu, and then choose the appropriate option.
- Click Allowed to enable the GitHub Copilot Chat beta for all organizations under your enterprise.
- Click Blocked to disable the GitHub Copilot Chat beta for all organizations under your enterprise.
- Click No policy to allow each organization under your enterprise to set their own policy.
Installing the Visual Studio Code extension
To use GitHub Copilot Chat, you must first install the GitHub Copilot Chat extension for Visual Studio Code.
-
In Visual Studio Code, open the Extensions view by clicking the Extensions icon in the activity bar on the left side of the Visual Studio Code window.
-
In the "Search Extensions in Marketplace" search box, search for the
GitHub Copilot Chat
extension, then click Install. -
In the Visual Studio Code window, click Reload required to update Visual Studio Code.
-
If you are prompted to sign in by a toast notification in the bottom right corner of Visual Studio Code, click Sign in to GitHub and sign in with the same GitHub ID that has been granted access to the GitHub Copilot Chat limited public beta.
-
Follow the prompts in Visual Studio Code and on GitHub in your browser to complete the sign in and authentication process.
-
To confirm that GitHub Copilot Chat has been successfully installed, in the activity bar on the left side of the Visual Studio Code window, click the GitHub Copilot Chat icon to open the GitHub Copilot Chat chat window.
Note: If you experience authentication issues after installing the extension, see "Troubleshooting authentication issues with GitHub Copilot Chat."
Asking your first question
GitHub Copilot Chat is intended to answer exclusively coding related questions that you ask in natural language. For example, you can ask GitHub Copilot Chat to help you write a function that returns the sum of two numbers.
-
In the Visual Studio Code activity bar, click the GitHub Copilot Chat icon to open the GitHub Copilot Chat chat window.
-
At the bottom of the GitHub Copilot Chat window, in the Ask Copilot a question or type
/
for topics text box, type a coding related question, then press Enter. For example, type "How do I write a function that returns the sum of two numbers?". -
GitHub Copilot Chat will process your question and provide an answer, with code suggestions when appropriate, in the chat window.
If your question is outside the scope of GitHub Copilot Chat, it will tell you and may suggest an alternative question to ask.
-
Optionally, if GitHub Copilot Chat suggests a follow-up question above the Ask Copilot a question or type
/
for topics text box, click the follow-up question to ask it.
Using code suggestions from GitHub Copilot Chat
When GitHub Copilot Chat provides code suggestions, you have a few options for how to use them.
-
In the GitHub Copilot Chat window, to show the options for a code suggestion, hover over the suggestion.
-
Choose one of the options for using the code suggestion.
- To copy the code suggestion to your clipboard, click the Copy icon.
- To insert the code suggestion into your code at the current location of your cursor, click the Insert at Cursor icon.
- To view additional options, click the ... icon.
- To create a new file and insert the suggestion into it, click Insert Into New File.
- To run the code suggestion in the Visual Studio Code terminal, click Run in Terminal.
Asking GitHub Copilot Chat questions about your code
GitHub Copilot Chat can provide answers and support with a wide range of coding related topics.
- In Visual Studio Code, open the file you want GitHub Copilot Chat to help you with.
- Ask GitHub Copilot Chat a question about the file you have open. For example:
- To generate a description of the file's purpose, ask a question like,
What does this file do?
. - To generate a unit test for the file, type a request like,
Write a unit test for this file
. Alternatively, highlight the code you want to generate a unit test for, then ask a question like,Write a unit test for this code
. - To generate a fix for a bug in the file, type a request like,
Fix this bug
.
- To generate a description of the file's purpose, ask a question like,
Sharing feedback about GitHub Copilot Chat
To share feedback about GitHub Copilot Chat, you can use the share feedback button in the GitHub Copilot Chat window.
- Scroll to the top of the GitHub Copilot Chat window.
- Click the share feedback button.
- In your browser, in the vscode-copilot-release repository, create a new issue or open the GitHub Copilot community discussion.
- To open an issue to report a bug, next to Bug report for GitHub Copilot Chat, click Get started.
- To open an issue to request a feature, next to Feature request for GitHub Copilot Chat, click Get started.
- To report a security vulnerability, next to Report a security vulnerability, click View policy.
- To ask a question in a discussion, next to Questions, click Open.
Further reading
About GitHub Copilot Chat and Visual Studio
GitHub Copilot Chat is a chat interface that lets you ask and receive answers to coding-related questions directly within a supported IDE. Copilot Chat can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see "About GitHub Copilot Chat."
Prerequisites
-
To use GitHub Copilot Chat you must have an active GitHub Copilot subscription. For more information, see "About billing for GitHub Copilot."
-
To use GitHub Copilot Chat with Visual Studio, you must be running Visual Studio 2022 version 17.6 or higher. For more information, see the Visual Studio IDE documentation.
-
To use GitHub Copilot Chat with Visual Studio, you must be signed into Visual Studio with the same GitHub ID that has access to GitHub Copilot.
Enabling or disabling GitHub Copilot Chat
Note: If you have a GitHub Copilot for Individuals subscription, you are automatically granted access to the GitHub Copilot Chat beta.
The GitHub Copilot Chat public beta is available to all organizations and enterprises that have an active GitHub Copilot for Business license. You can enable or disable GitHub Copilot Chat for your organization or enterprise in the GitHub Copilot for Business settings page.
Enabling or disabling GitHub Copilot Chat at the organization level
-
In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
-
Next to the organization, click Settings.
-
In the "Code planning, and automation" section of the sidebar, click Copilot, and then click Policies.
-
To the right of GitHub Copilot Chat Beta, select the dropdown menu, and then click Enabled or Disabled.
Enabling or disabling GitHub Copilot Chat at the enterprise level
- In the enterprise account sidebar, click Policies.
- Under " Policies", click Copilot.
- To the right of GitHub Copilot Chat Beta, select the dropdown menu, and then choose the appropriate option.
- Click Allowed to enable the GitHub Copilot Chat beta for all organizations under your enterprise.
- Click Blocked to disable the GitHub Copilot Chat beta for all organizations under your enterprise.
- Click No policy to allow each organization under your enterprise to set their own policy.
Installing the Visual Studio extension
To use GitHub Copilot Chat with Visual Studio, you must install the Visual Studio extension.
-
In the Visual Studio menu bar, click Extensions, then click Manage Extensions.
-
In the "Manage Extensions" window, click Visual Studio Marketplace, search for "GitHub Copilot Chat", then click Download.
-
Close the "Manage Extensions" window, then exit and relaunch Visual Studio.
Note: If you experience authentication issues after installing the extension, see "Troubleshooting authentication issues with GitHub Copilot Chat."
Asking your first question
GitHub Copilot Chat is intended to answer exclusively coding related questions that you ask in natural language. For example, you can ask GitHub Copilot Chat to help you write a function that returns the sum of two numbers.
-
In the Visual Studio menu bar, to launch GitHub Copilot Chat, click View, then click GitHub Copilot Chat.
-
At the bottom of the Copilot Chat window, in the Ask Copilot text box, type a coding related question, then press Enter. For example, type "How do I write a function that returns the sum of two numbers?".
Note: If your question is outside the scope of GitHub Copilot Chat, it will tell you and may suggest an alternative question to ask.
-
If Copilot Chat offers a code suggestion that you want to use, click the Copy icon to copy the code suggestion to your clipboard.
-
Optionally, if GitHub Copilot Chat suggests a follow-up question under your last answer, click the follow-up question to ask it.
Asking GitHub Copilot Chat questions about your code
GitHub Copilot Chat can provide answers and support with a wide range of coding related topics.
- In Visual Studio, open the file you want GitHub Copilot Chat to help you with.
- Ask GitHub Copilot Chat a question about the file you have open. For example:
- To generate a description of the file's purpose, ask a question like,
What does this file do?
. - To generate a unit test for the file, type a request like,
Write a unit test for this file
. Alternatively, highlight the code you want to generate a unit test for, then ask a question like,Write a unit test for this code
. - To generate a fix for a bug in the file, type a request like,
Fix this bug
.
- To generate a description of the file's purpose, ask a question like,
Sharing feedback about GitHub Copilot Chat
To share feedback about GitHub Copilot Chat, you can use the Send feedback button in Visual Studio. For more information on providing feedback for Visual Studio, see the Visual Studio Feedback documentation.
-
In the top right corner of the Visual Studio window, click the Send feedback button.
-
Choose the option that best describes your feedback.
- To report a bug, click Report a problem.
- To request a feature, click Suggest a feature.