1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Tabで遠めの編集提案を受け入れたい【Github Copilot】

Last updated at Posted at 2025-10-24

やりたいこと

レコーディング 2025-10-24 150522.gif

画像のような提案がされたときに、Tabで補完してほしい。
逆にインデントの入力をしないでほしい

現状だと編集提案エリアにテキストカーソル、またはマウスカーソルを持っていく必要があるようで大変。
でも、キー割り当ては変えたくない。

応急処置

とりあえずこの変更で期待していた動作になりました。

  1. コマンドパレット(ctrl shift p)からPreferences: Open Keyboard Shortcuts (JSON)
    keybindings.jsonを開く
    image.png

  2. 以下を追加(whenを変更)

    {
        "key": "tab",
        "command": "editor.action.inlineSuggest.commit",
        "when": "inlineEditIsVisible && tabShouldAcceptInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible || inlineEditIsVisible && inlineSuggestionVisible && tabShouldAcceptInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible || inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editor.hasSelection && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible || inlineEditIsVisible && inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editor.hasSelection && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible"
    },

補足

when式を雑に変更してうまくいくやつを探しました。
デフォルトのwhen式をorでブロック分けするとこんな感じ↓でして

デフォルトのwhen式
inlineEditIsVisible && tabShouldAcceptInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible ||

inlineEditIsVisible && inlineSuggestionVisible && tabShouldAcceptInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible ||

inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editor.hasSelection && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible ||

inlineEditIsVisible && inlineSuggestionHasIndentationLessThanTabSize && inlineSuggestionVisible && !editor.hasSelection && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible

一番初めのブロックのtabShouldAcceptInlineEditを消すと、自分の想定通りの挙動になりました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?