Calling "add all missing imports" from VScode extension

Viewed 3394

I would like to trigger VSCode "add all missing imports" from an extension. Is it possible? If so, how?

Code Action

2 Answers

Until the most recent version for Linux (1.33.1) this option isn't available on "File" -> "Preferences" -> "Keyboard Shortcuts" window.

Unfortunately, you have to do it manually by clicking the helper icon or typing Ctrl + . to show fixes options =/

You can invoke it by calling the following command:

_typescript.applyFixAllCodeAction

with arguments:

[document.fileName, { fixId: 'fixMissingImport'}]
Related