6

When using CoPilot with vscode, by default, it uses tab to accept CoPilot's suggestion.

But sometimes I want to genuinely make a tab at a point in the code where CoPilot has other ideas.

How can I make a tab in that position without triggering CoPilot?

stevec
  • 41,291
  • 27
  • 223
  • 311

3 Answers3

6

Today there isn't a solution to this problem, but a possible workaround is to change the copilot shortcut that accepts the suggestion.

On VS Code: File>preferences>Keyboard shortcuts

and search for 'editor.action.inlineSuggest.commit', the command that accepts the Copilot suggestion.

I used the shortcut Alt+a to avoid conflicts with other commands.

SvMax
  • 157
  • 2
  • 10
2

With an inspiration from @SvMax I decided to just make a shortcut for tab. So, I have two ways to print tab - tab or alt+tab

To do so:

  1. CTRL+p -> >shortcuts json
  2. add the following config

enter image description here

{
  "key": "alt+tab",
  "command": "editor.action.insertSnippet",
  "args": {
     "snippet": "\t"
   }
},

enter image description here

That's it. Now if you see Copilot is trying to mess up your tab use alt+tab but if not you can use both alt+tab or tab.

But yes, it's so confusing that we should messing up with shortcuts in such a simple case. Hope they will fix it soon because now... I mean... Why anyone could think this suggestion can be useful? :)

enter image description here

Dmitry Gashko
  • 170
  • 2
  • 6
1

It is obnoxious... I assume you know you can hit ESC to get rid of the current suggestion and then hi Tab? I realize this may be commonsense, but just in case, I wanted to point it out!

But, that does ruin your flow.

If you want to actually change the key, you can follow the other folks in here that guide you to do that!

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 10 '23 at 22:03