Skip to main content

Configuration de GitHub Copilot dans votre environnement

Vous pouvez activer, configurer ou désactiver GitHub Copilot dans un IDE pris en charge.

Dans cet article

About GitHub Copilot in JetBrains IDEs

If you use a JetBrains IDE, GitHub Copilot can autocomplete code as you type. After installation, you can enable or disable GitHub Copilot, and you can configure advanced settings within your IDE or on GitHub. This article describes how to configure GitHub Copilot in the IntelliJ IDE, but the user interfaces of other JetBrains IDEs may differ.

Prerequisites

To configure GitHub Copilot in a JetBrains IDE, you must install the GitHub Copilot plugin. For more information, see Getting code suggestions in your IDE with GitHub Copilot.

Using or rebinding keyboard shortcuts for GitHub Copilot

You can use the default keyboard shortcuts for inline suggestions in your JetBrains IDE when using GitHub Copilot. Alternatively, you can rebind the shortcuts to your preferred keyboard shortcuts for each specific command. For more information on rebinding keyboard shortcuts in your JetBrains IDE, see the JetBrains documentation. For example, you can view the IntelliJ IDEA documentation.

Keyboard shortcuts for macOS

ActionShortcut
Accept an inline suggestionTab
Dismiss an inline suggestionEsc
Show next inline suggestionOption (⌥) or Alt+]
Show previous inline suggestionOption (⌥) or Alt+[
Trigger inline suggestionOption (⌥)+\
Open GitHub Copilot (additional suggestions in separate pane)Option (⌥) or Alt+Return

Keyboard shortcuts for Windows

ActionShortcut
Accept an inline suggestionTab
Dismiss an inline suggestionEsc
Show next inline suggestionAlt+]
Show previous inline suggestionAlt+[
Trigger inline suggestionAlt+\
Open GitHub Copilot (additional suggestions in separate pane)Alt+Enter

Keyboard shortcuts for Linux

ActionShortcut
Accept an inline suggestionTab
Dismiss an inline suggestionEsc
Show next inline suggestionAlt+]
Show previous inline suggestionAlt+[
Trigger inline suggestionAlt+\
Open GitHub Copilot (additional suggestions in separate pane)Alt+Enter

Enabling or disabling GitHub Copilot

You can enable or disable GitHub Copilot from within your JetBrains IDE. The GitHub Copilot status icon in the bottom panel of the JetBrains window indicates whether GitHub Copilot is enabled or disabled. When enabled, the icon is highlighted. When disabled, the icon is grayed out.

  1. To enable or disable GitHub Copilot, click the status icon in the bottom panel on the right of the JetBrains window.

    Screenshot of the bottom panel in a JetBrains IDE. The GitHub Copilot status icon is outlined in dark orange.

  2. If you are disabling GitHub Copilot, you will be asked whether you want to disable it globally, or for the language of the file you are currently editing. To disable globally, click Disable Completions. Alternatively, click the language-specific button to disable GitHub Copilot for the specified language.

    Screenshot of the menu to disable GitHub Copilot globally or for the current language in a JetBrains IDE.

Configuring advanced settings for GitHub Copilot

You can manage advanced settings for GitHub Copilot in your JetBrains IDE, such as how your IDE displays code completions, and which languages you want to enable or disable for GitHub Copilot.

  1. In your JetBrains IDE, click the File menu (Windows), or the name of the application in the menu bar (macOS), then click Settings.
  2. Under Languages & Frameworks, click GitHub Copilot.
  3. Edit the settings according to your personal preferences.
    • To adjust the behavior and appearance of code suggestions, and whether to automatically check for updates, select or deselect the corresponding checkboxes.
    • If you have selected to receive automatic updates, you can choose whether to receive stable, but less frequent updates, or nightly updates, which may be less stable. Click the Update channel dropdown and select Stable for stable updates, or Nightly for nightly updates.

Configuring language settings for GitHub Copilot

You can specify which languages you want to activate or deactivate GitHub Copilot for either in the IDE or by editing your github-copilot.xml file. If you make changes to language settings in your IDE, you can individually select and deselect the languages you want to activate or deactivate.

If you make changes to the language settings in your github-copilot.xml file, you can specify individual languages, or you can use a wildcard to activate or deactivate GitHub Copilot for all languages. You can also specify exceptions, which will override the wild card setting for the specified languages. For example, you can deactivate GitHub Copilot for all languages, except for Python and YAML. By default, when you install the GitHub Copilot extension, GitHub Copilot is activated for all languages.

Configuring language settings in the IDE

  1. In your JetBrains IDE, click the File menu (Windows), or the name of the application in the menu bar (macOS), then click Settings.
  2. Under Languages & Frameworks, click GitHub Copilot.
  3. Under "Languages," select or deselect the checkboxes for the languages you want to activate or deactivate GitHub Copilot for.
  4. Click Apply, and then click OK.
  5. Restart your JetBrains IDE for the changes to take effect.

Editing your github-copilot.xml file

To configure language settings in the github-copilot.xml file, you must edit the languageAllowList. Every line you add to the languageAllowList must contain an entry key and a value. The entry key is the name of the language, or (*) for a wildcard. The value is either true or false. If the value is true, GitHub Copilot is activated for the specified language. If the value is false, GitHub Copilot is deactivated for the specified language.

The file is located in the following directory:

  • macOS: ~/Library/Application Support/JetBrains/<product><version>/options/github-copilot.xml
  • Windows: %APPDATA%\JetBrains\<product><version>\options\github-copilot.xml
  • Linux: ~/.config/JetBrains/<product><version>/options/github-copilot.xml

For example, if you are using IntelliJ IDEA 2021.1 on macOS, the file is located at ~/Library/Application Support/JetBrains/IdeaIC2021.1/options/github-copilot.xml.

The github-copilot.xml file might not be generated until you make a change to your default language configuration in the IDE's settings. If you cannot locate the file, you should try modifying the default language settings in the IDE. For more information, see Configuring language settings in the IDE.

Alternatively, you can create the file manually and save it in the location for your operating system listed above. For more information, see Example language configurations.

  1. Open the github-copilot.xml file in a text editor.

  2. Between the <map> tags, add the line or lines for the languages you want to activate or deactivate GitHub Copilot for. For example, to deactivate GitHub Copilot for all languages:

    XML
    <entry key="*" value="false" />
    
  3. Save the changes to the github-copilot.xml file.

  4. Restart your JetBrains IDE for the changes to take effect.

Example language configurations

The default configuration of the github-copilot.xml file, which enables GitHub Copilot for all languages is as follows:

XML
<application>
  <component name="github-copilot">
    <languageAllowList>
      <map>
        <entry key="*" value="true" />
      </map>
    </languageAllowList>
  </component>
</application>

To deactivate GitHub Copilot for all languages, the wildcard (*) value is changed to false:

XML
<application>
  <component name="github-copilot">
    <languageAllowList>
      <map>
        <entry key="*" value="false" />
      </map>
    </languageAllowList>
  </component>
</application>

To specify languages individually, add an entry for each language you want to activate or deactivate GitHub Copilot for. Specific language settings will override the wildcard. For example, to activate GitHub Copilot for Python and YAML, and deactivate GitHub Copilot for all other languages, add the following entries:

XML
<application>
  <component name="github-copilot">
    <languageAllowList>
      <map>
        <entry key="*" value="false" />
        <entry key="Python" value="true" />
        <entry key="YAML" value="true" />
      </map>
    </languageAllowList>
  </component>
</application>

You can also add a configuration to make the languageAllowList readonly in the IDE's settings. This will prevent you from changing the language settings in the IDE. For example:

XML
<application>
  <component name="github-copilot">
    <option name="languageAllowListReadOnly" value="true" />
    <languageAllowList>
      <map>
        <entry key="*" value="true" />
      </map>
    </languageAllowList>
  </component>
</application>

Configuring GitHub Copilot settings on GitHub.com

If you are using a GitHub Copilot Pro subscription, you can choose to allow or block code completion suggestions that match publicly available code. You can also allow or block the collection and retention of the prompts you enter and Copilot's suggestions. You configure this in your personal settings on GitHub.com. See Managing Copilot policies as an individual subscriber.

Further reading

Authenticating to an account on GHE.com

If you're using a Copilot subscription for a managed user account account on GHE.com, you'll need to update some settings before you sign in. See Using GitHub Copilot with an account on GHE.com.