On the Mac, use the Command + . keys to pop up a menu of Quick Fix suggestions.
On Windows, use the Ctrl + . keys.
Then just select the Quick Fix suggestion that you want to apply to your code.
Example on the Mac:
On the Mac, use the Command + . keys to pop up a menu of Quick Fix suggestions.
On Windows, use the Ctrl + . keys.
Then just select the Quick Fix suggestion that you want to apply to your code.
Example on the Mac:
The one more corresponding to the question is probably Ctrl+K Ctrl+I.

I've managed to set up key bindings for a few CodeActionKinds a la:
{
"key": "ctrl+r ctrl+f",
"command": "editor.action.codeAction",
"args": {
"kind": "refactor.extract.field"
},
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+r ctrl+m",
"command": "editor.action.codeAction",
"args": {
"kind": "refactor.extract.function"
},
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+r ctrl+v",
"command": "editor.action.codeAction",
"args": {
"kind": "refactor.extract.variable"
},
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+r ctrl+i",
"command": "editor.action.codeAction",
"args": {
"kind": "refactor.inline"
},
"when": "editorTextFocus && !editorReadonly"
}However, I can't figure out how to do it for a QuickFix. I want to be able to trigger the `Remove method` QuickFix directly without having to open the QuickFix menu. Is there a way to do this? Can the quickFix command even take args like the codeAction command does?
Quickfix and CodeActionKind args sub-values (i.e. the `variable`, `function`, `field` bits) don't seem to be listed in any official documentation; the ones I have were found in StackOverflow posts or through trial and error.
macos - What is the hot key to show or apply quick fixes in VS Code? - Stack Overflow
keyboard shortcuts - How to move up and down in quick fix suggestions in visual studio code without using arrow keys? - Stack Overflow
quick fix shortcut ( cmd + . ) keys not work on macOS - m1 device
How to enable the quick fix in VS code - Stack Overflow
Videos
In vscode v1.71 there are three new commands you can use for navigating in the QuickFix menu to go to previous or next source code actions.
selectNextCodeAction // to focus the nextcode action
selectPrevCodeAction // to focus the previous code action
acceptSelectedCodeAction // to run the focused/selected code action
You can see the default keybindings below that have been removed. Note the - before the command name in two of the keybindings, that removes those keybindings.
You can make these keybindings (in your keybindings.json):
{
"key": "alt+u", // whatever you want here
"command": "selectPrevCodeAction", // for v1.71
"when": "codeActionMenuVisible"
},
{
"key": "up", // default removed
"command": "-selectPrevCodeAction", // for v1.71
"when": "codeActionMenuVisible"
},
{
"key": "alt+d", // whatever you want here
"command": "selectNextCodeAction", // for v1.71
"when": "codeActionMenuVisible"
},
{
"key": "down", // default removed
"command": "-selectNextCodeAction", // for v1.71
"when": "codeActionMenuVisible"
}
The recent response by loann reminded me of Visual Studio Code Keybinding for navigation in Quick Fix contextual menu in which I mentioned the curious history of this context key, which went from CodeActionMenuVisible to actionWidgetVisible to codeActionMenuVisible.
There is also an extension presented as a fix: Keyboard QuickFix, but it shouldn't be necessary anymore.
Go to "Keyboard shortcuts" and search for selectNextSuggestion.
You can rebind this command to any shortcut you like.
Same goes for selectPrevSuggestion.
I use cmd + j for up and cmd cmd + k for down ^^
