Skip to content

Instantly share code, notes, and snippets.

@Jaysok
Created December 6, 2022 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaysok/af2d66d63b3634bef5e3c93c02f0e3f6 to your computer and use it in GitHub Desktop.
Save Jaysok/af2d66d63b3634bef5e3c93c02f0e3f6 to your computer and use it in GitHub Desktop.

vscode add all missing imports shortcut

There is no shortcut for "add all missing imports" by default. So we need add it manually.

See this link from vscode official.

You can simulate the action using right clicking the source code and trigger the action. As you can see, it is an action from what they call "Source Action".

As introduced in the link, we can add the action as a shortcut. The article is using the key binding as ctrl+shift+i but I used shift+cmd+i instead since I'm using Mac in which the add missing import shortcut for a single expression is cmd+i.

[
  {
    "key": "shift+cmd+i",
    "command": "editor.action.sourceAction",
    "args": {
        "kind": "source.addMissingImports",
        "apply": "first"
    }
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment