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.com. This article describes how to configure GitHub Copilot in the IntelliJ IDE, but the user interfaces of other JetBrains IDEs may differ.
在 GitHub.com 上配置 GitHub Copilot 设置
在拥有处于活动状态的 GitHub Copilot 试用版或订阅后,可以在 GitHub 上的 GitHub Copilot 设置中为你的个人帐户调整 GitHub Copilot 设置。 无论在何处使用 GitHub Copilot,这些设置都适用。 可以配置 GitHub Copilot 提供的建议,以及 GitHub 使用你的遥测数据的方式。
启用或禁用重复检测
注意:如果你是 GitHub Enterprise Cloud 的组织成员,已通过你的组织分配了 GitHub Copilot 席位,你将无法在个人帐户设置中配置重复检测。 重复检测设置将从组织或企业继承。
GitHub Copilot 包含筛选器,该筛选器用于检测与 GitHub 上的公共代码匹配的代码建议。 可以选择启用或禁用筛选器。 启用筛选器后,GitHub Copilot 会根据 GitHub 上的公共代码检查代码建议及其周围约 150 个字符的代码。 如果存在匹配或接近匹配,不会向你显示建议。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
在“与公共代码匹配的建议”下,选择下拉菜单,然后单击“允许”以允许与公共代码匹配的建议,或单击“阻止”以阻止与公共代码匹配的建议 。
-
要确认新设置,请单击“保存”。
启用或禁用遥测
注意:Copilot for Business 不保留任何遥测数据或代码片段数据。
通过调整你的用户设置,你可以选择代码片段是否由 GitHub 收集和保留,并进一步通过 Microsoft 和 OpenAI 进行处理和共享。 有关 GitHub Copilot 可能会根据你的遥测设置收集的数据的详细信息,请参阅“GitHub 附加产品和功能条款”和 GitHub Copilot 隐私 FAQ。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
若要允许或阻止 GitHub 使用你的遥测数据,请选择或取消选择“允许 GitHub 使用我的代码片段进行产品改进”。
-
要确认新设置,请单击“保存”。
延伸阅读
Prerequisites
To configure GitHub Copilot in a JetBrains IDE, you must install the GitHub Copilot plugin. For more information, see "Getting started with GitHub Copilot."
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
Action | Shortcut |
---|---|
Accept an inline suggestion | Tab |
Dismiss an inline suggestion | Esc |
Show next inline suggestion | Option (⌥) or Alt+] |
Show previous inline suggestion | Option (⌥) or Alt+[ |
Trigger inline suggestion | Option (⌥)+\ |
Open GitHub Copilot (additional suggestions in separate pane) | Option (⌥) or Alt+Return |
Keyboard shortcuts for Windows
Action | Shortcut |
---|---|
Accept an inline suggestion | Tab |
Dismiss an inline suggestion | Esc |
Show next inline suggestion | Alt+] |
Show previous inline suggestion | Alt+[ |
Trigger inline suggestion | Alt+\ |
Open GitHub Copilot (additional suggestions in separate pane) | Alt+Enter |
Keyboard shortcuts for Linux
Action | Shortcut |
---|---|
Accept an inline suggestion | Tab |
Dismiss an inline suggestion | Esc |
Show next inline suggestion | Alt+] |
Show previous inline suggestion | Alt+[ |
Trigger inline suggestion | Alt+\ |
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.
-
To enable or disable GitHub Copilot, click the status icon in the bottom panel on the right of the JetBrains window.
-
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.
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.
- In your JetBrains IDE, click the File menu, then click Settings.
- Under Languages & Frameworks, click GitHub Copilot.
- 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.
- Under "Disabled languages," use the checkboxes to select or deselect the languages you want to disable GitHub Copilot for.
Configuring proxy settings for GitHub Copilot
You can configure GitHub Copilot to connect through an HTTP proxy server in a JetBrains IDE. GitHub Copilot supports basic HTTP proxy setups, with or without basic authentication.
- In your JetBrains IDE, click the File menu, then click Settings.
- Under Appearance & Behavior, click System Settings and then click HTTP Proxy.
- Select Manual proxy configuration, and then select HTTP.
- In the "Host name" field, enter the hostname of your proxy server, and in the "Port number" field, enter the port number of your proxy server.
- Optionally, in the left sidebar, click Tools and then click Server Certificates. Then select or deselect Accept non-trusted certificates automatically, depending on whether you want to accept non-trusted certificates automatically.
在 GitHub.com 上配置 GitHub Copilot 设置
在拥有处于活动状态的 GitHub Copilot 试用版或订阅后,可以在 GitHub 上的 GitHub Copilot 设置中为你的个人帐户调整 GitHub Copilot 设置。 无论在何处使用 GitHub Copilot,这些设置都适用。 可以配置 GitHub Copilot 提供的建议,以及 GitHub 使用你的遥测数据的方式。
启用或禁用重复检测
注意:如果你是 GitHub Enterprise Cloud 的组织成员,已通过你的组织分配了 GitHub Copilot 席位,你将无法在个人帐户设置中配置重复检测。 重复检测设置将从组织或企业继承。
GitHub Copilot 包含筛选器,该筛选器用于检测与 GitHub 上的公共代码匹配的代码建议。 可以选择启用或禁用筛选器。 启用筛选器后,GitHub Copilot 会根据 GitHub 上的公共代码检查代码建议及其周围约 150 个字符的代码。 如果存在匹配或接近匹配,不会向你显示建议。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
在“与公共代码匹配的建议”下,选择下拉菜单,然后单击“允许”以允许与公共代码匹配的建议,或单击“阻止”以阻止与公共代码匹配的建议 。
-
要确认新设置,请单击“保存”。
启用或禁用遥测
注意:Copilot for Business 不保留任何遥测数据或代码片段数据。
通过调整你的用户设置,你可以选择代码片段是否由 GitHub 收集和保留,并进一步通过 Microsoft 和 OpenAI 进行处理和共享。 有关 GitHub Copilot 可能会根据你的遥测设置收集的数据的详细信息,请参阅“GitHub 附加产品和功能条款”和 GitHub Copilot 隐私 FAQ。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
若要允许或阻止 GitHub 使用你的遥测数据,请选择或取消选择“允许 GitHub 使用我的代码片段进行产品改进”。
-
要确认新设置,请单击“保存”。
延伸阅读
About GitHub Copilot in Visual Studio
If you use Visual Studio, GitHub Copilot can autocomplete code as you type. After installation, you can enable or disable GitHub Copilot, and you can configure advanced settings within Visual Studio or on GitHub.com.
Prerequisites
To configure GitHub Copilot in Visual Studio, you must install the GitHub Copilot plugin. For more information, see "Getting started with GitHub Copilot."
Keyboard shortcuts for GitHub Copilot
You can use the default keyboard shortcuts in Visual Studio when using GitHub Copilot. Alternatively, you can rebind the shortcuts in the Tools settings for Visual Studio using your preferred keyboard shortcuts for each specific command. You can search for each keyboard shortcut by its command name in the Keyboard Shortcuts editor.
Action | Shortcut | Command name |
---|---|---|
Show next inline suggestion | Alt+. | Tools.Nextsuggestion |
Show previous inline suggestion | Alt+, | Tools.Previoussuggestion |
Trigger inline suggestion | Ctrl+Alt+\ | Edit.Copilot.TriggerInlineSuggestion |
Rebinding keyboard shortcuts
If you don't want to use the default keyboard shortcuts in Visual Studio when using GitHub Copilot, you can rebind the shortcuts in the Keyboard editor using your preferred keyboard shortcuts for each specific command.
-
In the Visual Studio toolbar, under Tools, click Options.
-
In the "Options" dialog, under Environment, click Keyboard.
-
Under "Show commands containing:", search for the command you want to rebind.
-
Under "Press shortcut keys," type the shortcut you want to assign to the command, then click Assign.
启用或禁用 GitHub Copilot
Visual Studio 窗口底部面板中的 GitHub Copilot 状态图标指示 GitHub Copilot 启用还是禁用。 启用后,图标的背景色将与状态栏颜色相匹配。 禁用后,将有一条对角线穿过它。
-
若要启用或禁用 GitHub Copilot,请单击 Visual Studio 窗口底部面板中的 GitHub Copilot 图标。
-
如果要禁用 GitHub Copilot,系统会询问是全局禁用建议,还是要禁用当前正在编辑的文件的语言。
- 若要全局禁用 GitHub Copilot 的建议,请单击“全局启用”。
- 若要禁用指定语言的 GitHub Copilot 的建议,请单击“对 LANGUAGE 启用”。
Configuring ReSharper for GitHub Copilot
If you use ReSharper, GitHub Copilot may work best when you configure ReSharper to use GitHub Copilot's native IntelliSense. For more information about ReSharper, see the ReSharper documentation
- In the Visual Studio toolbar, under Tools, click Options.
- In the "Options" dialog, under Environment, click IntelliSense and then click General.
- Under "General" select Visual Studio and then click Save.
在 GitHub.com 上配置 GitHub Copilot 设置
在拥有处于活动状态的 GitHub Copilot 试用版或订阅后,可以在 GitHub 上的 GitHub Copilot 设置中为你的个人帐户调整 GitHub Copilot 设置。 无论在何处使用 GitHub Copilot,这些设置都适用。 可以配置 GitHub Copilot 提供的建议,以及 GitHub 使用你的遥测数据的方式。
启用或禁用重复检测
注意:如果你是 GitHub Enterprise Cloud 的组织成员,已通过你的组织分配了 GitHub Copilot 席位,你将无法在个人帐户设置中配置重复检测。 重复检测设置将从组织或企业继承。
GitHub Copilot 包含筛选器,该筛选器用于检测与 GitHub 上的公共代码匹配的代码建议。 可以选择启用或禁用筛选器。 启用筛选器后,GitHub Copilot 会根据 GitHub 上的公共代码检查代码建议及其周围约 150 个字符的代码。 如果存在匹配或接近匹配,不会向你显示建议。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
在“与公共代码匹配的建议”下,选择下拉菜单,然后单击“允许”以允许与公共代码匹配的建议,或单击“阻止”以阻止与公共代码匹配的建议 。
-
要确认新设置,请单击“保存”。
启用或禁用遥测
注意:Copilot for Business 不保留任何遥测数据或代码片段数据。
通过调整你的用户设置,你可以选择代码片段是否由 GitHub 收集和保留,并进一步通过 Microsoft 和 OpenAI 进行处理和共享。 有关 GitHub Copilot 可能会根据你的遥测设置收集的数据的详细信息,请参阅“GitHub 附加产品和功能条款”和 GitHub Copilot 隐私 FAQ。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
若要允许或阻止 GitHub 使用你的遥测数据,请选择或取消选择“允许 GitHub 使用我的代码片段进行产品改进”。
-
要确认新设置,请单击“保存”。
延伸阅读
About GitHub Copilot in Visual Studio Code
If you use Visual Studio Code, GitHub Copilot can autocomplete code as you type. After installation, you can enable or disable GitHub Copilot, and you can configure advanced settings within Visual Studio Code or on GitHub.com.
Prerequisites
To configure GitHub Copilot in Visual Studio Code, you must install the GitHub Copilot plugin. For more information, see "Getting started with GitHub Copilot."
Keyboard shortcuts for GitHub Copilot
You can use the default keyboard shortcuts in Visual Studio Code when using GitHub Copilot. Alternatively, you can rebind the shortcuts in the Keyboard Shortcuts editor using your preferred keyboard shortcuts for each specific command. You can search for each keyboard shortcut by command name in the Keyboard Shortcuts editor.
Keyboard shortcuts for macOS
Action | Shortcut | Command name |
---|---|---|
Accept an inline suggestion | Tab | editor.action.inlineSuggest.commit |
Dismiss an inline suggestion | Esc | editor.action.inlineSuggest.hide |
Show next inline suggestion | Option (⌥)+] | editor.action.inlineSuggest.showNext |
Show previous inline suggestion | Option (⌥)+[ | editor.action.inlineSuggest.showPrevious |
Trigger inline suggestion | Option (⌥)+\ | editor.action.inlineSuggest.trigger |
Open GitHub Copilot (additional suggestions in separate pane) | Ctrl+Return | github.copilot.generate |
Toggle GitHub Copilot on/off | No default shortcut | github.copilot.toggleCopilot |
Keyboard shortcuts for Windows
Action | Shortcut | Command name |
---|---|---|
Accept an inline suggestion | Tab | editor.action.inlineSuggest.commit |
Dismiss an inline suggestion | Esc | editor.action.inlineSuggest.hide |
Show next inline suggestion | Alt+] | editor.action.inlineSuggest.showNext |
Show previous inline suggestion | Alt+[ | editor.action.inlineSuggest.showPrevious |
Trigger inline suggestion | Alt+\ | editor.action.inlineSuggest.trigger |
Open GitHub Copilot (additional suggestions in separate pane) | Ctrl+Enter | github.copilot.generate |
Toggle GitHub Copilot on/off | No default shortcut | github.copilot.toggleCopilot |
Keyboard shortcuts for Linux
Action | Shortcut | Command name |
---|---|---|
Accept an inline suggestion | Tab | editor.action.inlineSuggest.commit |
Dismiss an inline suggestion | Esc | editor.action.inlineSuggest.hide |
Show next inline suggestion | Alt+] | editor.action.inlineSuggest.showNext |
Show previous inline suggestion | Alt+[ | editor.action.inlineSuggest.showPrevious |
Trigger inline suggestion | Alt+\ | editor.action.inlineSuggest.trigger |
Open GitHub Copilot (additional suggestions in separate pane) | Ctrl+Enter | github.copilot.generate |
Toggle GitHub Copilot on/off | No default shortcut | github.copilot.toggleCopilot |
Rebinding keyboard shortcuts
If you don't want to use the default keyboard shortcuts in Visual Studio Code when using GitHub Copilot, you can rebind the shortcuts in the Keyboard Shortcuts editor using your preferred keyboard shortcuts for each specific command.
Rebinding keyboard shortcuts for macOS
-
Click Code, click Preferences, then click Keyboard Shortcuts.
-
In the "Keyboard Shortcuts" editor, search for the command name of the keyboard shortcut you want to change.
-
Next to the command you want to change, click the pencil icon.
-
Type the keystrokes you want to use for the command, then press Enter/Return.
Rebinding keyboard shortcuts for Windows
-
Click the File menu, click Preferences, then click Keyboard Shortcuts.
-
In the "Keyboard Shortcuts" editor, search for the command name of the keyboard shortcut you want to change.
-
Next to the command you want to change, click the pencil icon.
-
Type the keystrokes you want to use for the command, then press Enter/Return.
Rebinding keyboard shortcuts for Linux
-
Click the File menu, click Preferences, then click Keyboard Shortcuts.
-
In the "Keyboard Shortcuts" editor, search for the command name of the keyboard shortcut you want to change.
-
Next to the command you want to change, click the pencil icon.
-
Type the keystrokes you want to use for the command, then press Enter/Return.
启用或禁用 GitHub Copilot
可以在 Visual Studio Code 中启用或禁用 GitHub Copilot。 Visual Studio Code 窗口底部面板中的 GitHub Copilot 状态图标指示 GitHub Copilot 是启用还是禁用。 启用后,图标的背景色将与状态栏颜色相匹配。 禁用后,图标的背景色将与状态栏颜色形成对比。
-
若要启用或禁用 GitHub Copilot,请单击 Visual Studio Code 窗口底部面板中的状态图标。
-
如果要禁用 GitHub Copilot,系统会询问是全局禁用建议,还是要禁用当前正在编辑的文件的语言。
- 若要全局禁用 GitHub Copilot 的建议,请单击“全局禁用”。
- 若要禁用指定语言的 GitHub Copilot 的建议,请单击“对 LANGUAGE 禁用”。
Enabling or disabling inline suggestions
You can choose to enable or disable inline suggestions for GitHub Copilot in Visual Studio Code.
- 在“文件”菜单中,导航到“首选项”,然后单击“设置” 。
- In the left-side panel of the settings tab, click Extensions and then select Copilot.
- Under "Inline Suggest:Enable," select or deselect the checkbox to enable or disable inline suggestions.
Enabling or disabling GitHub Copilot for specific languages
You can specify which languages you want to enable or disable GitHub Copilot for.
-
From the Visual Studio Code, click the Extensions tab, then navigate to the Copilot section. For more information, see "Enabling and disabling inline suggestions."
-
Under "Enable or disable Copilot for specified languages," click Edit in settings.json.
-
In the settings.json file, add or remove the languages you want to enable or disable GitHub Copilot for. For example, to enable Python in GitHub Copilot, add
"python": true
to the list, ensuring there is a trailing comma after all but the last list item.{ "editor.inlineSuggest.enabled": true, "github.copilot.enable": { "*": true, "yaml": false, "plaintext": false, "markdown": true, "javascript": true, "python": true } }
Configuring proxy settings for GitHub Copilot
You can configure GitHub Copilot to connect through an HTTP proxy server in Visual Studio Code. GitHub Copilot supports basic HTTP proxy setups, with or without basic authentication.
- 在“文件”菜单中,导航到“首选项”,然后单击“设置” 。
- In the left-side panel of the settings tab, click Application and then select Proxy.
- In the textbox under "Proxy", type the address of your proxy server, for example
http://localhost:3128
. Alternatively, GitHub Copilot will use thehttp_proxy
andhttps_proxy
variables from your environment. - Optionally, under "Proxy Authorization", click Edit in settings.json and add your required value to send as the
Proxy-Authorization
header for every network request. - Optionally, under "Proxy Strict SSL", select or deselect the checkbox to enable or disable strict SSL.
在 GitHub.com 上配置 GitHub Copilot 设置
在拥有处于活动状态的 GitHub Copilot 试用版或订阅后,可以在 GitHub 上的 GitHub Copilot 设置中为你的个人帐户调整 GitHub Copilot 设置。 无论在何处使用 GitHub Copilot,这些设置都适用。 可以配置 GitHub Copilot 提供的建议,以及 GitHub 使用你的遥测数据的方式。
启用或禁用重复检测
注意:如果你是 GitHub Enterprise Cloud 的组织成员,已通过你的组织分配了 GitHub Copilot 席位,你将无法在个人帐户设置中配置重复检测。 重复检测设置将从组织或企业继承。
GitHub Copilot 包含筛选器,该筛选器用于检测与 GitHub 上的公共代码匹配的代码建议。 可以选择启用或禁用筛选器。 启用筛选器后,GitHub Copilot 会根据 GitHub 上的公共代码检查代码建议及其周围约 150 个字符的代码。 如果存在匹配或接近匹配,不会向你显示建议。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
在“与公共代码匹配的建议”下,选择下拉菜单,然后单击“允许”以允许与公共代码匹配的建议,或单击“阻止”以阻止与公共代码匹配的建议 。
-
要确认新设置,请单击“保存”。
启用或禁用遥测
注意:Copilot for Business 不保留任何遥测数据或代码片段数据。
通过调整你的用户设置,你可以选择代码片段是否由 GitHub 收集和保留,并进一步通过 Microsoft 和 OpenAI 进行处理和共享。 有关 GitHub Copilot 可能会根据你的遥测设置收集的数据的详细信息,请参阅“GitHub 附加产品和功能条款”和 GitHub Copilot 隐私 FAQ。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
若要允许或阻止 GitHub 使用你的遥测数据,请选择或取消选择“允许 GitHub 使用我的代码片段进行产品改进”。
-
要确认新设置,请单击“保存”。
延伸阅读
Configuring GitHub Copilot in Neovim
For guidance on configuring GitHub Copilot in Neovim, invoke the GitHub Copilot documentation in Neovim by running the following command:
:help copilot
在 GitHub.com 上配置 GitHub Copilot 设置
在拥有处于活动状态的 GitHub Copilot 试用版或订阅后,可以在 GitHub 上的 GitHub Copilot 设置中为你的个人帐户调整 GitHub Copilot 设置。 无论在何处使用 GitHub Copilot,这些设置都适用。 可以配置 GitHub Copilot 提供的建议,以及 GitHub 使用你的遥测数据的方式。
启用或禁用重复检测
注意:如果你是 GitHub Enterprise Cloud 的组织成员,已通过你的组织分配了 GitHub Copilot 席位,你将无法在个人帐户设置中配置重复检测。 重复检测设置将从组织或企业继承。
GitHub Copilot 包含筛选器,该筛选器用于检测与 GitHub 上的公共代码匹配的代码建议。 可以选择启用或禁用筛选器。 启用筛选器后,GitHub Copilot 会根据 GitHub 上的公共代码检查代码建议及其周围约 150 个字符的代码。 如果存在匹配或接近匹配,不会向你显示建议。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
在“与公共代码匹配的建议”下,选择下拉菜单,然后单击“允许”以允许与公共代码匹配的建议,或单击“阻止”以阻止与公共代码匹配的建议 。
-
要确认新设置,请单击“保存”。
启用或禁用遥测
注意:Copilot for Business 不保留任何遥测数据或代码片段数据。
通过调整你的用户设置,你可以选择代码片段是否由 GitHub 收集和保留,并进一步通过 Microsoft 和 OpenAI 进行处理和共享。 有关 GitHub Copilot 可能会根据你的遥测设置收集的数据的详细信息,请参阅“GitHub 附加产品和功能条款”和 GitHub Copilot 隐私 FAQ。
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
1. 在左侧边栏中,单击“ GitHub Copilot”。 -
若要允许或阻止 GitHub 使用你的遥测数据,请选择或取消选择“允许 GitHub 使用我的代码片段进行产品改进”。
-
要确认新设置,请单击“保存”。