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:

Answer from 2Aguy on Stack Overflow
🌐
Reddit
reddit.com › r/vscode › how do i set up a keyboard shortcut for a specific quickfix?
r/vscode on Reddit: How do I set up a keyboard shortcut for a specific QuickFix?
October 6, 2023 -

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.

Discussions

macos - What is the hot key to show or apply quick fixes in VS Code? - Stack Overflow
Simple question. There's a yellow lamp on the picture below. Which hot key I have to use in order to apply/see suggestions given by VS code ? What I expect to see is I'm using macOS. More on stackoverflow.com
🌐 stackoverflow.com
keyboard shortcuts - How to move up and down in quick fix suggestions in visual studio code without using arrow keys? - Stack Overflow
Whenever there is some missing ... some quick fixes suggestions. Is there any way or shortcut by which we can navigate up and down suggestion options shown as in screenshot above without using the arrow keys? ... Save this answer. ... Show activity on this post. In vscode v1.71 there ... More on stackoverflow.com
🌐 stackoverflow.com
quick fix shortcut ( cmd + . ) keys not work on macOS - m1 device
Does this issue occur when all extensions are disabled?: Yes VS Code Version: 1.69.0-insider (Universal) Commit: f361c5b Date: 2022-06-22T05:18:08.138Z Electron: 18.3.4 Chromium: 100.0.4896.160 Nod... More on github.com
🌐 github.com
8
June 23, 2022
How to enable the quick fix in VS code - Stack Overflow
I disable the quick fix light bulb by mistake and I cant find any way to enable it back. Thanks! tried to find it on settings and to enable all extansions. More on stackoverflow.com
🌐 stackoverflow.com
🌐
YouTube
youtube.com › watch
VS Code tips — Accept quick fixes and code actions by double pressing ctrl+. or cmd+. - YouTube
Press ctrl + period or cmd + period to see code actions and quick fixes in VS Code. You can then quickly accept the current code action by pressing ctrl + p...
Published   January 11, 2023
🌐
iO tech_hub
techhub.iodigital.com › articles › 6-vscode-tips
6 Quick Tips to Boost Your Productivity in VSCode
June 21, 2023 - Whenever VSCode encounters an issue, you can hover wherever the red squiggly line is and click quick-fix. The keyboard shortcut is even better: cmd+.. This menu will show you all the available quick-fixes for the current context.
🌐
Super User
superuser.com › questions › 1687939 › visual-studio-code-default-quickfix-keybinding-not-working-on-fedora-35
linux - Visual studio code default quickfix keybinding not working on Fedora 35? - Super User
While coding on Visual Studio Code, I can't use the Shortcut Ctrl+. to open the quick fix. When I press Ctrl+. it always display the letter e with the underline. Typing anything more does not work except press Ctrl+. again or press Esc. I have try to use that key combination in the browser, the terminal when typing to make sure it is not the VSCode problem.
Top answer
1 of 3
8

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.

2 of 3
0

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 ^^

Find elsewhere
🌐
Visual Studio Code
code.visualstudio.com › docs › configure › keybindings
Keyboard shortcuts for Visual Studio Code
November 3, 2021 - { "key": "ctrl+shift+e", "command": "runCommands", "args": { "commands": [ { // command invoked with 2 arguments: vscode.executeCommand("myCommand", "arg1", "arg2") "command": "myCommand", "args": ["arg1", "arg2"] } ] } } To pass an array as the first argument, wrap the array in another array: "args": [ [1, 2, 3] ]. To remove a keyboard shortcut, right-click on the entry in the Keyboard Shortcuts editor, and select Remove Keybinding.
🌐
GitHub
github.com › microsoft › vscode › issues › 152930
quick fix shortcut ( cmd + . ) keys not work on macOS - m1 device · Issue #152930 · microsoft/vscode
June 23, 2022 - temporary solved by change shortcut from ⌘ + . into ⌘ + , and change setting shortcut from ⌘ + , into ⌘ + . but now i still cannot use cmd + . in vscode only.
Author   microsoft
🌐
Apalit Dev
apalitdev.wordpress.com › 2017 › 05 › 08 › visual-studio-code-quick-fix-feature
Visual Studio Code’s “Quick Fix” feature | Apalit Dev
May 8, 2017 - This feature allows you to fix ... from there you can edit the shortcut. To show you how it works for example when I enter (ctrl + .) keys it…...
🌐
GitHub
github.com › microsoft › vscode › issues › 142583
Quick Fix: Keyboard shortcut CTRL+. shows a small 'e' · Issue #142583 · microsoft/vscode
February 9, 2022 - microsoft / vscode Public · Notifications · You must be signed in to change notification settings · Fork 39k · Star 183k · New issueCopy link · New issueCopy link · Closed · Closed · Quick Fix: Keyboard shortcut CTRL+. shows a small 'e'#142583 · Copy link · Assignees ·
Author   microsoft
🌐
Shortcutmasters
shortcutmasters.com › shortcuts › visual-studio-code › mac › rich-languages-editing › quick-fix
Quick Fix - vscode shortcut for macOS - Shortcut Masters
Turbocharge your development speed with macOS keyboard shortcuts for Visual Studio Code on Shortcut Masters - Quick Fix
🌐
GitHub
github.com › microsoft › vscode › issues › 55111
Missing keybinding for navigation in Quick Fix contextual menu · Issue #55111 · microsoft/vscode
July 26, 2018 - The problem: It is not possible to define custom shortcuts for Quick Fix contextual menu. Use latest stable build of VS code and open a TypeScript project. Open the Quick Fix by intentionally making a mistake in the code. Press CTRL + . ...
Author   microsoft
🌐
Code with Andrea
codewithandrea.com › articles › vscode-shortcuts-extensions-settings-flutter-development
VSCode Shortcuts, Extensions & Settings for Flutter Development
YouTube already has many excellent videos about VSCode shortcuts, and I'll link the best ones at the end. ... MacOS: CMD+. Windows: CTRL+. Use this anywhere in the editor to get a contextual list of code actions. You can use it to wrap, extract, remove widgets, etc: ... Or to create a constructor (or even all the data class methods) from existing properties in a class. Quick Fix example: create a constructor for final fields
🌐
GitHub
github.com › microsoft › vscode › issues › 91802
quick fix shortcut keys not work · Issue #91802 · microsoft/vscode
February 29, 2020 - Issue Type: Bug When there is an error in the file, it can be solved by clicking quick fix with the mouse, but the shortcut key (Ctrl +.) does not work. VS Code version: Code - OSS 1.42.1 (c47d83b, 2020-02-17T09:32:31.598Z) OS version: L...
Author   microsoft
🌐
SitePoint
sitepoint.com › blog › programming › 45 visual studio code shortcuts for boosting your productivity
45 VS Code Shortcuts for Boosting Your Productivity — SitePoint
November 15, 2024 - In a lot of cases when there’s an error, VS Code can resolve it if it’s a common or simple mistake. For example, if a semicolon is missing. This shortcut allows you to apply the quick fix to any error or warning if the quick fix is available for it.
🌐
Super User
superuser.com › questions › 1462240 › visual-studio-code-quick-fix-not-working
Visual Studio Code Quick Fix not working - Super User
However, recently I have been unable to use the quick fix option to import files or fix simple errors. Previously I have not experienced this issue. I tried doing a clean re-install of VSC (and the plugins as well) but to no avail. Does anyone know how to fix this? Thank you so very much! ... I am sorry I don't know what you mean by hand but if you mean like i tried to solve it not through the command line / shortcuts then yes (ie i uninstalled the extensions one by one then the whole software itself - although it did say preferences wouldn't be removed.)
🌐
GitHub
github.com › microsoft › vscode › issues › 179932
quick fix shortcut ( ctrl+. ) keys not working on Windows 10 · Issue #179932 · microsoft/vscode
April 14, 2023 - microsoft / vscode Public · Notifications · You must be signed in to change notification settings · Fork 39.4k · Star 184k · New issueCopy link · New issueCopy link · Closed · Closed · quick fix shortcut ( ctrl+. ) keys not working on Windows 10#179932 ·
Author   microsoft