Jeff Ward
Jeff Ward

Reputation: 18986

Can GitHub Copilot stop auto-suggesting, instead be triggered by a keystroke?

I find Github Copilot very helpful in some specific situations, but fairly unhelpful in its verbosity in most situations.

By default, it's always on, always suggesting (and frequently getting in my way.) I want it to be less aggressive, disabling the auto-suggestion, but still have it readily available at a keystroke.

What I've tried already:

In a helpful post, I see that Alt\ is the default key for triggering Copilot suggestions. Great, that's half of the solution.

In settings.json, setting the following seems to disable copilot entirely! It is no longer available using the keyboard shortcut.

    "github.copilot.inlineSuggest.enable": false

I wonder if that's a bug, because there's already multiple ways to disable copilot entirely.

Upvotes: 93

Views: 45199

Answers (8)

Neil
Neil

Reputation: 8584

another option (potentially simpler) is to open GitHub Copilot chat window and do:

@vscode Disable Completions

another option (more convenient UI) is by:

@vscode open vscode-insiders://settings/github.copilot.editor.enableAutoCompletions

enter image description here

enter image description here

p.s. was doing that for supermaven

Copilot is active. Please disable its inline completions to avoid conflicts with Supermaven.

Upvotes: 0

bugrasan
bugrasan

Reputation: 426

what worked for me was to disable the annoying stars on the left handside that are jumping up and down

"github.copilot.editor.enableCodeActions": false

Upvotes: 0

Brandon Brown
Brandon Brown

Reputation: 341

As of May 2024, to simply toggle the Copilot suggestions on and off, go to "Settings" > "Keyboard Shortcuts" ("⌘K + ⌘S). Search for "toggleCopilot" (github.copilot.toggleCopilot). Hover over that row. Click the "+" that displays on the far left. Then type in your preferred keyboard shortcut.

I use ⌘A + ⌘I as my shortcut.

Upvotes: 2

Vivek V Kini
Vivek V Kini

Reputation: 1

The below image is from Pycharm. It seems to do the trick for me. enter image description here

Upvotes: -2

Bubulux
Bubulux

Reputation: 165

UPDATE 2024

I've made this extension in VS Code, which makes this whole process much easier: https://marketplace.visualstudio.com/items?itemName=Bubulus.copilot-inline-toggle

Old Post

For anyone who just needs to temporarily disable the inline suggestion that overrides intellisense --> a convenient solution that worked for me, was toggling this setting:

"github.copilot.editor.enableAutoCompletions"

When true, Copilot will work as expected, and give you his inline greyed-out suggestions that can be accepted with tab.

When false, Copilot will still work, but the inline suggestions and autocomplete on tab will be disabled. Thus if you are seeking to temporarily only go for intellisense autocompletion, then this does the trick well.

For toggling, I choose the Settings Cycler VS Code extension.

To configure this, you need to add the toggle behavior with a corresponding unique id to your settings.json file. For example, I have this config:

 "settings.cycle": [
    {
      "id": "copilotInline",
      "overrideWorkspaceSettings": false,
      "values": [
        {
          "github.copilot.editor.enableAutoCompletions": true
        },
        {
          "github.copilot.editor.enableAutoCompletions": false
        }
      ]
    }
  ],

Then to toggle between those two provided values, just add a preferred keybinding to the command by citing the chosen id like this in the keybindings.json file:

  {
    "key": "ctrl+oem_3",
    "command": "settings.cycle.copilotInline"
  }

In my case on ctrl + ö I toggle between those states now!

Upvotes: 7

Florentin
Florentin

Reputation: 221

The top rated solution does not seem to work anymore. However the above solution by @BiasInput also works in VSCode.

Open user settings.json and set "github.copilot.editor.enableAutoCompletions": false enter image description here

Then trigger copilot suggestions with the keyboard shorcut you assigned to the command editor.action.inlineSuggest.trigger. enter image description here

Upvotes: 18

Jeff Ward
Jeff Ward

Reputation: 18986

In settings.json (under File, Preferences, Settings), I found that setting the more general option:

    "editor.inlineSuggest.enabled": false,

Seems to work as I'd hoped. Copilot suggestions are now only provided on-demand, when I press Alt\, and accepted when I press Tab

I worry that this might disable other types of suggestions I rely on... but language auto-completion still seems to work. I'll update this answer if I find anything I miss.

BTW, changing the keyboard shortcuts:

Under File, Preferences, Keyboard Shortcuts, if you search for inlinesuggest, you see the keystrokes for both triggering inline suggestion and for committing (aka, accepting) inline suggestions. Double-click the row to change the key (but watch out for conflicts.)

VSCode settings for inline suggestions

Upvotes: 80

B14s
B14s

Reputation: 861

For Jetbrains IDE (e.g. Webstorm).

You can uncheck automatically show completions in the IDE's settings (Settings > Languages & Frameworks > GitHub Copilot). enter image description here

and then still TRIGGER completion with a keystroke Alt+\ or any keymap you are comfortable with (Settings > Keymap > "Copilot" in the search bar): enter image description here

Upvotes: 22

Related Questions