How to invoke the "Organize imports" TypeScript feature in Visual Studio?
Visual Studio Code has released a new feature in April last year which enable to organize imports on save. Can you try to update your current settings.json
with the following changes:
"editor.formatOnSave": true,
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
Hopefully this can be helpful and good luck!
This feature has now been added to Visual Studio 2017.
One can invoke it the following ways:
- Pressing Ctrl+R followed by Ctrl+G.
- Right-click in the code window and click
Organize Imports
in the context menu.
You can also use the following shortcut with your keyboard to "Organize imports":
Shift+Alt+O