What is the GitHub Copilot Chat extension for Visual Studio?
Applies to:
Visual Studio
Visual Studio for Mac
Visual Studio Code
GitHub Copilot and GitHub Copilot Chatextensions in Visual Studio enable enhanced AI-assisted development in Visual Studio, helping you be more productive and efficient when writing code.
In this article, you'll learn about the Copilot Chat extension in Visual Studio, a fully integrated AI-powered chat experience from GitHub Copilot right within the Visual Studio IDE. It enables you to get coding information and support, such as syntax, programming concepts, context-specific code help, test cases, debugging, and more, without leaving the IDE.
For more information on the GitHub Copilot extension in Visual Studio, see About the GitHub Copilot extension for Visual Studio.
Why use Copilot Chat in Visual Studio?
Copilot Chat provides AI assistance to help you make informed decisions and write better code. With tight integration in Visual Studio, Copilot Chat understands what you're working on and can help you with development tasks like:
- Code explanations: get in-depth analysis and explanation of how a code block works
- Code help: get answers to programming-related questions in natural language or code snippet format
- Code refinement: get context-specific code suggestions & recommendations
- Unit testing: generate unit tests
- Profiling: optimize code performance
- Debugging: find issues and get proposed fixes to bugs and exceptions.
Prerequisites
To get started, you need:
- Visual Studio 2022 version 17.6 or later
- Active subscription to GitHub Copilot for Individuals or GitHub Copilot for Business
- GitHub Copilot extension in Visual Studio
Install the Visual Studio extension
To install the GitHub Copilot Chat extension in Visual Studio:
Open Visual Studio.
On the menu bar, select Extensions > Manage Extensions.
In the Search box, enter "GitHub Copilot Chat".
Select the GitHub Copilot Chat extension, and then select the Download button.
Restart Visual Studio to complete the installation process.
Note
If you experience authentication issues after installing the extension, see Troubleshooting authentication issues with GitHub Copilot Chat.
Use Copilot Chat in Visual Studio
You can ask your coding related questions in natural language and GitHub Copilot Chat will answer these in your development context.
There are two places you can ask Copilot these questions; in a chat window, or directly inline in the code that you're looking to modify, using inline code assistance. For questions where your goal is to modify or add to the code file you have open in the editor, the inline code assistant will usually work best, whereas more general coding questions are best answered in the chat pane.
Ask questions in the chat window
The chat window of Copilot Chat in Visual Studio enables you to ask your questions and see answers in the chat pane. It is usually the best way to work with Copilot on programming help and general coding questions.
In Visual Studio, select View > GitHub Copilot Chat.
In the Copilot Chat window, type a coding related question in the Ask Copilot text box. Press Enter or select Send to ask your question.
If Copilot Chat offers a code suggestion you want to use, select Copy code block to copy the code suggestion, or select Insert to insert the code suggestion in your code file. Using the insert button lets you preview the code in the target location so you can easily see what's being updated
If you ask a question for help with understanding your code, Copy code block and Insert options won't be available.
If you select Insert, you'll see the code suggestions in normal Visual Studio diff view pattern. You can review and refine what is being proposed and apply to your code by selecting Accept or discard by selecting Cancel.
Ask questions in the interactive code assistant
The interactive code assistant view of Copilot Chat in Visual Studio enables you to ask your questions and see answers inline with the code in the editor window itself. With inline chat, you don't have to go back and forth to the chat window. It is usually the best way to work with Copilot on questions that add to or update a currently open code file.
In Visual Studio, right click in your editor window and select Ask Copilot to bring up the interactive code assistant view of Copilot Chat in the editor itself.
Type your coding related question in the Ask Copilot text box, and then press Enter or select Send to ask your question.
You'll see code suggestions from Copilot Chat in Visual Studio diff view. You can review and refine what is being proposed and apply to your code by selecting Accept or discard by selecting Cancel.
Next steps
To learn more, consider exploring the following resources:
Feedback
Submit and view feedback for