Skip to main content

Utilisation de GitHub Copilot Chat dans votre IDE

Vous pouvez commencer à utiliser GitHub Copilot Chat en installant l’extension dans l’environnement de votre choix.

Important:

All users with a GitHub Copilot Individual subscription can access GitHub Copilot Chat in your IDE.

Owners of organizations or enterprises with a Copilot Business subscription, or a Copilot Enterprise subscription, can decide whether to grant access to GitHub Copilot Chat in your IDE, and - with a Copilot Enterprise subscription - GitHub.com.

About GitHub Copilot Chat and Visual Studio Code

GitHub Copilot Chat is a chat interface that lets you ask and receive answers to coding-related questions directly within a supported IDE. Copilot Chat can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see "About GitHub Copilot Chat in your IDE."

If you have a GitHub Copilot Enterprise subscription you may also be able to use GitHub Copilot Chat on GitHub.com, depending on your organization or enterprise settings. For more information, see "Using GitHub Copilot Chat in GitHub.com."

Prerequisites

  • To use GitHub Copilot Chat you must have an active GitHub Copilot subscription. For more information, see "About billing for GitHub Copilot."

  • To use GitHub Copilot Chat in Visual Studio Code, you must have the latest version of Visual Studio Code installed. For more information, see the Visual Studio Code download page.

  • To use GitHub Copilot Chat in Visual Studio Code, you must be signed into Visual Studio Code with the same GitHub ID that has access to GitHub Copilot.

Enabling or disabling GitHub Copilot Chat

Note: If you have a GitHub Copilot Individual subscription, you are automatically granted access to GitHub Copilot Chat.

GitHub Copilot Chat is available to all organizations and enterprises that have an active GitHub Copilot Business or GitHub Copilot Enterprise subscription. You can enable or disable GitHub Copilot Chat for your organization or enterprise in the settings page for Copilot.

If Copilot Chat is enabled or disabled at the enterprise level, organizations within the enterprise cannot override the setting.

Enabling or disabling GitHub Copilot Chat at the organization level

  1. In the upper-right corner of GitHub, select your profile photo, then click Your organizations.

    Screenshot of the dropdown menu under @octocat's profile picture. "Your organizations" is outlined in dark orange.

  2. Next to the organization, click Settings.

  3. In the "Code, planning, and automation" section of the sidebar, click Copilot, and then click Policies.

  4. To the right of Copilot Chat in the IDE, select the dropdown menu, and then click Enabled or Disabled.

Enabling or disabling GitHub Copilot Chat at the enterprise level

  1. In the enterprise account sidebar, click Policies.
  2. Under " Policies", click Copilot.
  3. To the right of Copilot Chat in the IDE, select the dropdown menu, and then choose the appropriate option.
    • Click Allowed to enable GitHub Copilot Chat for all organizations under your enterprise.
    • Click Blocked to disable GitHub Copilot Chat for all organizations under your enterprise.
    • Click No policy to allow each organization under your enterprise to set their own policy.

Installing the GitHub Copilot Chat extension in Visual Studio Code

To use GitHub Copilot Chat, you must first install the GitHub Copilot Chat extension for Visual Studio Code.

  1. In Visual Studio Code, open the Extensions view by clicking the Extensions icon in the activity bar on the left side of the Visual Studio Code window.

    Screenshot of the extensions icon in the Activity Bar.

  2. In the "Search Extensions in Marketplace" search box, search for the GitHub Copilot Chat extension, then click Install.

    Screenshot of the GitHub Copilot Chat extension in the Extensions Marketplace.

  3. In the Visual Studio Code window, click Reload required to update Visual Studio Code.

  4. If you are prompted to sign in by a toast notification in the bottom right corner of Visual Studio Code, click Sign in to GitHub. Sign in with the same GitHub ID that has a license for GitHub Copilot, or is assigned a seat for GitHub Copilot through an organization.

  5. Follow the prompts in Visual Studio Code and on GitHub in your browser to complete the sign in and authentication process.

  6. To confirm that GitHub Copilot Chat has been successfully installed, in the activity bar on the left side of the Visual Studio Code window, click the Copilot Chat icon to open the Copilot Chat chat window.

    Screenshot of the Copilot Chat icon in the Activity Bar.

Note: If you experience authentication issues after installing the extension, see "Troubleshooting issues with GitHub Copilot Chat in IDEs."

Asking your first question

GitHub Copilot Chat is intended to answer exclusively coding related questions that you ask in natural language. For example, you can ask GitHub Copilot Chat to help you write a function that returns the sum of two numbers.

  1. In the Visual Studio Code activity bar, click the Copilot Chat icon to open the Copilot Chat chat window.

    Screenshot of the Copilot Chat icon in the Activity Bar.

  2. At the bottom of the Copilot Chat window, in the Ask Copilot or type / for commands text box, type a coding-related question, then press Enter. For example, type "How do I write a function that returns the sum of two numbers?".

  3. Copilot Chat will process your question and provide an answer, with code suggestions when appropriate, in the chat window.

    If your question is outside the scope of GitHub Copilot Chat, it will tell you and may suggest an alternative question to ask.

  4. Optionally, if Copilot Chat suggests a follow-up question above the Ask Copilot or type / for commands text box, click the follow-up question to ask it.

Using code suggestions from GitHub Copilot Chat

When Copilot Chat provides code suggestions, you have a few options for how to use them.

  1. In the Copilot Chat window, to show the options for a code suggestion, hover over the suggestion.

    Screenshot of code suggestion options in the Copilot Chat window.

  2. Choose one of the options for using the code suggestion.

    • To copy the code suggestion to your clipboard, click the Copy icon.
    • To insert the code suggestion into your code at the current location of your cursor, click the Insert at Cursor icon.
    • To view additional options, click the ... icon.
      • To create a new file and insert the suggestion into it, click Insert Into New File.
      • To run the code suggestion in the Visual Studio Code terminal, click Run in Terminal.

Asking GitHub Copilot Chat questions about your code

Copilot Chat can provide answers and support with a wide range of coding related topics.

  1. In Visual Studio Code, open the file you want Copilot Chat to help you with.

  2. In the activity bar, click the Copilot Chat icon to open the Copilot Chat chat window.

  3. To ask a question about the code that's currently visible in the editor, type #editor followed by your question.

    For example, you could type #editor what does this code do? to ask Copilot Chat for a description of the code's purpose.

    Use the #editor command, anywhere in your question, to tell Copilot Chat to focus on the code that's currently visible in the editor.

  4. If a single method is visible in full in the editor, you could ask Copilot Chat to generate a unit test for the method by typing Write a unit test for the method in the #editor.

    Alternatively, select the code you want to generate a unit test for, then ask Copilot: #selection write a unit test for this code.

    The #selection command ensure that Copilot focuses on the selected code when responding to a question.

  5. To fix a bug in some code, select the code in the editor, then ask Copilot: #selection fix the bug in this code.

  6. To focus Copilot on one or more specific files when you ask a question, use the #file command.

    1. In the Copilot Chat window, type #file and press Enter. This opens the Quick Open palette at the top of the editor.
    2. Select from the list of recently opened files, or search for the file you want to focus on and select it.
    3. Type your question. For example, #file:app.js What does this file do?.

    You can use the #file command multiple times in your question to focus Copilot on more than one file.

Note: To find out about other special commands you can use with Copilot Chat, enter /help in the chat input box. For more information on slash commands, see Using Copilot Chat in VS Code in the VS Code documentation.

Sharing feedback about GitHub Copilot Chat

To share feedback about Copilot Chat, you can use the share feedback button in the Copilot Chat window.

  1. At the top of the Copilot Chat window, click the ellipsis (...), then click Send Chat Feedback.
  2. In your browser, in the vscode-copilot-release repository, click New issue.
  3. Choose one of the options that are displayed:
    • To open an issue to report a bug, click Bug report for GitHub Copilot Chat.
    • To open an issue to request a feature, click Feature request for GitHub Copilot Chat.
    • To report a security vulnerability, click Report a security vulnerability.
    • To ask a question in a discussion, click Questions.

Further reading

Important:

All users with a GitHub Copilot Individual subscription can access GitHub Copilot Chat in your IDE.

Owners of organizations or enterprises with a Copilot Business subscription, or a Copilot Enterprise subscription, can decide whether to grant access to GitHub Copilot Chat in your IDE, and - with a Copilot Enterprise subscription - GitHub.com.

About GitHub Copilot Chat and Visual Studio

GitHub Copilot Chat is a chat interface that lets you ask and receive answers to coding-related questions directly within a supported IDE. Copilot Chat can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see "About GitHub Copilot Chat in your IDE."

If you have a GitHub Copilot Enterprise subscription you may also be able to use GitHub Copilot Chat on GitHub.com, depending on your organization or enterprise settings. For more information, see "Using GitHub Copilot Chat in GitHub.com."

For more information about using GitHub Copilot Chat in Visual Studio, see the Visual Studio Copilot Chat documentation.

Prerequisites

  • To use GitHub Copilot Chat you must have an active GitHub Copilot subscription. For more information, see "About billing for GitHub Copilot."

  • To use GitHub Copilot Chat with Visual Studio, you must be running Visual Studio 2022 version 17.8 or higher. For more information, see the Visual Studio GitHub Copilot documentation.

  • To use GitHub Copilot Chat with Visual Studio, you must be signed into Visual Studio with the same GitHub ID that has access to GitHub Copilot.

Enabling or disabling GitHub Copilot Chat

Note: If you have a GitHub Copilot Individual subscription, you are automatically granted access to GitHub Copilot Chat.

GitHub Copilot Chat is available to all organizations and enterprises that have an active GitHub Copilot Business or GitHub Copilot Enterprise subscription. You can enable or disable GitHub Copilot Chat for your organization or enterprise in the settings page for Copilot.

If Copilot Chat is enabled or disabled at the enterprise level, organizations within the enterprise cannot override the setting.

Enabling or disabling GitHub Copilot Chat at the organization level

  1. In the upper-right corner of GitHub, select your profile photo, then click Your organizations.

    Screenshot of the dropdown menu under @octocat's profile picture. "Your organizations" is outlined in dark orange.

  2. Next to the organization, click Settings.

  3. In the "Code, planning, and automation" section of the sidebar, click Copilot, and then click Policies.

  4. To the right of Copilot Chat in the IDE, select the dropdown menu, and then click Enabled or Disabled.

Enabling or disabling GitHub Copilot Chat at the enterprise level

  1. In the enterprise account sidebar, click Policies.
  2. Under " Policies", click Copilot.
  3. To the right of Copilot Chat in the IDE, select the dropdown menu, and then choose the appropriate option.
    • Click Allowed to enable GitHub Copilot Chat for all organizations under your enterprise.
    • Click Blocked to disable GitHub Copilot Chat for all organizations under your enterprise.
    • Click No policy to allow each organization under your enterprise to set their own policy.

Installing the GitHub Copilot Chat extension in Visual Studio

With Visual Studio version 17.10 Preview 3 or later, you can install a single extension that combines GitHub Copilot and GitHub Copilot Chat. If you use Visual Studio 17.8 or 17.9, you must install the GitHub Copilot and GitHub Copilot Chat extensions separately. The GitHub Copilot extension is a prerequisite for using GitHub Copilot Chat. For more information about the Visual Studio 17.10 Preview 3 release, see the Visual Studio Release Notes in the Microsoft documentation.

Installing the combined Copilot and Copilot Chat extension in Visual Studio for versions 17.10 Preview 3 and later

  1. Download the latest preview version of Visual Studio 2022 17.10 from Visual Studio Release Notes in the Microsoft documentation.

  2. Follow the on-screen instructions to install Visual Studio.

  3. When Visual Studio Installer launches, select the workloads you require, and then under "Installation details", expand the Individual components details and select GitHub Copilot.

    Screenshot of the Visual Studio Installer. The GitHub Copilot component is highlighted with an orange outline.

  4. In the bottom-right corner of Visual Studio Installer, click Modify.

  5. When the modification is complete, close the Visual Studio Installer and launch Visual Studio.

  6. Optionally, to modify the installation or add more components, launch Visual Studio Installer from the Windows Start menu.

    • To the right of your installed version of Visual Studio, click Modify.
    • Make your desired changes, and in the bottom right corner click Modify again to apply them.

Installing the GitHub Copilot Chat extension in Visual Studio for versions 17.8 and 17.9

To use GitHub Copilot Chat with Visual Studio, you must install the Visual Studio extension.

For an alternative installation method, you can also use the Microsoft instructions to install the GitHub Copilot extension. For more information, see Installation instructions in the Microsoft documentation.

  1. In the Visual Studio menu bar, click Extensions, then click Manage Extensions.

    Screenshot of the menu bar in Visual Studio. The "Extensions" menu is open, and the "Manage Extensions" option is highlighted with an orange outline.

  2. In the "Manage Extensions" window, click Visual Studio Marketplace, search for "GitHub Copilot Chat", then click Download.

  3. Close the "Manage Extensions" window, then exit and relaunch Visual Studio.

Note: If you experience authentication issues after installing the extension, see "Troubleshooting issues with GitHub Copilot Chat in IDEs."

Asking your first question

GitHub Copilot Chat is intended to answer exclusively coding related questions that you ask in natural language. For example, you can ask GitHub Copilot Chat to help you write a function that returns the sum of two numbers.

  1. In the Visual Studio menu bar, to launch Copilot Chat, click View, then click GitHub Copilot Chat.

  2. At the bottom of the Copilot Chat window, in the Ask Copilot: Type / for commands and # to reference text box, type a coding related question, then press Enter. For example, type "How do I write a function that returns the sum of two numbers?".

    Note: If your question is outside the scope of GitHub Copilot Chat, it will tell you and may suggest an alternative question to ask.

  3. If Copilot Chat offers a code suggestion that you want to use, click the Copy icon to copy the code suggestion to your clipboard.

  4. Optionally, if Copilot Chat suggests a follow-up question under your last answer, click the follow-up question to ask it.

Asking GitHub Copilot Chat questions about your code

Copilot Chat can provide answers and support with a wide range of coding related topics.

  1. In Visual Studio, open the file you want Copilot Chat to help you with.

  2. In the Visual Studio menu bar, to launch Copilot Chat, click View, then click GitHub Copilot Chat.

  3. To ask a question about the code that's currently visible in the editor, type #editor followed by your question.

    For example, you could type #editor what does this code do? to ask Copilot Chat for a description of the code's purpose.

    Use the #editor command, anywhere in your question, to tell Copilot Chat to focus on the code that's currently visible in the editor.

  4. If a single method is visible in full in the editor, you could ask Copilot Chat to generate a unit test for the method by typing Write a unit test for the method in the #editor.

    Alternatively, select the code you want to generate a unit test for, then ask Copilot: #selection write a unit test for this code.

    The #selection command ensure that Copilot focuses on the selected code when responding to a question.

  5. To fix a bug in some code, select the code in the editor, then ask Copilot: #selection fix the bug in this code.

  6. To focus Copilot on one or more specific files when you ask a question, use the #file command.

    1. In the Copilot Chat window, type #file and press Enter. This opens the Quick Open palette at the top of the editor.
    2. Select from the list of recently opened files, or search for the file you want to focus on and select it.
    3. Type your question. For example, #file:app.js What does this file do?.

    You can use the #file command multiple times in your question to focus Copilot on more than one file.

Note: To find out about other special commands you can use with Copilot Chat, enter /help in the chat input box. For more information on slash commands, see Get better answers by setting the context for GitHub Copilot Chat in Visual Studio in the Visual Studio documentation.

Sharing feedback about GitHub Copilot Chat

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

Important:

All users with a GitHub Copilot Individual subscription can access GitHub Copilot Chat in your IDE.

Owners of organizations or enterprises with a Copilot Business subscription, or a Copilot Enterprise subscription, can decide whether to grant access to GitHub Copilot Chat in your IDE, and - with a Copilot Enterprise subscription - GitHub.com.

About GitHub Copilot Chat and JetBrains

GitHub Copilot Chat is a chat interface that lets you ask and receive answers to coding-related questions directly within a supported IDE. Copilot Chat can help you with a variety of coding-related tasks, like offering you code suggestions, providing natural language descriptions of a piece of code's functionality and purpose, generating unit tests for your code, and proposing fixes for bugs in your code. For more information, see "About GitHub Copilot Chat in your IDE."

If you have a GitHub Copilot Enterprise subscription you may also be able to use GitHub Copilot Chat on GitHub.com, depending on your organization or enterprise settings. For more information, see "Using GitHub Copilot Chat in GitHub.com."

Prerequisites

  • To use GitHub Copilot Chat you must have an active GitHub Copilot subscription. For more information, see "About billing for GitHub Copilot."

  • To use GitHub Copilot Chat in JetBrains, you must have a compatible JetBrains IDE installed. Copilot Chat is compatible with the following IDEs:

    • IntelliJ IDEA (Ultimate, Community, Educational)
    • Android Studio
    • AppCode
    • CLion
    • DataGrip
    • DataSpell
    • GoLand
    • MPS
    • PhpStorm
    • PyCharm (Professional, Community, Educational)
    • Rider
    • RubyMine
    • RustRover
    • WebStorm

    For more information, see the JetBrains IDEs tool finder.

Enabling or disabling GitHub Copilot Chat

Note: If you have a GitHub Copilot Individual subscription, you are automatically granted access to GitHub Copilot Chat.

GitHub Copilot Chat is available to all organizations and enterprises that have an active GitHub Copilot Business or GitHub Copilot Enterprise license. You can enable or disable GitHub Copilot Chat for your organization or enterprise in the GitHub Copilot settings page.

If Copilot Chat is enabled or disabled at the enterprise level, organizations within the enterprise cannot override the setting.

Enabling or disabling GitHub Copilot Chat at the organization level

  1. In the upper-right corner of GitHub, select your profile photo, then click Your organizations.

    Screenshot of the dropdown menu under @octocat's profile picture. "Your organizations" is outlined in dark orange.

  2. Next to the organization, click Settings.

  3. In the "Code, planning, and automation" section of the sidebar, click Copilot, and then click Policies.

  4. To the right of Copilot Chat in the IDE, select the dropdown menu, and then click Enabled or Disabled.

Enabling or disabling GitHub Copilot Chat at the enterprise level

  1. In the enterprise account sidebar, click Policies.
  2. Under " Policies", click Copilot.
  3. To the right of Copilot Chat in the IDE, select the dropdown menu, and then choose the appropriate option.
    • Click Allowed to enable Copilot Chat for all organizations under your enterprise.
    • Click Blocked to disable Copilot Chat for all organizations under your enterprise.
    • Click No policy to allow each organization under your enterprise to set their own policy.

Installing or updating the GitHub Copilot plugin in JetBrains

To use Copilot Chat in a JetBrains IDE, you must install or update the GitHub Copilot plugin. If you have not yet installed the GitHub Copilot plugin, follow the steps in "Installing the GitHub Copilot plugin in your JetBrains IDE." If you have already installed the GitHub Copilot plugin, follow the steps in "Updating the GitHub Copilot plugin in JetBrains."

The following procedures will guide you through installing or updating the GitHub Copilot plugin in IntelliJ IDEA. Steps to install the plugin in another supported IDE may differ.

Installing the GitHub Copilot plugin in your JetBrains IDE

To use GitHub Copilot in a JetBrains IDE, you must install the GitHub Copilot plugin.

  1. In your JetBrains IDE, under the File menu for Windows or under the name of your IDE for Mac (for example, PyCharm or IntelliJ), click Settings for Windows or Preferences for Mac.

  2. In the left-side menu of the Settings/Preferences dialog box, click Plugins.

  3. At the top of the Settings/Preferences dialog box, click Marketplace. In the search bar, search for GitHub Copilot, then click Install.

    Screenshot of the "Preferences" window. A tab labeled "Marketplace" is highlighted with an orange outline. In a list of search results, the installed "GitHub Copilot" plugin is marked by a selected checkbox.

  4. After GitHub Copilot is installed, click Restart IDE.

  5. After your JetBrains IDE has restarted, click the Tools menu. Click GitHub Copilot, then click Login to GitHub.

    Screenshot of the expanded "Tools" menu and "GitHub Copilot" sub-menu. The "Login to GitHub" option is highlighted in blue.

  6. In the "Sign in to GitHub" dialog box, to copy the device code and open the device activation window, click Copy and Open.

    Screenshot of the "Sign in to GitHub" dialog. A device code is displayed above a button labeled "Copy and Open".

  7. A device activation window will open in your browser. Paste the device code, then click Continue.

  8. GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click Authorize GitHub Copilot Plugin.

  9. After the permissions have been approved, your JetBrains IDE will show a confirmation. To begin using GitHub Copilot, click OK.

Updating the GitHub Copilot plugin in JetBrains

  1. In your JetBrains IDE, under the File menu for Windows or under the name of your IDE for Mac (for example, PyCharm or IntelliJ), click Settings for Windows or Preferences for Mac.
  2. In the left-side menu of the Settings/Preferences dialog box, click Plugins.
  3. At the top of the Settings/Preferences dialog box, click Installed. In the search bar, search for GitHub Copilot, then click Update.
  4. After GitHub Copilot is updated, quit and relaunch your JetBrains IDE.

Asking your first question

GitHub Copilot Chat is intended to answer exclusively coding related questions that you ask in natural language. For example, you can ask GitHub Copilot Chat to help you write a function that returns the sum of two numbers.

  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 bottom of the Copilot Chat window, in the Ask Copilot a question or type / for commands text box, type a coding related question, then press Enter. For example, type "How do I write a function that returns the sum of two numbers?".

  3. Copilot Chat will process your question and provide an answer, with code suggestions when appropriate, in the chat window.

    If your question is outside the scope of GitHub Copilot Chat, it will tell you and may suggest an alternative question to ask.

  4. Optionally, if Copilot Chat suggests a follow-up question above the Ask Copilot a question or type / for commands text box, click the follow-up question to ask it.

Asking GitHub Copilot Chat questions about your code

Copilot Chat can provide answers and support with a wide range of coding-related topics.

  1. In your JetBrains IDE, open the file you want Copilot Chat to help you with.
  2. Ask Copilot Chat a question about the file you have open. For example:
    • To generate a description of the file's purpose, ask a question like, "What does this file do?"
    • To generate a unit test for the file, type a request like, "Write a unit test for this file." Alternatively, highlight the code you want to generate a unit test for, then ask a question like, "Write a unit test for this code."
    • To generate a fix for a bug in the file, type a request like, "Fix this bug."
  3. Optionally, you can prompt Copilot Chat to perform predefined tasks with slash commands. To see a list of all available slash commands and their definitions, in the Ask Copilot a question or type / for commands text box, type /.

Sharing feedback about GitHub Copilot Chat

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