Skip to main content

Asking GitHub Copilot questions in your IDE

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

Prerequisites

If you have access to GitHub Copilot via your organization or enterprise, you won't be able to use GitHub Copilot Chat if your organization owner or enterprise administrator has disabled chat. See Managing policies for Copilot in your organization.

Submitting prompts

You can ask Copilot Chat to give you code suggestions, explain code, generate unit tests, and suggest code fixes.

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

    Screenshot of the GitHub 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.

Chat participants

Chat participants are like domain experts who have a specialty that they can help you with. You can use 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.

For a list of available chat participants, type @ in the chat prompt box. See also GitHub Copilot Chat cheat sheet.

Extending Copilot Chat

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.

To see all available slash commands, type / in the chat prompt box. See also GitHub Copilot Chat cheat sheet.

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.

Using GitHub skills for Copilot

Copilot's GitHub-specific skills expand the type of information Copilot can provide. To access these skills in Copilot Chat, 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 GPT 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?

You can generate a list of currently available skills by asking Copilot: @github What skills are available?

AI models for Copilot Chat

You can change the large language model that Copilot uses to generate responses to chat prompts, including premium models with advanced capabilities. You may find that different models perform better, or provide more useful responses, depending on the type of questions you ask. For more information see Changing the AI model for Copilot 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.

Copilot Edits

Use Copilot Edits to make changes across multiple files directly from a single Copilot Chat prompt. Copilot Edits has the following modes:

  • Edit mode lets Copilot make controlled edits to multiple files.
  • Agent mode lets Copilot autonomously accomplish a set task.

Edit mode

Edit mode is only available in Visual Studio Code and JetBrains IDEs.

Use edit mode when you want more granular control over the edits that Copilot proposes. In edit mode, you choose which files Copilot can make changes to, provide context to Copilot with each iteration, and decide whether or not to accept the suggested edits after each turn.

Edit mode is best suited to use cases where:

  • You want to make a quick, specific update to a defined set of files.
  • You want full control over the number of LLM requests Copilot uses.

Using edit mode

  1. To start an edit session, click Copilot in the menu bar, then select Open GitHub Copilot Chat.
  2. At the top of the chat panel, click Copilot Edits.
  3. Add relevant files to the working set to indicate to GitHub Copilot which files you want to work on. You can add all open files by clicking Add all open files or individually search for single files.
  4. 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.
  5. Review the changes and Accept or Discard the edits for each file.

Agent mode

Use agent mode when you have a specific task in mind and want to enable Copilot to autonomously edit your code. In agent mode, Copilot determines which files to make changes to, offers code changes and terminal commands to complete the task, and iterates to remediate issues until the original task is complete.

Agent mode is best suited to use cases where:

  • Your task is complex, and involves multiple steps, iterations, and error handling.
  • You want Copilot to determine the necessary steps to take to complete the task.
  • The task requires Copilot to integrate with external applications, such as an MCP server.

Using agent mode

  1. To start an edit session using agent mode, click Copilot in the menu bar, then select Open GitHub Copilot Chat.
  2. At the top of the chat panel, click the Agent tab.
  3. Submit a prompt. In response to your prompt, Copilot streams the edits in the editor, updates the working set, and if necessary, suggests terminal commands to run.
  4. Review the changes. If Copilot suggested terminal commands, confirm whether or not Copilot can run them. In response, Copilot iterates and performs additional actions to complete the task in your original prompt.

When you use Copilot agent mode, each prompt you enter counts as one premium request, multiplied by the model’s multiplier. For example, if you're using the included model—which has a multiplier of 0—your prompts won’t consume any premium requests. Copilot may take several follow-up actions to complete your task, but these follow-up actions do not count toward your premium request usage. Only the prompts you enter are billed—tool calls or background steps taken by the agent are not charged.

The total number of premium requests you use depends on how many prompts you enter and which model you select. See Understanding and managing requests in Copilot.

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