Skip to main content

Configuración de GitHub Copilot en tu entorno

Puedes habilitar, configurar o deshabilitar GitHub Copilot en un IDE compatible.

En este artículo

About GitHub Copilot in Visual Studio Code

If you use Visual Studio Code, you can use GitHub Copilot to:

  • Generate code
  • Learn from the code Copilot generates
  • Help you configure your editor

You can learn more about scenarios and setup in the VS Code documentation.

After you install the GitHub Copilot extension, you can enable or disable it, and you can configure advanced settings within Visual Studio Code or on GitHub.

Prerequisites

To configure GitHub Copilot in Visual Studio Code, you must install the GitHub Copilot extension. For more information, see Getting code suggestions in your IDE with GitHub Copilot.

Keyboard shortcuts for GitHub Copilot

You can use the default keyboard shortcuts for GitHub Copilot in GitHub Copilot. Search keyboard shortcuts by command name in the Keyboard Shortcuts editor.

Alternatively, you can rebind the shortcut for each command in the Keyboard Shortcuts editor. For more information, see the VS Code documentation on editing shortcuts.

Keyboard shortcuts for macOS

ActionShortcutCommand name
Accept an inline suggestionTabeditor.action.inlineSuggest.commit
Dismiss an inline suggestionEsceditor.action.inlineSuggest.hide
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/offNo default shortcutgithub.copilot.toggleCopilot

Keyboard shortcuts for Windows

ActionShortcutCommand name
Accept an inline suggestionTabeditor.action.inlineSuggest.commit
Dismiss an inline suggestionEsceditor.action.inlineSuggest.hide
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/offNo default shortcutgithub.copilot.toggleCopilot

Keyboard shortcuts for Linux

ActionShortcutCommand name
Accept an inline suggestionTabeditor.action.inlineSuggest.commit
Dismiss an inline suggestionEsceditor.action.inlineSuggest.hide
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/offNo default shortcutgithub.copilot.toggleCopilot

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 next edit suggestions

You can enable next edit suggestions via the VS Code setting github.copilot.nextEditSuggestions.enabled. For more detailed instructions, see Enabling edit suggestions in the VS Code documentation.

If you have a Copilot Business subscription, then the organization from which you receive your subscription must enable the Editor preview features setting. See Managing policies for Copilot in your organization.

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 or 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
        }
    }
    

Revoking GitHub Copilot authorization

Visual Studio Code retains authorization to use GitHub Copilot through a particular GitHub account. If you want to prevent your GitHub account being used for GitHub Copilot on a device you no longer have access to, you can revoke authorization and then go through the authorization process again. The device you previously used will not have the new authorization.

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

  2. In the "Integrations" section of the sidebar, click Applications.

  3. Click the Authorized OAuth Apps tab.

    Screenshot of the "Applications" page. A tab, labeled "Authorized OAuth Apps," is highlighted with an orange outline.

  4. Click the ... next to GitHub for VS Code and click Revoke.

  5. Click the Authorized GitHub Apps tab.

  6. If the GitHub Copilot extension is listed, click Revoke.

After revoking authorization, Visual Studio Code will be able to continue using GitHub Copilot in a current session for a maximum of 30 minutes. After that time, you will need to reauthorize GitHub Copilot for use in Visual Studio Code again.

Re-authorizing GitHub Copilot

After you have revoked authorization, if you want to continue using GitHub Copilot, you will need to complete the reauthorization process.

  1. In the bottom left corner of Visual Studio Code, click the Accounts icon, hover over your username, and click Sign out.

    Screenshot of the menu in Visual Studio Code. The "Sign out" option is outlined in dark orange.

  2. In the "Visual Studio Code" pop-up, click Sign Out.

  3. In the bottom left corner of Visual Studio Code, click the Accounts icon, hover over your username, and click Sign in with GitHub to use GitHub Copilot.

    Screenshot of the accounts menu in Visual Studio Code. The "Sign in with GitHub to use GitHub Copilot (1)" option is outlined in dark orange.

  4. In your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click Continue.

  5. In the "Open Visual Studio Code?" pop-up, click Open Visual Studio Code.

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.