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?

Copilot NES(NextEditSuggestions)のTab,ESCが効かない問題を解決する

Last updated at Posted at 2025-04-17

これは何?

Copilot NESを使っていて

TabキーやEscキーがうまく反応しない事象に遭遇したので解決策を共有します。

↓以下の状況でTabやEscを押しても反応しない。

image.png


解決方法

vscodevim.vimとキーバインドが競合していました。

Tab

Tabに関しては,以下のキーバインドを消しました。自分はvimのinsertモード以外でTabキーを使うことがないので。

{
  "key": "tab",
  "command": "extension.vim_tab",
  "when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
}

image.png
キーバインドの設定はコマンドパレットからキーマップの設定ファイルを開けます。

Open Default Keyboard Shortcuts(JSON)はreadonlyの別物なのでユーザの設定ファイルを変更する。
Ubuntuの場合,ユーザのキーバインドの設定ファイルは~/.config/Code/User/keybindings.jsonを直接開いて編集しても良い。

これで一旦Tabを押してサジェストを受け入れられるようになりました。

ESC

Escに関しては現状消すと不便すぎるので,NESのサジェストを無視してコードを書くことで対応しています。
(NESのサジェストを明示的にEscで拒否しなくても何かしらの文字を打てば消えるので)

もしくは,自分がCtrl [をEscの代わりに使う原理主義者になるか。

ありがたいことに自分の日本語の
tweetを見て,開発者の人がコメントをくれました。

下記のIssueの通りに設定したところESCも動くようになりました。

  {
    "key": "escape",
    "command": "-extension.vim_escape",
    "when": "editorTextFocus && vim.active && !inDebugRepl"
  },
  {
    "key": "escape",
    "command": "extension.vim_escape",
    "when": "editorTextFocus && vim.active && !inDebugRepl && !testing.isPeekVisible && !testing.isInPeek && (vim.mode == 'Insert' || !notebookEditorFocused) && !inlineEditIsVisible && !suggestWidgetVisible && !findWidgetVisible && !dirtyDiffVisible"
  },
  {
    "key": "escape",
    "command": "runCommands",
    "when": "vim.mode == 'Insert' && inlineEditIsVisible",
    "args": {
      "commands": [
        "editor.action.inlineSuggest.hide",
        "extension.vim_escape"
      ]
    }
  },
  {
    "key": "escape",
    "command": "runCommands",
    "when": "vim.mode == 'Insert' && suggestWidgetVisible",
    "args": {
      "commands": [
        "hideSuggestWidget",
        "extension.vim_escape"
      ]
    }
  },
  {
    "key": "escape",
    "command": "-hideSuggestWidget",
    "when": "suggestWidgetVisible && textInputFocus"
  },
  {
    "key": "escape",
    "command": "hideSuggestWidget",
    "when": "suggestWidgetVisible && textInputFocus && !vim.active"
  },
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?