Skip to main content

Configuring GitHub Copilot in Visual Studio Code

You can enable, configure, and disable GitHub Copilot in Visual Studio Code.

GitHub Copilot can be managed through personal accounts with GitHub Copilot for Individuals or through organization or enterprise accounts with GitHub Copilot for Business.

GitHub Copilot is free to use for verified students, teachers, and maintainers of popular open source projects. For more information, see "About billing for GitHub Copilot."

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 in Visual Studio Code."

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.

ActionShortcutCommand name
Accept an inline suggestionTabeditor.action.inlineSuggest.commit
Dismiss an inline suggestionEsceditor.action.inlineSuggest.hide
Accept the next suggested wordCommand (⌘)+editor.action.inlineSuggest.acceptNextWord
Show next inline suggestionOption (⌥)+]
editor.action.inlineSuggest.showNext
Show previous inline suggestionOption (⌥)+[
editor.action.inlineSuggest.showPrevious
Trigger inline suggestionOption (⌥)+\
editor.action.inlineSuggest.trigger
Open GitHub Copilot (additional suggestions in separate pane)Ctrl+Returngithub.copilot.generate
Toggle GitHub Copilot on/offNonegithub.copilot.toggleCopilot
ActionShortcutCommand name
Accept an inline suggestionTabeditor.action.inlineSuggest.commit
Dismiss an inline suggestionEsceditor.action.inlineSuggest.hide
Accept the next suggested wordCtrl+editor.action.inlineSuggest.acceptNextWord
Show next inline suggestionAlt+]editor.action.inlineSuggest.showNext
Show previous inline suggestionAlt+[editor.action.inlineSuggest.showPrevious
Trigger inline suggestionAlt+\editor.action.inlineSuggest.trigger
Open GitHub Copilot (additional suggestions in separate pane)Ctrl+Entergithub.copilot.generate
Toggle GitHub Copilot on/offNonegithub.copilot.toggleCopilot
ActionShortcutCommand name
Accept an inline suggestionTabeditor.action.inlineSuggest.commit
Dismiss an inline suggestionEsceditor.action.inlineSuggest.hide
Accept the next suggested wordCtrl+editor.action.inlineSuggest.acceptNextWord
Show next inline suggestionAlt+]editor.action.inlineSuggest.showNext
Show previous inline suggestionAlt+[editor.action.inlineSuggest.showPrevious
Trigger inline suggestionAlt+\editor.action.inlineSuggest.trigger
Open GitHub Copilot (additional suggestions in separate pane)Ctrl+Entergithub.copilot.generate
Toggle GitHub Copilot on/offNonegithub.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.

  1. Click Code, click Preferences, then click Keyboard Shortcuts.

    Screenshot of Visual Studio Code keyboard shortcuts

  2. In the "Keyboard Shortcuts" editor, search for the command name of the keyboard shortcut you want to change.

  3. Next to the command you want to change, click the pencil icon.

    Screenshot of Keyboard shortcut editor

  4. Type the keystrokes you want to use for the command, then press Enter/Return.

  1. Click the File menu, click Preferences, then click Keyboard Shortcuts.

    Screenshot of Visual Studio Code keyboard shortcuts

  2. In the "Keyboard Shortcuts" editor, search for the command name of the keyboard shortcut you want to change.

  3. Next to the command you want to change, click the pencil icon.

    Screenshot of Keyboard shortcut editor

  4. Type the keystrokes you want to use for the command, then press Enter/Return.

  1. Click the File menu, click Preferences, then click Keyboard Shortcuts.

    Screenshot of Visual Studio Code keyboard shortcuts

  2. In the "Keyboard Shortcuts" editor, search for the command name of the keyboard shortcut you want to change.

  3. Next to the command you want to change, click the pencil icon.

    Screenshot of Keyboard shortcut editor

  4. Type the keystrokes you want to use for the command, then press Enter/Return.

Enabling or disabling GitHub Copilot

You can enable or disable GitHub Copilot from within Visual Studio Code. The GitHub Copilot status icon in the bottom panel of the Visual Studio Code 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, the background color of the icon will contrast with the color of the status bar.

  1. To enable or disable GitHub Copilot, click the status icon in the bottom panel of the Visual Studio Code window.

    Screenshot of the bottom panel in Visual Studio Code. The GitHub Copilot icon is outlined in dark orange.

  2. 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 Disable Globally.
    • To disable suggestions from GitHub Copilot for the specified language, click Disable for LANGUAGE. Screenshot of option to disable GitHub Copilot globally or for the current language

Enabling or disabling inline suggestions

You can choose to enable or disable inline suggestions for GitHub Copilot in Visual Studio Code.

  1. In the File menu, navigate to Preferences and click Settings. Screenshot of Visual Studio Code settings
  2. In the left-side panel of the settings tab, click Extensions and then select Copilot.
  3. 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.

  1. From the Visual Studio Code, click the Extensions tab, then navigate to the Copilot section. For more information, see "Enabling and disabling inline suggestions."

  2. Under "Enable or disable Copilot for specified languages," click Edit in settings.json.

  3. 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.

  1. In the File menu, navigate to Preferences and click Settings. Screenshot of Visual Studio Code settings
  2. In the left-side panel of the settings tab, click Application and then select Proxy.
  3. In the textbox under "Proxy", type the address of your proxy server, for example http://localhost:3128. Alternatively, GitHub Copilot will use the http_proxy and https_proxy variables from your environment.
  4. 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.
  5. Optionally, under "Proxy Strict SSL", select or deselect the checkbox to enable or disable strict SSL.

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.

  1. In the upper-right corner of any page, click your profile photo, then click Settings.

    Screenshot of GitHub's account menu showing options for users to view and edit their profile, content, and settings. The menu item "Settings" is outlined in dark orange.

  2. In the left sidebar, click GitHub Copilot.

  3. 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.

  4. To confirm your new settings, click Save.

Further reading