2
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?

VS Codeで選択範囲のコードをCopilotに説明させるショートカットを設定する

2
Posted at

VS Codeのインラインチャット機能を使って、選択範囲のコードを説明してもらうことがよくあります。

以前はインラインチャットで /explain を使っていました。
しかし、いつの間にかインラインチャットでは /explain が利用できなくなっていました。

チャット画面に移動してから /explain を実行することもできます。
ただ、マウス操作が増えるため、できれば避けたいところです。

筆者はVimのキーバインドを使っているため、なるべくマウスを使わずに操作したいのです。

そこで、選択範囲のコードをCopilotに説明させるショートカットを設定しました。

キーボードショートカットの設定を開く

まず、Shift + Command + P を押してコマンドパレットを開きます。

次に、以下の項目を選択します。

基本設定: キーボード ショートカットを開く (JSON)

image.png

keybindings.jsonを編集する

keybindings.json が開いたら、以下の設定を追加します。

[
  {
    "key": "shift+cmd+i",
    "command": "github.copilot.chat.explain.palette"
  }
]

すでに他の設定がある場合は、既存の配列の中に追加してください。

設定内容

この設定では、Shift + Command + I を押すと、選択範囲のコードについてCopilot Chatに説明を依頼できます。

これで、チャット画面へ移動して手動で /explain を入力する必要がなくなります。

まとめ

VS Codeのキーボードショートカットを設定することで、選択範囲のコードを少ない操作でCopilotに説明させることができます。

マウス操作を減らしたい方や、Vimキーバインドで作業している方には便利な設定だと思います。

2
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
2
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?