10

I can get some suggestions by copilot in .md files, But when I keydowned Tab, it only added a space, not autocompletes the suggestion, What should I do can autocomplete the suggestion?

enter image description here

linka
  • 149
  • 1
  • 9

2 Answers2

23

To enable suggestions for GitHub Copilot with a Tab key, follow the steps below.

  1. Open the file keybindings.json in Visual Studio Code. This can be done by pressing Ctrl + Shift + P, and typing Open Keyboard Shortcuts (JSON).

  2. In keybindings.json, add the following.

    [
      {
        "key": "tab",
        "command": "editor.action.inlineSuggest.commit",
        "when": "textInputFocus && inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editorTabMovesFocus"     
      }
    ]
    

This should now enable you to accept suggestions in Markdown using the Tab key!

Arnav Thorat
  • 3,078
  • 3
  • 8
  • 33
  • 1
    Thanks for your answer, I tried a while, `editor.action.inlineSuggestion.commit` is a invalid command, but `editor.action.inlineSuggest.commit` is a valid command, base on your code, I wrote a seems correct keybinds Comments cnat't add block code, so I edited my question for adding keybinds Thanks again – linka Apr 11 '22 at 02:02
  • ```json { "key": "tab", "command": "editor.action.inlineSuggest.commit", "when": "textInputFocus && inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editorTabMovesFocus" }, ``` – defend orca Apr 10 '23 at 07:48
  • You are a god. I looked for 1 full day on how to resolve this junk and only you gave me a working solution. Thank you so much, truly. – Musilix Aug 30 '23 at 00:12
0

Solution-

For me Right arrow key works to accept suggestion. Try Right arrow key.

Preeti
  • 421
  • 5
  • 14