0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VSCodeのCopilotChatの送信をShift+Enterに変更する

Posted at

はじめに

自分は、VS CodeのGithub CopilotのChat欄を入力途中で誤送信してしまいます。
対象方法がないか試行錯誤した結果です。Enterを改行 Shift+Enterを送信に割り当てます。
Windowsでしか試していません。
GithubCopilotには使用方法の否定されます。
他に良い方法があれば教えてください。

方法

  1. コマンドパレットを開きます。Ctrl+Shift+P
  2. Preferences: Open Keyboard Shortcuts (JSON) で設定ファイルを開きます。
  3. 次の内容を入力してください。
[
     {
        "key": "enter",
        "command": "-workbench.action.chat.submit",
        "when": "inChatInput" 
    }, 
    {
        "key": "shift+enter",
        "command": "workbench.action.chat.submit",
        "when": "inChatInput"
    }
]

保存すると反映されてChat欄はEnterが改行、Shift+Enterが送信になっているはずです。(なっていなければVS Codeを再起動してください

参考

Github Copilotで否定されている内容は以下です。

要点だけ短く。

主原因1 — inChatInput が無効/未定義
"inChatInput" は VS Code の標準コンテキストではない可能性が高い。未定義の when を指定しても、拡張側が同じコンテキストを公開していなければその条件にマッチしない(つまり期待どおり限定されない)。

主原因2 — Copilot Chat は webview 内でキーを処理している
Copilot Chat(拡張)の入力欄は webview 側で Enter をハンドルしていることが多く、keybindings.json のコマンド割当は VS Code 側のコマンドにしか届かない。webview 内処理だと keybinding で止められない。

次にやること(短く):

Ctrl+Shift+P → 「Developer: Toggle Keyboard Shortcuts Troubleshooting」を実行して、Copilot の入力欄にフォーカスして Enter を押し、OUTPUT に何が出るか確認。何も出なければ webview 内処理確定。
出力にコマンド名・when が出れば、その when を keybindings.json に使って限定的に無効化。
出力が無ければ拡張設定を確認するか、AutoHotkey 等でウィンドウ単位のリマップを検討。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?