如何在 Visual Studio 代码中的快速修复建议中上下移动而不使用箭头键?

May*_*kur 6 keyboard-shortcuts visual-studio-code

每当代码中存在某些缺失或需要更正时,Visual Studio Code 都会显示一个黄色灯泡以显示一些快速修复建议。

在此输入图像描述

有没有什么方法或快捷方式可以让我们在不使用箭头键的情况下上下导航建议选项(如上面的屏幕截图所示)?

Mar*_*ark 7

在 vscode v1.71 中,您可以使用三个新命令在 QuickFix 菜单中导航以转到上一个或下一个源代码操作。

selectNextCodeAction  // to focus the nextcode action
selectPrevCodeAction  // to focus the previous code action
acceptSelectedCodeAction  // to run the focused/selected code action
Run Code Online (Sandbox Code Playgroud)

您可以看到下面的默认键绑定已被删除。请注意-两个键绑定中命令名称之前的命令,它会删除这些键绑定。

您可以进行这些键绑定(在您的 中keybindings.json):

selectNextCodeAction  // to focus the nextcode action
selectPrevCodeAction  // to focus the previous code action
acceptSelectedCodeAction  // to run the focused/selected code action
Run Code Online (Sandbox Code Playgroud)

lonn 最近的回复让我想起了用于在“快速修复”上下文菜单中导航的 Visual Studio Code 键绑定,其中我提到了这个上下文键的奇怪历史,它从CodeActionMenuVisibleactionWidgetVisiblecodeActionMenuVisible


还有一个扩展作为修复: Keyboard QuickFix,但它不再是必要的了。