Prerequisites
- Access to GitHub Copilot. See What is GitHub Copilot?.
- Latest version of Visual Studio Code. See the Visual Studio Code download page.
- The GitHub Copilot extension - Install this from the Visual Studio Marketplace. For more information, see Set up GitHub Copilot in Visual Studio Code in the Microsoft documentation.
- Sign in to GitHub in Visual Studio Code. If you experience authentication issues, see Troubleshooting issues with GitHub Copilot Chat in IDEs.
If you have access to GitHub Copilot via your organization, you won't be able to use GitHub Copilot Chat if your organization owner has disabled chat. See Managing policies for Copilot in your organization.
Submitting prompts
You can ask Copilot Chat to give code suggestions, explain code, generate unit tests, and suggest code fixes.
-
To open the chat view, click the chat icon in the activity bar or press Control+Command+i (Mac) / Ctrl+Alt+i (Windows/Linux).
Tip
For additional ways to access Copilot Chat, including inline with your code, see Additional ways to access Copilot Chat below.
-
Enter a prompt in the prompt box, or click one of the suggested prompts. For an introduction to the kinds of prompts you can use, see Getting started with prompts for Copilot Chat.
-
Evaluate Copilot's response, and make a follow up request if needed.
The response may contain text, code blocks, buttons, images, URIs, and file trees. The response often includes interactive elements. For example, the response may include a menu to insert a code block, or a button to invoke a Visual Studio Code command.
To see the files that Copilot Chat used to generate the response, select the Used n references dropdown at the top of the response. The references may include a link to a custom instructions file. This file contains additional information that is automatically added to all of your chat questions to improve the quality of the responses. For more information, see Adding custom instructions for GitHub Copilot.
Using keywords in your prompt
You can use special keywords to help Copilot understand your prompt. For examples, see Getting started with prompts for Copilot Chat.
Chat participants
Chat participants are AI domain experts that can perform tasks or answer questions in a specific domain.
Copilot Chat can infer relevant chat participants based on your natural language prompt, improving discovery of advanced capabilities without you having to explicitly specify the participant you want to use in your prompt. However, if you prefer, you can still manually specify a chat participant to scope your prompt to a specific domain. To do this, type @
in the chat prompt box, followed by a chat participant name.
Note
Automatic inference for chat participants is currently in public preview and is subject to change.
Chat participants include:
@workspace
: Has context about the code in your workspace. Use@workspace
when you want Copilot to consider the structure of your project, how different parts of your code interact, or design patterns in your project.@vscode
: Has context about Visual Studio Code commands and features. Use@vscode
when you want help with Visual Studio Code.@terminal
: Has context about the Visual Studio Code terminal shell and its contents. Use@terminal
when you want help creating or debugging terminal commands.@azure
: Has context about Azure services and how to use, deploy and manage them. Use@azure
when you want help with Azure. The@azure
chat participant is currently in public preview and is subject to change.
In addition to the built-in Visual Studio Code chat participants, you can also install Copilot Extensions that provide chat participants. You can install these extensions from GitHub Marketplace and from Visual Studio Code Marketplace. For information about extensions from GitHub Marketplace that provide chat participants, see Using extensions to integrate external tools with Copilot Chat.
Note
GitHub Copilot Extensions is in public preview and subject to change.
To see all available chat participants, type @
in the chat prompt box.
See also Chat participants in the Visual Studio Code documentation.
Slash commands
Use slash commands to avoid writing complex prompts for common scenarios. To use a slash command, type /
in the chat prompt box, followed by a command. Slash commands include:
/tests
: Generate unit tests for the selected code/fix
: Propose a fix for problems in the selected code/explain
: Explain the selected code/clear
: Start a new chat
To see all available slash commands, type /
in the chat prompt box. See also Slash commands in the Visual Studio Code documentation.
Chat variables
Use chat variables to include specific context in your prompt. To use a chat variable, type #
in the chat prompt box, followed by a chat variable. Chat variables include:
#file
: Include a specific file as context in the chat.#git
: Include information about the current Git repository.#terminalLastCommand
: Include the last run command in the active Visual Studio Code terminal.
To see all available chat variables, type #
in the chat prompt box. See also Chat variables in the Visual Studio Code documentation.
Using GitHub skills for Copilot
Note
This functionality is available with the Copilot Chat extension v0.20.3 or later and VS Code or VS Code Insiders 1.93 or later.
Copilot's GitHub-specific skills expand the type of information Copilot can provide. To access these skills in Copilot Chat in VS Code, include @github
in your question.
When you add @github
to a question, Copilot dynamically selects an appropriate skill, based on the content of your question. You can also explicitly ask Copilot Chat to use a particular skill. You can do this in two ways:
- Use natural language to ask Copilot Chat to use a skill. For example,
@github Search the web to find the latest GPT4 model from OpenAI.
- To specifically invoke a web search you can include the
#web
variable in your question. For example,@github #web What is the latest LTS of Node.js?
Currently available skills
You can generate a list of currently available skills by asking Copilot: @github What skills are available?
The skills you can use in Copilot Chat in VS Code include those shown in the table below.
Skill | Description | Enabled by default? | Example question |
---|---|---|---|
Commit details | Retrieves a list of commits, or the contents of a specific commit, to provide answers to commit-related questions. | Yes | @github Explain the changes in the code of this commit |
Discussion details | Retrieves a specific GitHub discussion. This is useful for quickly getting the gist of the conversation in a discussion. | Yes | @github Summarize this discussion LINK-TO-DISCUSSION |
File details | Retrieves a specific file in the default branch of the Git repository, allowing you to ask questions about the file and the recent changes made to it. This skill is useful when you provide the exact path of a file in the repository. | Yes | @github What logic does user_auth.js encapsulate? @github What is the file history of user_auth.js? |
GitHub Advanced Security | Retrieves information about security alerts within your organization from GitHub Advanced Security features (code scanning, secret scanning, and Dependabot alerts). | Yes | @github How would I fix this code scanning alert? |
Issue details | Retrieves a specific GitHub issue, including the issue's title, number, author, status, body, linked pull requests, comments, and timestamps. | Yes | @github List issues assigned to me |
Lexical code search | Keyword code search in the default branch of the Git repository. This skill is useful when you want to know about specific functions, methods or keywords that exist in the code. This skill leverages most of the functionality available to GitHub Search like symbol and path . | Yes | Find me the tests for the GitService class |
Path search | Retrieves a specific file in the default branch of the Git repository. This skill is useful when you provide the exact path of a file in the repository. | Yes | @github What logic does user_auth.js encapsulate? |
Pull request details | Retrieves a specific pull request. This allows you to ask questions about the pull request, including getting a summary of the pull request, its comments, or the code it changes. | Yes | @github List my recent pull requests |
Release details | Retrieves the latest, or specified, release. This allows you to find out who created a release, when it happened, and information included in the release notes. | Yes | @github When was the latest release? |
Repository details | Retrieves a specific GitHub repository. This is useful for finding out details such as the repository owner and the main language used. | Yes | @github Tell me about PATH-TO-REPOSITORY |
Semantic code search | Natural language semantic code search in the default branch of the Git repository. This skill is useful when you want to know where or how certain functionality has been implemented in the code. For more information, see Indexing repositories for Copilot Chat. | Yes Available for all public and private repositories with any subscription. | How does this repo manage HTTP requests and responses? |
Support search | Retrieves information from the GitHub Support portal. This skill is useful for asking Copilot Chat about GitHub products and support related questions. | Yes | @github Can I use Copilot knowledge bases with Copilot Individual? |
Web search | Searches the web using the Bing search engine. This skill allows Copilot to access information about recent events, new developments, trends, technologies, or extremely specific, detailed, or niche subjects. | No For Copilot Individual: Enable in your user settings. For Copilot Business: Enable in organization settings. | @github #web What are some recent articles about SAT tokens securing against vulnerabilities in Node? |
AI models for Copilot Chat
Note
Multiple model support in Copilot Chat is in public preview and subject to change.
The following models are currently available through multi-model Copilot Chat:
- GPT 4o: This is the default Copilot Chat model. It is a versatile, multimodal model that excels in both text and image processing and is designed to provide fast, reliable responses. It also has superior performance in non-English languages. Learn more about the model's capabilities and review the model card. Gpt-4o is hosted on Azure.
- Claude 3.5 Sonnet: This model excels at coding tasks across the entire software development lifecycle, from initial design to bug fixes, maintenance to optimizations. Learn more about the model's capabilities or read the model card. GitHub Copilot uses Claude 3.5 Sonnet hosted on Amazon Web Services.
- o1: This model is focused on advanced reasoning and solving complex problems, in particular in math and science. It responds more slowly than the
gpt-4o
model. You can make 10 requests to this model per day. Learn more about the model's capabilities and review the model card. o1 is hosted on Azure. - o3-mini: This model is the next generation of reasoning models, following from o1 and o1-mini. The o3-mini model outperforms o1 on coding benchmarks with response times that are comparable to o1-mini, providing improved quality at nearly the same latency. It is best suited for code generation and small context operations. You can make 50 requests to this model every 12 hours. Learn more about the model's capabilities and review the model card. o3-mini is hosted on Azure.
For more information about the o1 and o3 models, see Models in the OpenAI Platform documentation.
For more information about the Claude 3.5 Sonnet model from Anthropic, see Using Claude 3.5 Sonnet in GitHub Copilot.
Changing your AI model
Note
- If you use Copilot Extensions, they may override the model you select.
- Experimental pre-release versions of the models may not interact with all filters correctly, including the duplication detection filter.
- If you access Copilot Chat through a Copilot Business subscription, your organization must grant members the ability to switch to a different model. See Managing policies for Copilot in your organization.
- To open the chat view, click the chat icon in the activity bar or press Control+Command+i (Mac) / Ctrl+Alt+i (Windows/Linux).
- In the bottom right of the chat view, select the CURRENT-MODEL dropdown menu, then click the AI model of your choice.
Additional ways to access Copilot Chat
In addition to submitting prompts through the chat view, you can submit prompts in other ways:
- Inline: To start an inline chat directly in the editor or integrated terminal, enter Command+i (Mac) / Ctrl+i (Windows/Linux).
- Quick chat: To open the quick chat dropdown, enter Shift+Command+i (Mac) / Shift+Ctrl+i (Windows/Linux)
- Smart actions: To submit prompts via the context menu, right click in your editor, select Copilot in the menu that appears, then select one of the actions. Smart actions can also be accessed via the sparkle icon that sometimes appears when you select a line of code.
See inline chat, quick chat, and chat smart actions in the Visual Studio Code documentation for more details.
Multi-file edits
Note
Multi-file edit is currently in public preview and subject to change.
Use Copilot Edits to make changes across multiple files directly from a single Copilot Chat prompt.
- Enable Copilot Edits in the Copilot Extension settings.
- Start an edit session by selecting Open Copilot Edits from the Copilot Chat menu.
- Optionally, add relevant files to the working set to indicate to GitHub Copilot which files you want to work on.
- Submit a prompt. In response to your prompt, Copilot Edits determines which files in your working set to change and adds a short description of the change.
- Review the changes and Apply or Discard the edits for each file.
For more information, see Copilot Edits in the Visual Studio Code documentation.
Sharing feedback
To indicate whether a response was helpful, use the thumbs up and thumbs down icons that appear next to the response.
To leave feedback about the GitHub Copilot Chat extension, open an issue in the microsoft/vscode-copilot-release repository.
Further reading
- Prompt engineering for GitHub Copilot
- Using Copilot Chat in VS Code and Getting started with GitHub Copilot Chat in VS Code in the Visual Studio Code documentation
- Asking GitHub Copilot questions in GitHub
- Responsible use of GitHub Copilot Chat in your IDE
- GitHub Terms for Additional Products and Features
- GitHub Copilot Trust Center
- GitHub Copilot FAQ