vscode typescript: ‘Add all missing imports’ shortcut

Is there a shortcut for the same?

Yes, coming in v1.46 (see v1.46 release notes: add missing imports source action):

Add all missing imports source action

VS Code has long supported a quick fix that adds all missing imports
in a JavaScript or TypeScript file. This iteration, we introduced a
new Add all missing imports source action lets you trigger this from
anywhere in a file.

This also allows you to set up a keybinding for Add all missing imports:

{
    "key": "ctrl+shift+i",
    "command": "editor.action.sourceAction",
    "args": {
        "kind": "source.addMissingImports",
        "apply": "first"
    }
}

Or even enable Add all missing imports on save:

"editor.codeActionsOnSave": [
    "source.addMissingImports"
]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)