5

I'm using the VS Code GitHub Copilot extension. Sometimes I edit files that contain secrets, and I don't want to accidentally send those to Microsoft/GitHub.

Is it possible to make Copilot opt-in, so that it is only enabled if I have explicitly activated it for a project?

Jo Liss
  • 30,333
  • 19
  • 121
  • 170

2 Answers2

2

You can disable the extension and then enable for only the projects and workspaces you want it to be enabled.

Chirag
  • 66
  • 3
  • 1
    I don't see how this answers the question. If you mean manually disabling and enabling Copilot between switching projects then it's not an answer. If you mean a project setting enabling Copilot only for that project and disabling it for all other projects automatically, then the explanation is missing on what this setting is or how it can be found. – iron9 Jul 14 '23 at 13:15
2

You can currently enable/disable Copilot only globally for the user or on a per-language basis through the UI.

However, you can disable Copilot globally and overwrite the setting directly in the settings.json file for a specific workspace. For that, edit or create the file .vscode/settings.json with this content:

{
  "github.copilot.enable": {
    "*": true,
    "plaintext": false,
    "markdown": false,
    "scminput": false
  },
}

As noted in the comments, the UI can guide you a little:

  • Go to "Settings"
  • Search for "copilot"
  • Click the "User" tab to globally configure
  • Click the "Workspace" tab to configure for a single workspace

You still need to edit settings.json but at least you get a handy button that opens it for editing for you, with default values.

iron9
  • 397
  • 2
  • 12
  • You can sort-of do this through the UI as well - go to "Settings", search for "copilot", then you can click the "User" tab to globally configure, and "Workspace" tab to configure for a single workspace. You still need to edit `settings.json` but at least you get a handy button that opens it for editing for you, with default values. – Korny Jul 18 '23 at 15:14