visual-studio-codekeyboard-shortcutsautosuggestgithub-copilot

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.


Solution

  • 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