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.

Introduction

This guide describes how to use Copilot Chat to ask questions about software development in your IDE. You can ask general questions about software development, or specific questions about the code in your project. For more information, see About GitHub Copilot Chat.

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 and features for GitHub 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. In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.

  2. In the Copilot Chat window, enter a prompt, then press Enter. For example prompts, see Getting started with prompts for GitHub 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, insert, or preview the result of a code block.

    To see the files that Copilot Chat used to generate the response, click the References link below the response. The references may include a link to a custom instructions file for your repository. 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 repository custom instructions for GitHub Copilot.

Using keywords in your prompt

You can use special keywords to help Copilot understand your prompt.

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 GitHub 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 or 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.

See also GitHub Copilot Chat cheat sheet or Reference in the Visual Studio documentation.

Using GitHub skills for Copilot (preview)

Note

The @github chat participant is currently in preview, and only available in Visual Studio 2022 Preview 2 onwards.

Copilot's GitHub-specific skills expand the type of information Copilot can provide. To access these skills in Copilot Chat in Visual Studio, 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. For example, @github Search the web to find the latest GPT4 model from OpenAI.

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 GitHub Copilot Chat.

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.

Copilot Edits

Note

  • This feature is currently in public preview and subject to change.
  • Available in Visual Studio 17.14 and later.

Copilot Edits lets you make changes across multiple files from a single Copilot Chat prompt

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.

Using agent mode

  1. In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.
  2. At the bottom of the chat panel, select Agent from the mode dropdown.
  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.

Using images in Copilot Chat

Note

You can attach images to your chat prompts and then ask Copilot about the images. For example, you can attach:

  • A screenshot of a code snippet and ask Copilot to explain the code.
  • A mockup of the user interface for an application and ask Copilot to generate the code.
  • A flowchart and ask Copilot to describe the processes shown in the image.
  • A screenshot of a web page and ask Copilot to generate HTML for a similar page.

Note

The following types of image file are supported: JPEG (.jpg, .jpeg), PNG (.png), GIF (.gif), or WEBP (.webp).

Attaching images to your chat prompt

  1. If you see the AI model picker at the bottom right of the chat view, select one of the models that supports adding images to prompts:

    • GPT-4.1 (the default that's used if you don't see a model picker)
    • Claude Sonnet 3.5
    • Claude Sonnet 3.7
    • Gemini 2.0 Flash
    • Gemini 2.5 Pro
  2. Do one of the following:

    • Copy an image and paste it into the chat view.
    • Click the paperclip icon at the bottom right of the chat view, click Upload Image, browse to the image file you want to attach, select it and click Open.

    You can add multiple images if required.

  3. Type your prompt into the chat view to accompany the image. For example, explain this image, or describe each of these images in detail.

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.

  1. In the top right corner of the Visual Studio window, click the Send feedback button.

    Screenshot of the share feedback button in Visual Studio.

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