Skip to main content

Asking GitHub Copilot questions in your IDE

Use Copilot Chat in your editor to give code suggestions, explain code, generate unit tests, and suggest code fixes.

Prerequisites

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.

  1. Open the Copilot Chat window by clicking the Copilot Chat icon at the right side of the JetBrains IDE window.

    Screenshot of the Copilot Chat icon in the Activity Bar.

  2. Enter a prompt in the prompt box. For example prompts, see Getting started with prompts for Copilot Chat.

  3. 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.

Extending Copilot Chat

Note

GitHub Copilot Extensions is in public preview and subject to change.

GitHub Copilot Extensions integrate the power of external tools into Copilot Chat, helping you reduce context switching and receive responses with domain-specific context. You can install Copilot Extensions from the GitHub Marketplace or build private ones within your organization, then type @ in a chat window to see a list of your available extensions. To use an extension, select the extension from the list or type the full slug name, then type your prompt.

To learn more, see Using extensions to integrate external tools with Copilot Chat.

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

  • Built-in requests. 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.
  • Inline. You can submit a chat prompt inline, and scope it to a highlighted code block or your current file.
    • To start an inline chat, right click on a code block or anywhere in your current file, hover over GitHub Copilot, then select Copilot: Inline Chat, or enter Ctrl+Shift+I.

Sharing feedback

To share feedback about Copilot Chat, you can use the share feedback link in JetBrains.

  1. At the right side of the JetBrains IDE window, click the Copilot Chat icon to open the Copilot Chat window.

    Screenshot of the Copilot Chat icon in the Activity Bar.

  2. At the top of the Copilot Chat window, click the share feedback link.

    Screenshot of the share feedback link in the Copilot Chat window.

Further reading