Prerequisites
- Access to GitHub Copilot. See "About 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.
-
Open the chat view by clicking the chat icon in the activity bar or by entering 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 example prompts, see "Example 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.
Using keywords in your prompt
You can use special keywords to help Copilot understand your prompt. For examples, see "Example prompts for Copilot Chat."
Chat participants
Use chat participants to scope your prompt to a specific domain. To use a chat participant, type @
in the chat prompt box, followed by a chat participant name. 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.
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 beta 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.
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.
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
Prerequisites
- Access to GitHub Copilot. See "About GitHub Copilot."
- Visual Studio 2022 version 17.8 or later. See Install Visual Studio in the Visual Studio documentation.
- GitHub Copilot extension. See Install GitHub Copilot in Visual Studio in the Visual Studio documentation.
- GitHub Copilot Chat extension. See Install GitHub Copilot in Visual Studio in the Visual Studio documentation.
- Sign in to GitHub in Visual Studio. 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.
-
In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.
-
In the Copilot Chat window, enter a prompt, then press Enter. For example prompts, see "Example prompts for Copilot Chat."
-
Evaluate Copilot's response, and submit a follow up prompt if needed.
The response often includes interactive elements. For example, the response may include buttons to copy, insert, or preview the result of a code block.
To see the files that Copilot Chat used to generate the response, select the References dropdown below the response.
Using keywords in your prompt
You can use special keywords to help Copilot understand your prompt.
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/optimize
: Analyze and improve the runtime of the selected code
To see all available slash commands, type /
in the chat prompt box. See also Slash commands in the Visual Studio documentation.
References
By default, Copilot Chat will reference the file that you have open or the code that you have selected. You can also use #
followed by a file name, file name and line numbers, or solution
to reference a specific file, lines, or solution. For example:
- Reference a specific file:
Where are the tests in #MyFile.cs?
- Reference multiple files:
How are these files related #MyFile.cs #MyFile2.cs
- Reference specific lines in a file:
Explain this function #MyFile.cs: 66-72?
- Reference the current file:
Is there a delete method in this #solution
See also Reference in the Visual Studio documentation.
Additional ways to access Copilot Chat
In addition to submitting prompts through the chat window, you can submit prompts inline. To start an inline chat, right click in your editor window and select Ask Copilot.
See Ask questions in the inline chat view in the Visual Studio documentation for more details.
Sharing feedback
To share feedback about 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.
Further reading
- "Prompt engineering for GitHub Copilot"
- Using GitHub Copilot Chat in Visual Studio in the Microsoft Learn documentation
- Tips to improve GitHub Copilot Chat results in the Microsoft Learn documentation
- "Responsible use of GitHub Copilot Chat in your IDE"
- "GitHub Terms for Additional Products and Features"
- GitHub Copilot FAQ
Prerequisites
-
Access to GitHub Copilot. See "About GitHub Copilot."
-
A compatible JetBrains IDE. GitHub Copilot is compatible with the following IDEs:
- IntelliJ IDEA (Ultimate, Community, Educational)
- Android Studio
- AppCode
- CLion
- Code With Me Guest
- DataGrip
- DataSpell
- GoLand
- JetBrains Client
- MPS
- PhpStorm
- PyCharm (Professional, Community, Educational)
- Rider
- RubyMine
- RustRover
- WebStorm
See the JetBrains IDEs tool finder to download.
-
GitHub Copilot plugin. See the GitHub Copilot plugin in the JetBrains Marketplace. For installation instructions, see "Installing the GitHub Copilot extension in your environment."
-
Log in to GitHub in your JetBrains IDE. For authentication instructions, see "Installing the GitHub Copilot extension in your environment."
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.
-
Open the Copilot Chat window by clicking the Copilot Chat icon at the right side of the JetBrains IDE window.
-
Enter a prompt in the prompt box. For example prompts, see "Example prompts for Copilot Chat."
-
Evaluate Copilot's response, and submit a follow up prompt if needed.
The response often includes interactive elements. For example, the response may include buttons to copy or insert a code block.
To see the files that Copilot Chat used to generate the response, select the References dropdown below the response.
Using keywords in your prompt
You can use special keywords to help Copilot understand your prompt.
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/help
: Learn more about using Copilot Chat
To see all available slash commands, type /
in the chat prompt box.
File references
By default, Copilot Chat will reference the file that you have open or the code that you have selected. You can also tell Copilot Chat which files to reference by dragging a file into the chat prompt box. Alternatively, you can right click on a file, select GitHub Copilot, then select Reference File in Chat.
Additional ways to access Copilot Chat
In addition to submitting prompts through the chat window, you can submit built-in requests by right clicking in a file, selecting GitHub Copilot, then selecting one of the options.
Sharing feedback
To share feedback about Copilot Chat, you can use the share feedback link in JetBrains.
-
At the right side of the JetBrains IDE window, click the Copilot Chat icon to open the Copilot Chat window.
-
At the top of the Copilot Chat window, click the share feedback link.