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 in Visual Studio."
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.
Enabling or disabling GitHub Copilot
The GitHub Copilot status icon in the bottom panel of the Visual Studio window indicates whether GitHub Copilot is enabled or disabled. When enabled, the background color of the icon will match the color of the status bar. When disabled, it will have a diagonal line through it.
-
To enable or disable GitHub Copilot, click the GitHub Copilot icon in the bottom panel of the Visual Studio window.
-
If you are disabling GitHub Copilot, you will be asked whether you want to disable suggestions globally, or for the language of the file you are currently editing.
- To disable suggestions from GitHub Copilot globally, click Enable Globally.
- To disable suggestions from GitHub Copilot for the specified language, click Enable for 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.
Configuring GitHub Copilot settings on GitHub.com
Once you have an active GitHub Copilot subscription, you can adjust GitHub Copilot settings for your personal account on GitHub in the GitHub Copilot settings. The settings apply anywhere that you use GitHub Copilot. You can configure the suggestions that GitHub Copilot offers and how GitHub uses your telemetry data.
Enabling or disabling duplication detection
Note: If you are a member of an organization on GitHub Enterprise Cloud who has been assigned a GitHub Copilot seat through your organization, you will not be able to configure duplication detection in your personal account settings. Your duplication detection setting will be inherited from your organization or enterprise.
GitHub Copilot includes a filter which detects code suggestions matching public code on GitHub. You can choose to enable or disable the filter. When the filter is enabled, GitHub Copilot checks code suggestions with their surrounding code of about 150 characters against public code on GitHub. If there is a match or near match, the suggestion will not be shown to you.
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the left sidebar, click GitHub Copilot.
-
Under Suggestions matching public code, select the dropdown menu, then click Allow to allow suggestions matching public code, or Block to block suggestions matching public code.
-
To confirm your new settings, click Save.