Asking GitHub Copilot questions in your IDE - GitHub Docs (original) (raw)

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. To open the chat view, click the chat icon in the activity bar or press Control+Command+i (Mac) / Ctrl+Alt+i (Windows/Linux).
    Screenshot of the Copilot Chat icon in the Activity Bar.
    Tip
    For additional ways to access Copilot Chat, including inline with your code, see Additional ways to access Copilot Chat below.
  2. Enter a prompt in the prompt box, or click one of the suggested prompts. For example prompts, see "Example prompts for Copilot Chat."
  3. 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 "Example 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:

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:

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:

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:

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. Note: this requires indexing to be enabled for the repository (see "Indexing repositories for Copilot Chat"). Yes Available for all repositories with a Copilot Enterprise subscription, and for public repositories with a Copilot Individual or Copilot Business 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 is useful for teaching Copilot 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:

For more information about the o1 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

  1. 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."
  2. To open the chat view, click the chat icon in the activity bar or press Control+Command+i (Mac) / Ctrl+Alt+i (Windows/Linux).
  3. 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:

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.

  1. Enable Copilot Edits in the Copilot Extension settings.
  2. Start an edit session by selecting Open Copilot Edits from the Copilot Chat menu.
  3. Optionally, add relevant files to the working set to indicate to GitHub Copilot which files you want to work on.
  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 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

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. 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 "Example 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, 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. 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.

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:

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:

See also Reference in the Visual Studio documentation.

Using GitHub skills for Copilot (preview)

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.

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 Visual Studio include those shown in the table below.

Skill Description Enabled by default? Example question
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?
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. Note: this requires indexing to be enabled for the repository (see "Indexing repositories for Copilot Chat"). Yes Available for all repositories with a Copilot Enterprise subscription, and for public repositories with a Copilot Individual or Copilot Business subscription. How does this repo manage HTTP requests and responses?
Web search Searches the web using the Bing search engine. This skill is useful for teaching Copilot 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 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:

For more information about the o1 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

To use multi-model Copilot Chat, you must use Visual Studio 17.12 Preview 3 or later. See Visual Studio 2022 Preview in the Visual Studio documentation.

Note

  1. 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."
  2. In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.
  3. 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 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.

  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

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 "Example 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:

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

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