最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

visual studio code - Disable tab key from triggering Copilot's "commit inline suggestion" - Stack Over

programmeradmin3浏览0评论

I'm using VS Code to edit a file with lots of tabs.

Github Copilot by default binds tab key to the "commit inline suggestion" action.

I want to disable that default keybinding so I don't need to first dismiss the suggestion through escape before being able to type a literal tab.

The following in my keybindings.json used to work, but it no longer does, what's the new syntax?

    {
        "key": "tab",
        "command": "-editor.action.inlineSuggestmit",
        "when": "inlineSuggestionVisible"
    },

I'm using VS Code to edit a file with lots of tabs.

Github Copilot by default binds tab key to the "commit inline suggestion" action.

I want to disable that default keybinding so I don't need to first dismiss the suggestion through escape before being able to type a literal tab.

The following in my keybindings.json used to work, but it no longer does, what's the new syntax?

    {
        "key": "tab",
        "command": "-editor.action.inlineSuggestmit",
        "when": "inlineSuggestionVisible"
    },
Share Improve this question edited Mar 26 at 10:33 Cornelius Roemer asked Mar 21 at 13:25 Cornelius RoemerCornelius Roemer 8,5843 gold badges56 silver badges104 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

To debug, I looked at the "Keyboard Shortcuts" menu and checked what actions were present there for "Tab". It turns out that VS Code seems to have added a few default keybindings that I needed to disable to get my tab key to again be left alone:

Once one identifies a "System" keybinding, one can copy it (CMD+C) and then paste it into the "keybindings.json" file and add a - before the "command" string:

Adding these lines worked for me:

    {
      "key": "tab",
      "command": "-editor.action.inlineSuggestmit",
      "when": "inlineEditIsVisible && tabShouldAcceptInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible || inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible || inlineEditIsVisible && inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible || inlineEditIsVisible && inlineSuggestionVisible && tabShouldAcceptInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible"
    },
    {
      "key": "tab",
      "command": "-editor.action.inlineSuggestmit",
      "when": "inInlineEditsPreviewEditor"
    },

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论